2

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

liviucmg
  • 283
  • 1
  • 2
  • 6

4 Answers4

4

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

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

jeffatrackaid
  • 4,142
  • 19
  • 22
  • 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 04 '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 05 '12 at 16:54
1

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.

colemik
  • 759
  • 1
  • 12
  • 24
0

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

Satish
  • 682
  • 3
  • 8
  • 22
0

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

Nils
  • 7,695
  • 3
  • 34
  • 73
  • 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 04 '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 05 '12 at 20:59