I have a Debian Linux server running on my local network. I also have port forwarding set up on my router so that computers outside my network can use my domain name and get to my website/FTP/SSH Server. That works perfectly.

When I enter the domain name (or even the public ip address) on the local network however, it times out. To make it work I use the private IP address of the server when at home. This works ok, but it makes things a bit messy. If it's possible I'd like that domain name to resolve to the private address when on the local network.

I've done a fair bit of Google searching and I think I need to set up split DNS or maybe dnsspoof. I have no idea how to set up a split DNS and I haven't been able to find a good tutorial for it, but I did follow this tutorial on setting up dnsspoof and I couldn't get it to work.

Currently I have bind9 running in a chrooted environment, but have not idea if I'm actually using it.

Any suggestions?

  • This likely wouldn't require split DNS. Assuming your external DNS is hosted elsewhere you could simply setup your local DNS server with a single view, the one you want for the internal hosts. The internal hosts would then be configured to check with that server, and it would return the local response. Other hosts would not be looking at your DNS server, so would get the response from the existing server.
    – qqx
    Nov 25, 2012 at 2:28
  • @qqx a local server that serves one version of the zone file, and another server elsewhere that serves the public version of the same zone. That's pretty much the definition of split DNS!
    – Celada
    Nov 25, 2012 at 2:46
  • @Celada I was referring to the feature in BIND to have a single named return different information based on where the request is coming from.
    – qqx
    Nov 25, 2012 at 3:17
  • 4
    There's always /etc/hosts. Not as cool, but may be less effort depending on the number of machines you are managing. Nov 25, 2012 at 6:42
  • @qqx Thanks for you help. I've used this tutorial and I feel like it's set up correctly. To use it on my machine I changed /etc/resolv.conf. Now when I ping the domain it says the host is unknown. This is starting to seems like more effort than it's worth. On top of that I don't think my router will let me change any DNS settings.
    – colton7909
    Nov 25, 2012 at 17:09

2 Answers 2


Simple use /etc/hosts: add your domain name to the private IP address.

  • I thought about that, but it's not a good solution for me. Many of the devices will be accessing the server from both inside and outside the network so it must be dynamic. Also I need it to work for devices I'm not an administrator of.
    – colton7909
    Nov 25, 2012 at 15:37

dnsmasq is one of the tools you can use.

Among its features:

Local DNS names can be defined by reading /etc/hosts, by importing names from the DHCP subsystem, or by configuration of a wide range of useful record types.

Authoritative DNS mode allows local DNS names may be exported to zone in the global DNS. Dnsmasq acts as authoritative server for this zone, and also provides zone transfer to secondaries for the zone, if required.

Specified sub-domains can be directed to their own upstream DNS servers, making VPN configuration easy.

Have a look and come back with specific questions here if you have problems.

You must log in to answer this question.

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