https://github.com/winglim/kea-dhcp4
Docker image for kea-dhcp4 with amd64, arm64 and arm32v7.
https://github.com/winglim/kea-dhcp4
docker-image kea-dhcp
Last synced: 3 months ago
JSON representation
Docker image for kea-dhcp4 with amd64, arm64 and arm32v7.
- Host: GitHub
- URL: https://github.com/winglim/kea-dhcp4
- Owner: WingLim
- Created: 2020-12-25T09:46:17.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-17T05:49:26.000Z (about 4 years ago)
- Last Synced: 2025-01-16T12:52:40.385Z (5 months ago)
- Topics: docker-image, kea-dhcp
- Language: Shell
- Homepage: https://hub.docker.com/r/winglim/kea-dhcp4
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kea-dhcp4

[](https://hub.docker.com/r/winglim/kea-dhcp4)
[](https://github.com/users/WingLim/packages/container/package/kea-dhcp4)

Docker image for kea-dhcp4 with amd64, arm64 and arm32v7.
Using Alpine 3.13
## Usage
### Use memfile
Create dir and files.
```shell
mkdir -p kea-dhcp4/conf
cd kea-dhcp4
touch conf/kea-dhcp4.conf
touch dhcp4.leases
touch docker-compose.yml
````docker-compose.yml`(same as `examples/docker-compose.file.yaml`):
```yaml
version: "3"
services:
kea-dhcp4:
image: ghcr.io/winglim/kea-dhcp4
# use docker hub
# image: winglim/kea-dhcp4
volumes:
- "$PWD/conf/kea-dhcp4.conf:/etc/kea/kea-dhcp4.conf"
- "$PWD/conf/dhcp4.leases:/var/lib/kea/dhcp4.leases"
restart: always
network_mode: host
container_name: kea-dhcp4
````conf/kea-dhcp4.conf`:
For more DHCP4 settings: [https://kea.readthedocs.io/en/kea-1.8.1/arm/dhcp4-srv.html](https://kea.readthedocs.io/en/kea-1.8.1/arm/dhcp4-srv.html)
```json
{
"Dhcp4": {
"valid-lifetime": 43200,
"renew-timer": 1000,
"rebind-timer": 2000,"interfaces-config": {
"interfaces": ["eth0"]
},"lease-database": {
"type": "memfile",
"persist": true,
"name": "/var/lib/kea/dhcp4.leases"
},"subnet4": [
{
"subnet": "192.168.1.0/24",
"pools": [
{
"pool": "192.168.1.1 - 192.168.1.255"
}
]
}
]
}
}
```### Use MariaDB or PostgreSQL
**NOTICE1: I use `kea-admin` to initialize the database, it may take some time, please be patient.**
**NOTICE2: I use `jq` to parse `kea-dhcp4.conf` to init database for kea-dhcp, jq CAN NOT parse json with comment, so you need to delete all comments.**
`docker-compose.yml`(same as `examples/docker-compose.db.yaml`):
Use `latest-db` tag.
```yaml
version: "3"
services:
kea-dhcp4:
image: ghcr.io/winglim/kea-dhcp4:latest-db
# use docker hub
# image: winglim/kea-dhcp4:latest-db
volumes:
- "$PWD/conf/kea-dhcp4.conf:/etc/kea/kea-dhcp4.conf"
restart: always
network_mode: host
container_name: kea-dhcp4
depends_on:
- mariadbmariadb:
image: yobasystems/alpine-mariadb
environment:
- MYSQL_DATABASE=keadhcp4
- MYSQL_ROOT_PASSWORD=keapassword
- MYSQL_USER=keauser
- MYSQL_PASSWORD=keapassword
volumes:
- "$PWD/conf/db:/var/lib/mysql"
ports:
- 3306:3306
restart: always
container_name: kea-mariadb
```Edit `lease-database` part in `conf/kea-dhcp4.conf`:
```json
"lease-database": {
"type": "mysql",
"host": "127.0.0.1",
"port": 3306,
"name": "keadhcp4",
"user": "keauser",
"password": "keapassword"
}
```