3

I have couple of linux servers that I to assign static IPs to because I'm doing some CARPing and Vlans.

The way my DNS server is set, it gets the hostnames dynamically from the nodes, as soon as there is a new node on the network.

This approach only works unfortunately for servers with dhcp clients. To send hostname, you edit /etc/dhcp3/dhclient.conf file with hostnames, and restart dhclient.

Anyone knows of a way to do this with servers with static ip's?

1 Answer 1

2

Yes, you can use nsupdate in your /etc/network/if-up.d/ directory.

For example

echo -e "server ns1.domain\n zone domain\n update delete test.domain\n update add test.domain 600 A 10.1.1.188\n send" | nsupdate

In long form, this is:

nsupdate
> server ns1.domain
> zone domain
> update delete test.domain
> update add test.domain 600 A 10.1.1.188
> send

So this saying

  1. Choose the ns1.domain name server
  2. update the "domain" zone
  3. Delete the current record
  4. Add the new record
  5. Send to name server

On the name server, you will need to allow updates, which in bind is the directive:

allow-update { 10.10.10.0/24; };

This would allow updates from the 10.10.10.0/24 network

4
  • do you need some type of credentials to the dns server for this type of update
    – kmassada
    Feb 18, 2013 at 19:52
  • @kmassada It is optional - the above example doesn't require auth, but you can use pre-shared keys to authenticate clients. In your case, you are already allowing updates from the dhcp server, so you can choose to extend this to the statics, or use keys.
    – Paul
    Feb 18, 2013 at 21:05
  • How would this work if all the servers are on a LAN and not registered domains? Would the router at 192.168.1.1 (for example) be able to handle this? Or is nsupdate only for an actual DNS server? Jul 2, 2015 at 6:05
  • @Edward_178118 It requires a DNS server that allows updates, which "proper" ones do, but it is unlikely that one in a router would work. Internet registered domains are not special, they are just registered, the DNS works the same. So it will work for both.
    – Paul
    Jul 7, 2015 at 10:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .