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'm having trouble trying to find anything on the internet explaining how to do this...

I'm running Ubuntu 14.04 with repository current Bind9

I have a authoritative DNS server hosting my domain and my web/mail server on my network behind a single static external IP address that is shared by all the other computers in the building.

I have a DNS caching setup on a 2nd machine for all my out going DNS requests and I would like it so that when I type www.my.domain, the DNS cache will give the internal IP of the web-server instead of the external IP.

I haven't been about to find any information on how to do this, but I don't think I'm searching for the correct terminology.

i tried just adding the addresses to the /etc/hosts file and this doesn't work for the rest of the network.

i don't know where to look from here, can anyone point me in the correct direction.

thanks.

share|improve this question

2 Answers 2

The search term you're looking for is "split DNS" or "split views". It's generally regarded as a bad idea due to the management headaches that end up being created by it in the long term.

You may wish to consider creating a privately forwarded subdomain that is not exposed on the internet. (i.e. int.example.com, something under a domain you own) Put your DNS records for private IP addresses in this domain. It will not solve the problem of making www.example.com selectively return the private IP -- this should usually be solved on individual systems -- but it will at least give you dedicated DNS records for your private network.

share|improve this answer
    
this certainly solves some of my problem, but i use virtual hosting for multiple sites.. ie: training.my.domain, webmail.my.domain, www.my.domain. i supose i can put up with it... i was just hoping i had a solution –  RandomOzzy Jul 17 at 2:25
    
I've had to use it before and it works fine. I'm not sure what management headaches Andrew is referring to. –  Matt Jul 17 at 2:56
    
I use split DNS for my home and work network. If the volume of records is small it's not horrible to manage, but you gave to remember... –  uSlackr Jul 17 at 3:01
    
if the private network does not have internet access, why not just overload the A address for www.my.domain so that it has two A addresses: the internal, and the external. the browser should discard the internal IP, and fail over to the public IP. and vice versa. so long as you use a private IP in a Subnet that is not commonly used by LANs, things should be fine? –  RapidWebs Jul 17 at 6:36
    
@RapidWebs An application doing anything other than using the first DNS record returned in a round robin set is implementation specific behavior. You never rely on implementation specific behavior in production. Also see: superuser.com/questions/615302/… –  Andrew B Jul 17 at 19:52

You can use Unbound which supports exactly what you want to do. It would replace BIND, and your configuration would look something like this;

local-zone: "example.com." transparent local-data: "server1.example.com. IN A 192.168.0.10" local-data: "server2.example.com. IN A 192.168.0.11" local-data: "serverN.example.com. IN A 192.168.0.12"

What this does;

  1. Define the zone 'example.com'.
  2. transparent refers to a mode that will pass through to external/forwarder nameservers if it doesn't have a local-data record that matches.
  3. local-data defines the records you'd like to override internally. server1.example.com could have an external IP address of 1.2.3.4, but to any clients using this DNS server, it would appear to them as 192.168.0.10.

I've used this several times before on large office networks, and it works flawlessly. You can also define many local-zone definitions to override as many domains as you would like.

share|improve this answer

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.