Table des matières

, ,

Notes Dynamic DNS DDNS avec DHCP

Voir :

Hack DHCP ne veux pas faire du DDNS sous RedHat 8

/etc/dhcp/dhclient-exit-hooks.d/update-dns.sh

#! /bin/bash
 
NAME_FQDN="$(hostname -s).acme.local"
IP=$(hostname -I |tr " " "\n" |egrep "192\.168\.1\.")
#IP=$(ip a | grep wlan0 | grep "inet " | awk '{print $2}' | cut -d '/' -f 1)
 
if [ ! -z "$IP" ]
then
nsupdate -k /root/rndc.key <<EOF
update del ${NAME_FQDN} A
update add ${NAME_FQDN} 86400 A ${IP}
send
EOF
fi
chmod +x /etc/dhcp/dhclient-exit-hooks.d/update-dns.sh

Ce hack n'est pas nécessaire

Il faut avoir le paquet isc-dhcp-client d'installé avec la configuration :

/etc/dhcp/dhclient.conf

send host-name = gethostname();

Exemple nsupdate

nsupdate -k /etc/rndc.key <<EOF
update del plop.acme.local A
update add plop.acme.local 86400 A 192.168.1.4
show
send
EOF

Autres

Voir :

Vérif syntax

dhcpd -t -cf /etc/dhcp/dhcpd.conf

Rafraichir la conf

> /var/lib/dhcpd/dhcpd.leases
systemctl restart dhcpd