我在Ubuntu Server 16.04上使用ISC-DHCP 4.3.3。
$ cat /etc/dhcp/dhcpd.conf ddns-update-style none; option domain-name "int.mydomain.net"; option domain-name-servers 192.168.2.80; default-lease-time 600; max-lease-time 7200; authoritative; log-facility local7; subnet 192.168.2.0 netmask 255.255.255.0 { range 192.168.2.150 192.168.2.200; option routers 192.168.2.1; option subnet-mask 255.255.255.0; option broadcast-address 192.168.2.255; option netbios-name-servers 192.168.2.80; #file for host definitions include "/etc/dhcp/hosts.conf"; on commit { set noname = concat("dhcp-", binary-to-ascii(10, 8, "-", leased-address)); set ClientIP = binary-to-ascii(10, 8, ".", leased-address); set ClientDHCID = binary-to-ascii(16, 8, ":", hardware); set ClientName = pick-first-value(option host-name, noname); log(concat("Commit: IP: ", ClientIP, " DHCID: ", ClientDHCID, " Name: ", ClientName)); execute("/etc/dhcp/bin/dhcp-dyndns.sh", "add", ClientIP, ClientDHCID, ClientName); } ... }
hosts.conf的一部分:
host Peter-Handy { option dhcp-client-identifier "android-94....8a"; hardware ethernet themac; fixed-address 192.168.2.123; option host-name "Peter-Handy"; }
显示的主机是Android智能手机。 手机将名称“android-somenuber”发送到DHCP服务器。 但是,由于在networking中有更多的电话,我希望它是可读的。 主机名称应为“Peter-Handy”(btw:“Handy”是“手机”的德语单词 – 如果不清楚的话)。
一旦主机得到它的租约,我希望脚本“dhcp-dyndns.sh”与主机名称“彼得手”调用。 但是,它被称为“android-somenumber”作为主机名。
你能发现configuration错误吗?
以上代码旨在更新用作Samba-DC后端的Bind-DNS-Server的DNSlogging。 在官方的Samba-Wiki中,他们已经这样显示( https://wiki.samba.org/index.php/Configure_DHCP_to_update_DNS_records_with_BIND9 )。
有一个更好的方法吗?
我看到了使用“ddns-update-style adhoc”的选项。 但是看起来,这种更新风格已经被弃用了。