HOWTO Manage Dynamic DNS with nsupdate

HOWTO Manage Dynamic DNS with nsupdate

From Consultancy.EdVoncken.NET

Jump to: navigation, search

Contents

A and PTR records

Adding a host (A and PTR records)

 # nsupdate -k /etc/ddns-update.key
 > update add gateway.example.local 38400 A 192.168.123.254
 > 
 > update add 254.123.168.192.in-addr.arpa. 38400 PTR gateway.example.local.
 >
 > quit

Note: The empty line is necessary, it sends the update to DNS. Since we are adding records to two different zones, we need to send two separate updates.

Deleting a host (A and PTR records)

 # nsupdate -k /etc/ddns-update.key 
 > update delete gateway.example.local IN A 192.168.123.254
 > 
 > update delete 254.123.168.192.in-addr.arpa PTR gateway.example.local.
 > 
 > quit

MX records

Adding a mail-host

The domain "example.local" wishes to use "mail.example.local" as their primary mail host.

We first need to add the standard A and PTR records for the mailhost (TTL 86400 seconds), followed by the MX record for the domain:

 # nsupdate -k /etc/ddns-update.key 
 > update add mail.example.nl 86400 IN A 192.168.123.25
 > 
 > update add 25.123.168.192.in-addr.arpa. 86400 PTR mail.example.local.
 > 
 > update add example.local 86400 MX 10 mail.example.local.
 > 
 > quit

Note: The mailhost should of course be accessible from the Internet and use a routable IP address instead of an RFC1918 address.

Verify the results using 'dig':

 # dig example.local MX
 
 ; <<>> DiG 9.3.4-P1 <<>> example.local MX
 ;; global options:  printcmd
 ;; Got answer:
 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15733
 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 3
 
 ;; QUESTION SECTION:
 ;example.local.			IN	MX
 
 ;; ANSWER SECTION:
 example.local.		86400	IN	MX	10 mail.example.local.
 
 ;; AUTHORITY SECTION:
 example.local.		86400	IN	NS	ns2.example.local.
 example.local.		86400	IN	NS	ns1.example.local.
 
 ;; ADDITIONAL SECTION:
 mail.example.local.	86400	IN	A	192.168.123.25
 ns1.example.local.	86400	IN	A	192.168.123.1
 ns2.example.local.	86400	IN	A	192.168.123.2
 
 ;; Query time: 1 msec
 ;; SERVER: 127.0.0.1#53(127.0.0.1)
 ;; WHEN: Fri Jul 31 11:34:29 2009
 ;; MSG SIZE  rcvd: 134

Deleting a mail-host

If we wish to remove the mail-host, just delete the MX, A and PTR records:

 # nsupdate -k /etc/ddns-update.key 
 > update delete example.local MX 10 mail.example.local.
 > 
 > update delete mail.example.local IN A 192.168.123.25
 > 
 > update delete 25.123.168.192.in-addr.arpa PTR mail.example.local.
 > 
 > quit

Note: Mail may continue to be delivered to the old mailhost until the TTL expires!

Service (SRV) records

Adding SRV records for your IPA Server

After installing the IPA Server ("apollo" in this example), you should add some service-records to DNS for IPA discovery. The installer leaves a sample DNS zone file in /tmp. This is how I added the relevant records using nsupdate:

 # nsupdate -k /etc/ddns-update.key 
 > update add _ldap._tcp.example.local. 86400 IN SRV 0 100 389 apollo
 > 
 > update add _kerberos._tcp.example.local. 86400 IN SRV 0 100 88 apollo
 > 
 > update add _kerberos._udp.example.local. 86400 IN SRV 0 100 88 apollo
 > 
 > update add _kerberos-master._tcp.example.local. 86400 IN SRV 0 100 88 apollo
 > 
 > update add _kerberos-master._udp.example.local. 86400 IN SRV 0 100 88 apollo
 > 
 > update add _kpasswd._tcp.example.local. 86400 IN SRV 0 100 464 apollo
 > 
 > update add _kpasswd._udp.example.local. 86400 IN SRV 0 100 464 apollo
 > 
 > quit

Navigation