Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 1.2.3.4, I want "SomeName" to point to that same IP, namely 1.2.3.4.

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").

share|improve this question
add comment

4 Answers

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.

share|improve this answer
add comment

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

share|improve this answer
    
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
add comment

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" 1.2.3.4 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

share|improve this answer
add comment

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

http://en.wikipedia.org/wiki/CNAME_record

share|improve this answer
    
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 ".". –  jeffatrackaid Jan 5 '12 at 16:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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