Portál AbcLinuxu, 1. listopadu 2025 14:18
authoritative;
ddns-update-style none;
default-lease-time 21600;
max-lease-time 21600;
class "VLAN-200" {
match if binary-to-ascii(10,16,"",substring(option agent.circuit-id,2,2)) = "200";
log(info, "matched to a VLAN-200");
}
class "VLAN-222" {
match if binary-to-ascii(10,16,"",substring(option agent.circuit-id,2,2)) = "222";
log(info, "matched to a VLAN-222");
}
shared-network FOO-BAR {
# mgmt LAN - switch (dhcp relay agent)
subnet 192.168.14.0 netmask 255.255.255.0 {
}
# vlan-100 - local LAN
subnet 172.16.100.0 netmask 255.255.255.0 {
}
# vlan-200 - DHCP relay
subnet 172.16.200.0 netmask 255.255.255.0 {
pool {
allow members of "VLAN-200";
deny members of "VLAN-222";
default-lease-time 300;
max-lease-time 300;
range 172.16.200.50 172.16.200.100;
option routers 172.16.200.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 1.1.1.1;
# AK TOTO ODKOMENTUJEM, TAK TO FUNGUJE
#host client-200 {
# hardware ethernet 00:0b:82:12:b7:65;
# fixed-address 172.16.200.75;
#}
}
}
# vlan-222 - DHCP relay
subnet 172.16.222.0 netmask 255.255.255.0 {
pool {
allow members of "VLAN-222";
deny members of "VLAN-200";
default-lease-time 300;
max-lease-time 300;
range 172.16.222.50 172.16.222.100;
option routers 172.16.222.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 1.1.1.1;
host client-222 {
hardware ethernet 00:0b:82:12:b7:65;
fixed-address 172.16.222.75;
}
}
}
}
Jun 20 17:35:19 test-dhcp dhcpd: matched to a VLAN-200 Jun 20 17:35:19 test-dhcp dhcpd: DHCPDISCOVER from 00:0b:82:12:b7:65 via 192.168.14.50 Jun 20 17:35:19 test-dhcp dhcpd: DHCPOFFER on 172.16.222.75 to 00:0b:82:12:b7:65 via 192.168.14.50 Jun 20 17:35:19 test-dhcp dhcpd: Dynamic and static leases present for 172.16.222.75. Jun 20 17:35:19 test-dhcp dhcpd: Remove host declaration client-222 or remove 172.16.222.75 Jun 20 17:35:19 test-dhcp dhcpd: from the dynamic address pool for FOO-BAR Jun 20 17:35:19 test-dhcp dhcpd: matched to a VLAN-200 Jun 20 17:35:19 test-dhcp dhcpd: DHCPREQUEST for 172.16.222.75 (172.16.100.5) from 00:0b:82:12:b7:65 via 192.168.14.50 Jun 20 17:35:19 test-dhcp dhcpd: DHCPACK on 172.16.222.75 to 00:0b:82:12:b7:65 via 192.168.14.50
Řešení dotazu:
host client-tel {
hardware ethernet 00:0b:82:12:b7:65;
fixed-address 172.16.200.101,172.16.222.101;
}
mi nefungovalo, vzdy dostal prvu definovanu IP adresu.
Toto:
host client-tel-1 {
hardware ethernet 00:0b:82:12:b7:65;
fixed-address 172.16.200.101;
}
host client-tel-2 {
hardware ethernet 00:0b:82:12:b7:65;
fixed-address 172.16.222.101;
}
mi tiez nefungovalo, rovnake spravanie ako vyssie.
Dalej sa pise:
Conversely, for a host declaration to match a client being allocated a dynamic address, it must not have any fixed-address statements.
Z toho mi vychadza, ze to, co chcem (v jednom subnete staticka IP, v druhom dynamicka), sa vlastne ani neda. Ale za tym je doplnenie:
You may therefore need a mixture of host declarations for any given client...some having fixed-address statements, others without.
Cize nieco taketo(?):
host client-tel-1 {
hardware ethernet 00:0b:82:12:b7:65;
}
host client-tel-2 {
hardware ethernet 00:0b:82:12:b7:65;
fixed-address 172.16.222.101;
}
Ale to mi tiez nefugovalo :/.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.