I have a local domain name "SomeName" and an Internet domain "AnotherName.dyndns.org" whose IP can change at any time (it uses a dynamic DNS). I want to resolve "SomeName" to "AnotherName.dyndns.org"'s IP. In other words, if "AnotherName.dyndns.org" points to, I want "SomeName" to point to that same IP, namely

Is there any easy and straightforward way to achieve this? I couldn't find such an option for DNSMasq or BIND. I suppose one could write a script that gets the domain's IP and rewrites the config file, then reloads the DNS server, but that would be so ugly.

Why do I want this? To put it simply, I want to setup a Bacula server and client. The server has to resolve "SomeName" to a local IP (static, no problem here) and the client has to resolve it to a public IP (dynamic, namely "AnotherName.dyndns.org").


If I understand correctly, what you want is a CNAME DNS record:


  • Thank you for your answer. Unfortunately, I tried for several hours to use something like SomeName IN CNAME AnotherName.dyndns.org in DNSMasq, BIND and Unbound but to no avail. Either I'm doing something terribly wrong or it isn't possible. I'm guessing the former, but right now I think I'm better off just writing a bash script that updates /etc/hosts.
    – liviucmg
    Jan 4 '12 at 22:43
  • In bind, a major trip up is the use of a "." at the end of a record. On the left hand side if you put domain.com this will be pre-pended to the zone's main domain. if you put domain.com. then there is no pre-pending. This is not the case for all setups but many default bind config files work this way. When in doubt fully specify the domain names and end them with a ".". Jan 5 '12 at 16:54

The CNAME DNS record looks like this:

<an alias> CNAME <a canonical name>

in example:

somename CNAME domain.dyndns.org

If domain.dyndns.org is resolved to the IP address dynamically, you have what you want.


What i understand is you are looking for Split DNS configuration. It also called views in BIND language. So you will create two view Private (local) and Public (Internet) and create ACL list to match your source IP address from where query coming base on that it will give you whatever IP address you want to give to client. for example if your request coming from private ip address 192.168.100.x then DNS will give you "SomeName" and if query coming from public domain it will give you "SomeName" 202.67.29.x

Take a look here. Hope this answer will fulfill your need. http://www.shorewall.net/SplitDNS.html


How about adding "AnotherName.dyndns.org" as domain-suffix for DNS-resolving on the client?

  • I don't know what you mean by that and Google didn't help me much. Can you explain a bit further, please?
    – liviucmg
    Jan 4 '12 at 22:36
  • If your client is a linux box you could add "AnotherName.dyndns.org" to the searchlist in /etc/resolv.conf. Now if that client looks up "foo" via DNS it will try "foo.AnotherName.dyndns.org" first. On a Windows-system you can accomplish the same in the TCP/IP-DNS-settings of the network card of the client. Most propably you can distribute that as group policy as well.
    – Nils
    Jan 5 '12 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.