To register an Ubuntu server with static networking details into DNS, create this script as “reg_dns.sh” in /root
#!/bin/bash
# Description: registers this server in the default DNS server
HOST=`hostname -f`
IP=`/sbin/ifconfig eth0 | sed -n ‘/inet addr:/s=[^:]*:\([^ ]*\).*=\1=;2p’`
#echo “server 192.168.72.1” > /tmp/nsupdate.txt
echo “key DHCP_UPDATER fKsyqnH7YTXmX1LPd8HKqw==” > /tmp/nsupdate.txt
#echo “key DHCP_UPDATER fKsyqnH7YTXmX1LPd8HKqw==” >> /tmp/nsupdate.txt
echo “update add $HOST 86400 a $IP” >> /tmp/nsupdate.txt
echo “send” >> /tmp/nsupdate.txt
nsupdate -v /tmp/nsupdate.txt
make the script executable:
chmod ug+x /root/reg_dns.sh
and add the following to the end of /etc/rc.local before the “exit 0” line
/root/reg_dns.sh