Aggiunto kea-dhcp-server
Some checks failed
Update Docker Hub Description / dockerHubDescription (push) Failing after 2s

This commit is contained in:
GianLuca Vagnuzzi
2026-01-13 08:53:18 +01:00
parent 22e6b4e2ad
commit e99999cc27
8 changed files with 166 additions and 120 deletions

View File

@@ -30,19 +30,12 @@ done
}
function _main {
[ -e "/data/dhcpd4.conf" ] || cp "/template/dhcpd4.conf" "/data/"
[ -e "/data/dhcpd6.conf" ] || cp "/template/dhcpd6.conf" "/data/"
[ -e "/data/dhcpd4.leases" ] || touch "/data/dhcpd4.leases"
[ -e "/data/dhcpd6.leases" ] || touch "/data/dhcpd6.leases"
useradd dhcpd
uid=$(id -u dhcpd)
gid=$(id -g dhcpd)
chown -R dhcpd: "/data/dhcpd4.leases" "/data/dhcpd6.leases"
[ ! -e /var/run/kea ] && mkdir -p /var/run/kea
[ -e "/var/lib/kea/kea-dhcp4.conf" ] || cp "/template/kea-dhcp4.conf" "/var/lib/kea/"
[ -e "/var/lib/kea/kea-dhcp6.conf" ] || cp "/template/kea-dhcp6.conf" "/var/lib/kea/"
export CMDv6="kea-dhcp6 -c /var/lib/kea/kea-dhcp6.conf"
#export CMDv4="/usr/sbin/dhcpd -4 -f -d --no-pid -cf /data/dhcpd4.conf -lf /data/dhcpd4.leases -user dhcpd -group dhcpd"
export CMDv6="/usr/sbin/dhcpd -6 -f -d --no-pid -cf /data/dhcpd6.conf -lf /data/dhcpd6.leases -user dhcpd -group dhcpd"
chown -R dhcpd: "/data"
chown -R _kea: "/var/lib/kea"
}
custom_bashrc() {

View File

@@ -1,44 +0,0 @@
# 3600 = 1 hour
# 86400 = 1 day
# 604800 = 1 week
# 2419200 = 1 month
default-lease-time 604800;
max-lease-time 2419200;
log-facility local7;
## assign 10.10.10.x/24 address (ex 10.10.10.1) to the interface from which you want to propagate the dhcp.
subnet 10.10.10.0 netmask 255.255.255.0 {
## dhcp inclusion range
range 10.10.10.50 10.10.10.200;
ddns-domainname "domain.com";
option domain-name "domain.com";
option subnet-mask 255.255.255.0;
option broadcast-address 10.10.10.255;
option routers 10.10.10.145;
option domain-name-servers 10.10.10.131, 10.10.10.132;
option ntp-servers ntp;
option smtp-server mail;
# option time-offset -10000;
# option netbios-name-servers 192.168.111.5;
# default-lease-time 604800;
# max-lease-time 2419200;
# deny unknown-clients;
deny bootp;
deny duplicates;
deny declines;
## reservation
#host dsk01 {hardware ethernet bc:24:11:cf:a4:86; fixed-address 10.10.10.129;}
#host dsk02 {hardware ethernet dc:a6:32:d5:f3:f4; fixed-address 10.10.10.133;}
## deny from dhcp
class "ignored" {match substring (hardware, 1, 6); ignore booting;}
# subclass "ignored" 18:45:91:c3:d9:00;
# subclass "ignored" 18:45:91:c3:d9:00;
}

View File

@@ -1,44 +0,0 @@
# 3600 = 1 hour
# 86400 = 1 day
# 604800 = 1 week
# 2419200 = 1 month
default-lease-time 2592000;
preferred-lifetime 604800;
option dhcp-renewal-time 3600;
option dhcp-rebinding-time 7200;
allow leasequery;
option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:3f3e;
option dhcp6.domain-search "test.example.com","example.com";
option dhcp6.info-refresh-time 21600;
# Static definition (must be global)
#host myclient {
# dhcp6.client-id 00:01:00:01:00:04:93:e0:00:00:00:00:a2:a2;
#
# fixed-address6 3ffe:501:ffff:100::1234;
# fixed-prefix6 3ffe:501:ffff:101::/64;
#
# # Override of the global definitions,
# option dhcp6.name-servers 3ffe:501:ffff:100:200:ff:fe00:4f4e;
#}
#host otherclient {
# hardware ethernet 01:00:80:a2:55:67;
# fixed-address6 3ffe:501:ffff:100::4321;
#}
#subnet6 3ffe:501:ffff:100::/64 {
# range6 3ffe:501:ffff:100::10 3ffe:501:ffff:100::11;
#}
#subnet6 3ffe:501:ffff:102::/64 {
# range6 3ffe:501:ffff:102::10 3ffe:501:ffff:102::11;
#}

View File

@@ -0,0 +1,66 @@
{
"Dhcp4": {
"interfaces-config": {
"interfaces": [ "eth0" ]
},
"lease-database": {
"type": "memfile",
"persist": true,
"name": "/var/lib/kea/leases4.csv"
},
"valid-lifetime": 604800,
"renew-timer": 302400,
"rebind-timer": 453600,
"max-valid-lifetime": 2419200,
"subnet4": [
{
"id": 1,
"subnet": "10.10.10.0/24",
"pools": [
{ "pool": "10.10.10.50 - 10.10.10.200" }
],
"option-data": [
{ "name": "subnet-mask", "data": "255.255.255.0" },
{ "name": "routers", "data": "10.10.10.254" },
{ "name": "broadcast-address", "data": "10.10.10.255" },
{ "name": "domain-name-servers", "data": "10.10.10.131, 10.10.10.132" },
{ "name": "domain-name", "data": "domain.com" },
{ "name": "ntp-servers", "data": "10.10.10.254" },
{ "name": "smtp-server", "data": "10.10.10.254" }
],
"reservations": [
// {
// "hw-address": "bc:24:11:cf:a4:86",
// "ip-address": "10.10.10.129",
// "hostname": "dsk01"
// },
// {
// "hw-address": "dc:a6:32:d5:f3:f4",
// "ip-address": "10.10.10.133",
// "hostname": "dsk02"
// }
]
}
],
//"deny-clients": {
// "bootp": true
//},
"loggers": [
{
"name": "kea-dhcp4",
"output_options": [
{
"output": "stdout",
"pattern": "%d{%Y-%m-%d %H:%M:%S} %m"
}
],
"severity": "INFO"
}
]
}
}

View File

@@ -0,0 +1,76 @@
{
"Dhcp6": {
"interfaces-config": {
"interfaces": [ "eth0" ]
},
"lease-database": {
"type": "memfile",
"persist": true,
"name": "/var/lib/kea/leases6.csv"
},
"valid-lifetime": 2592000,
"preferred-lifetime": 604800,
"renew-timer": 3600,
"rebind-timer": 7200,
"subnet6": [
// {
// "id": 1,
// "subnet": "3ffe:501:ffff:100::/64",
// "pools": [
// { "pool": "3ffe:501:ffff:100::10 - 3ffe:501:ffff:100::11" }
// ]
// },
// {
// "subnet": "3ffe:501:ffff:102::/64",
// "pools": [
// { "pool": "3ffe:501:ffff:102::10 - 3ffe:501:ffff:102::11" }
// ]
// }
],
"option-data": [
{
"name": "dns-servers",
"data": "3ffe:501:ffff:100:200:ff:fe00:3f3e"
},
{
"name": "domain-search",
"data": "test.example.com,example.com"
}
],
"reservations": [
// {
// "dhcp6-client-id": "00:01:00:01:00:04:93:e0:00:00:00:00:a2:a2",
// "ip-addresses": ["3ffe:501:ffff:100::1234"],
// "prefixes": ["3ffe:501:ffff:101::/64"],
// "option-data": [
// {
// "name": "dns-servers",
// "data": "3ffe:501:ffff:100:200:ff:fe00:4f4e"
// }
// ]
// },
// {
// "dhcp6-client-id": "hardware-addr-01:00:80:a2:55:67",
// "ip-addresses": ["3ffe:501:ffff:100::4321"]
// }
],
"loggers": [
{
"name": "kea-dhcp6",
"output_options": [
{
"output": "stdout",
"pattern": "%d{%Y-%m-%d %H:%M:%S} %m"
}
],
"severity": "INFO"
}
]
}
}