How to update DNS through DHCP automatically
If you are looking for configuration then you need it as follows:
Let us say domain is test.com
Domain nameserver, dns (named), samba and most of Linux services servers ip is 192.168.0.1
And network is 192.168.0.1/24 for dhcp ips are 192.168.0.10-60
Your dhcpd.conf should be as follows (use DHCP Server version 3 or above)
ddns-updates on;
ddns-domainname “test.com”;
option ntp-servers 192.168.0.1;
ddns-update-style ad-hoc;
allow unknown-clients;
default-lease-time 86400;
max-lease-time 172800;option domain-name “test.com”;
option domain-name-servers 192.168.0.1;
option netbios-name-servers 192.168.0.1;
option netbios-dd-server 192.168.0.1;
option netbios-node-type 8;subnet 192.168.0.1 netmask 255.255.255.0 {
range dynamic-bootp 192.168.0.10 192.168.0.60;
option subnet-mask 255.255.255.0;
option routers 192.168.0.220;
allow unknown-clients;
}
In your named.conf file it should be as follows:
acl lan {
192.168.0.1/24;
127.0.0.1;
};options {
directory “/var/named”;
listen-on-v6 { any; };
notify no;
forward first;
forwarders {
192.168.0.254;
};
auth-nxdomain yes;
multiple-cnames yes;
listen-on {
lan;
};
};zone “test.com” {
type master;
file “/var/named/test.com.zone”;
allow-query {
lan;
};
allow-transfer {
lan;
};
allow-update {
lan;
};
};zone “0.168.192.in-addr.arpa” {
type master;
file “/var/named/192.168.0.rev.zone”;
allow-query {
lan;
};
allow-transfer {
lan;
};
allow-update {
lan;
};
};