Setting host-decl-name
should fix this problem but vyos is not letting me save the config with this parameter set!
After setting this parameter and committing changes, It generates a temporary file at /tmp/dhcpd.conf
.
That file looks like this,
### Autogenerated by dhcp_server.py ###
# For options please consult the following website:
# https://www.isc.org/wp-content/uploads/2017/08/dhcp43options.html
#
# log-facility local7;
on release {
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name);
set ClientIp = binary-to-ascii(10, 8, ".",leased-address);
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "release", "", ClientIp, "", "");
}
on expiry {
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name);
set ClientIp = binary-to-ascii(10, 8, ".",leased-address);
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "release", "", ClientIp, "", "");
}
use-host-decl-names on;
ddns-update-style none;
option rfc3442-static-route code 121 = array of integer 8;
option windows-static-route code 249 = array of integer 8;
option wpad-url code 252 = text;
option rfc8925-ipv6-only-preferred code 108 = unsigned integer 32;
# Vendor specific options - Ubiquiti Networks
option space ubnt;
option ubnt.unifi-controller code 1 = ip-address;
class "ubnt" {
match if substring (option vendor-class-identifier , 0, 4) = "ubnt";
option vendor-class-identifier "ubnt";
vendor-option-space ubnt;
}
# The following 1 line(s) have been added as
# global-parameters in the CLI and have not been validated !!!
use-host-decl-names on;
# Shared network configration(s)
shared-network vlan10 {
authoritative;
option domain-name-servers 10.0.99.14;
option domain-name "home.arpa";
option domain-search "home.arpa";
option ntp-servers 10.0.10.1;
subnet 10.0.10.0 netmask 255.255.255.0 {
option domain-name-servers 10.0.99.14;
option routers 10.0.10.1;
default-lease-time 43200;
max-lease-time 43200;
host ESP-0D4C7B {
fixed-address 10.0.10.20;
hardware ethernet 24:a1:60:0d:4c:7b;
}
host ha {
fixed-address 10.0.10.18;
hardware ethernet 3e:f1:c0:4d:c9:c7;
}
host wlan0 {
fixed-address 10.0.10.23;
hardware ethernet 38:1f:8d:39:8e:06;
}
pool {
range 10.0.10.10 10.0.10.50;
}
}
on commit {
set shared-networkname = "vlan10";
set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name, "empty_hostname");
if not (ClientName = "empty_hostname") {
set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
} else {
log(concat("Hostname is not defined for client with IP: ", ClientIP, " MAC: ", ClientMac));
}
}
}
shared-network vlan20 {
authoritative;
option domain-name-servers 10.0.99.14;
option domain-name "home.arpa";
option domain-search "home.arpa";
option ntp-servers 10.0.20.1;
subnet 10.0.20.0 netmask 255.255.255.0 {
option routers 10.0.20.1;
default-lease-time 43200;
max-lease-time 43200;
pool {
range 10.0.20.10 10.0.20.50;
}
}
on commit {
set shared-networkname = "vlan20";
set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name, "empty_hostname");
if not (ClientName = "empty_hostname") {
set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
} else {
log(concat("Hostname is not defined for client with IP: ", ClientIP, " MAC: ", ClientMac));
}
}
}
shared-network vlan30 {
authoritative;
option domain-name-servers 10.0.99.14;
option domain-name "home.arpa";
option domain-search "home.arpa";
option ntp-servers 10.0.30.1;
subnet 10.0.30.0 netmask 255.255.255.0 {
option routers 10.0.30.1;
default-lease-time 43200;
max-lease-time 43200;
pool {
range 10.0.30.10 10.0.30.50;
}
}
on commit {
set shared-networkname = "vlan30";
set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name, "empty_hostname");
if not (ClientName = "empty_hostname") {
set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
} else {
log(concat("Hostname is not defined for client with IP: ", ClientIP, " MAC: ", ClientMac));
}
}
}
shared-network vlan40 {
authoritative;
option domain-name-servers 10.0.99.14;
option domain-name "home.arpa";
option domain-search "home.arpa";
option ntp-servers 10.0.40.1;
subnet 10.0.40.0 netmask 255.255.255.0 {
option routers 10.0.40.1;
default-lease-time 43200;
max-lease-time 43200;
pool {
range 10.0.40.10 10.0.40.50;
}
}
on commit {
set shared-networkname = "vlan40";
set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name, "empty_hostname");
if not (ClientName = "empty_hostname") {
set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
} else {
log(concat("Hostname is not defined for client with IP: ", ClientIP, " MAC: ", ClientMac));
}
}
}
shared-network vlan50 {
authoritative;
option domain-name-servers 10.0.99.14;
option domain-name "home.arpa";
option domain-search "home.arpa";
option ntp-servers 10.0.50.1;
subnet 10.0.50.0 netmask 255.255.255.0 {
option routers 10.0.50.1;
default-lease-time 43200;
max-lease-time 43200;
host arr {
fixed-address 10.0.50.16;
hardware ethernet da:0e:0d:8f:05:3b;
}
host caddy {
fixed-address 10.0.50.3;
hardware ethernet fe:dc:29:20:67:50;
}
host deluge {
fixed-address 10.0.50.14;
hardware ethernet d6:7b:d0:98:d6:2b;
}
host garage {
fixed-address 10.0.50.17;
hardware ethernet f6:3c:40:0d:11:23;
}
host gitea {
fixed-address 10.0.50.20;
hardware ethernet fe:2f:15:b3:9d:6d;
}
host grafana {
fixed-address 10.0.50.12;
hardware ethernet 0a:0e:01:16:f9:4c;
}
host influxdb {
fixed-address 10.0.50.8;
hardware ethernet f6:f7:3b:35:0a:c4;
}
host jackett {
fixed-address 10.0.50.21;
hardware ethernet 1a:21:50:59:54:ee;
}
host jellyfin {
fixed-address 10.0.50.11;
hardware ethernet 42:83:00:ba:47:96;
}
host lldap {
fixed-address 10.0.50.18;
hardware ethernet 92:6c:f5:91:f4:bd;
}
host mariadb {
fixed-address 10.0.50.6;
hardware ethernet 4a:05:ee:aa:42:50;
}
host nas {
fixed-address 10.0.50.10;
hardware ethernet ce:35:69:50:4c:95;
}
host paperless {
fixed-address 10.0.50.15;
hardware ethernet b6:81:3c:6b:36:d1;
}
host postgres {
fixed-address 10.0.50.7;
hardware ethernet 3a:05:ee:aa:42:50;
}
host syslog {
fixed-address 10.0.50.9;
hardware ethernet 0e:23:43:84:74:6c;
}
host thelounge {
fixed-address 10.0.50.13;
hardware ethernet 8a:90:17:27:04:a3;
}
host vscode {
fixed-address 10.0.50.22;
hardware ethernet 8a:df:13:1b:fd:8e;
}
pool {
range 10.0.50.30 10.0.50.50;
}
}
on commit {
set shared-networkname = "vlan50";
set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name, "empty_hostname");
if not (ClientName = "empty_hostname") {
set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
} else {
log(concat("Hostname is not defined for client with IP: ", ClientIP, " MAC: ", ClientMac));
}
}
}
shared-network vlan60 {
authoritative;
option domain-name-servers 10.0.99.14;
option domain-name "home.arpa";
option domain-search "home.arpa";
option ntp-servers 10.0.60.1;
subnet 10.0.60.0 netmask 255.255.255.0 {
option routers 10.0.60.1;
default-lease-time 43200;
max-lease-time 43200;
pool {
range 10.0.60.10 10.0.60.50;
}
}
on commit {
set shared-networkname = "vlan60";
set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name, "empty_hostname");
if not (ClientName = "empty_hostname") {
set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
} else {
log(concat("Hostname is not defined for client with IP: ", ClientIP, " MAC: ", ClientMac));
}
}
}
shared-network vlan70 {
authoritative;
option domain-name-servers 10.0.99.14;
option domain-name "home.arpa";
option domain-search "home.arpa";
option ntp-servers 10.0.70.1;
subnet 10.0.70.0 netmask 255.255.255.0 {
option routers 10.0.70.1;
default-lease-time 43200;
max-lease-time 43200;
host Clinic {
fixed-address 10.0.70.13;
hardware ethernet ec:71:db:5e:1d:6e;
}
host EPSON1E715E {
fixed-address 10.0.70.14;
hardware ethernet f8:d0:27:1e:71:5e;
}
host Outdoors {
fixed-address 10.0.70.11;
hardware ethernet ec:71:db:61:0b:71;
}
host Road {
fixed-address 10.0.70.12;
hardware ethernet ec:71:db:ab:5c:c2;
}
host cups {
fixed-address 10.0.70.7;
hardware ethernet 3a:c1:ee:aa:42:70;
}
host mariadb {
fixed-address 10.0.70.6;
hardware ethernet 4a:05:ee:aa:42:70;
}
host shinobi {
fixed-address 10.0.70.10;
hardware ethernet 6e:75:53:30:80:1e;
}
host syslog {
fixed-address 10.0.70.9;
hardware ethernet 7e:f9:bf:18:60:36;
}
pool {
range 10.0.70.10 10.0.70.50;
}
}
on commit {
set shared-networkname = "vlan70";
set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name, "empty_hostname");
if not (ClientName = "empty_hostname") {
set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
} else {
log(concat("Hostname is not defined for client with IP: ", ClientIP, " MAC: ", ClientMac));
}
}
}
shared-network vlan99 {
authoritative;
option domain-name-servers 10.0.99.14;
option domain-name "home.arpa";
option domain-search "home.arpa";
option ntp-servers 10.0.99.1;
subnet 10.0.99.0 netmask 255.255.255.0 {
option routers 10.0.99.1;
default-lease-time 43200;
max-lease-time 43200;
host EAP245-60-A4-B7-47-8E-94 {
fixed-address 10.0.99.2;
hardware ethernet 60:a4:b7:47:8e:94;
}
host EAP660-HD-50-91-E3-C6-18-C6 {
fixed-address 10.0.99.5;
hardware ethernet 50:91:e3:c6:18:c6;
}
host Openwrt-AP2 {
fixed-address 10.0.99.4;
hardware ethernet d8:07:b6:b4:7e:9e;
}
host Openwrt-AP4 {
fixed-address 10.0.99.12;
hardware ethernet 10:27:F5:7D:AF:A7;
}
host TL-SG2210MP {
fixed-address 10.0.99.7;
hardware ethernet 00:31:92:76:47:39;
}
host TL-SG2210P {
fixed-address 10.0.99.11;
hardware ethernet b4:b0:24:98:0c:fa;
}
host adguardhome {
fixed-address 10.0.99.14;
hardware ethernet 2a:05:ee:40:42:99;
}
host omada {
fixed-address 10.0.99.16;
hardware ethernet 72:bc:48:bd:7f:cc;
}
host pvenas {
fixed-address 10.0.99.9;
hardware ethernet a8:a1:59:b7:de:5f;
}
host syslog {
fixed-address 10.0.99.13;
hardware ethernet 4a:9e:f4:1f:cd:de;
}
pool {
range 10.0.99.20 10.0.99.50;
}
}
on commit {
set shared-networkname = "vlan99";
set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name, "empty_hostname");
if not (ClientName = "empty_hostname") {
set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
} else {
log(concat("Hostname is not defined for client with IP: ", ClientIP, " MAC: ", ClientMac));
}
}
}
shared-network vlan150 {
authoritative;
option domain-name-servers 10.0.99.14;
option domain-name "home.arpa";
option domain-search "home.arpa";
option ntp-servers 10.0.150.1;
subnet 10.0.150.0 netmask 255.255.255.0 {
option routers 10.0.150.1;
default-lease-time 43200;
max-lease-time 43200;
pool {
range 10.0.150.10 10.0.150.50;
}
}
on commit {
set shared-networkname = "vlan150";
set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name, "empty_hostname");
if not (ClientName = "empty_hostname") {
set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
} else {
log(concat("Hostname is not defined for client with IP: ", ClientIP, " MAC: ", ClientMac));
}
}
}
shared-network vlan160 {
authoritative;
option domain-name-servers 10.0.99.14;
option domain-name "home.arpa";
option domain-search "home.arpa";
option ntp-servers 10.0.160.1;
subnet 10.0.160.0 netmask 255.255.255.0 {
option routers 10.0.160.1;
default-lease-time 43200;
max-lease-time 43200;
pool {
range 10.0.160.10 10.0.160.50;
}
}
on commit {
set shared-networkname = "vlan160";
set ClientIp = binary-to-ascii(10, 8, ".", leased-address);
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
set ClientName = pick-first-value(host-decl-name, option fqdn.hostname, option host-name, "empty_hostname");
if not (ClientName = "empty_hostname") {
set ClientDomain = pick-first-value(config-option domain-name, "..YYZ!");
execute("/usr/libexec/vyos/system/on-dhcp-event.sh", "commit", ClientName, ClientIp, ClientMac, ClientDomain);
} else {
log(concat("Hostname is not defined for client with IP: ", ClientIP, " MAC: ", ClientMac));
}
}
}
use-host-decl-names on;
was added separately so that’s why it’s repeated in the config.
In dhcp_server.py
, It adds use-host-decl-names on;
if host-decl-name
was set and then it checks for the value of host-decl-name
at 2 other places. at one of these places, the check fails and it adds shared network name as prefix.
Manually setting use-host-decl-names on;
will not fix the problem because it’s still looking at the host-decl-name
parameter in vyos config.
so now I have to figure out why vyos won’t let me set this parameter in vyos config.