Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a web server on my local network with a couple domains facing the internet. When I visit these domains from within the network I'm directed to my routers configuration page due to hairpin NAT.

So I installed BIND9 on the server and set up my forwarders to Google DNS to act as a Caching Nameserver. Then I set my routers DNS primary and secondary nameservers to the IP of the local BIND server. Everything is working great.

Now I need help configuring BIND so that the domains hosted on the web server within the network are routed to the web server and not the routers configuration page.

share|improve this question

closed as not a real question by studiohack Jun 10 '11 at 23:57

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

The question, as you have asked it, is somewhat unanswerable, or at least without rewriting existing documentation. Can you give us an indication about where you are in your BIND configuration? – Kirk Jun 10 '11 at 20:04
I have only configured my forwarders in the named.conf.options file. I now want to set up routing for a domain on the web server, say so that it will route to the web server when you are on the network. – Chad Whitaker Jun 10 '11 at 20:08
This is a very large topic that is not easy to answer without significant additional information. I'd recommend googling for a tutorial, and post back to Super User when you get stuck and are able to provide more specifics. – Kirk Jun 10 '11 at 21:09
It's actually a very simple question asked poorly. Xe is asking how to provide split horizon DNS service with BIND so that within the network the name of the WWW server resolves to an internal IP address rather than to the external IP address that the rest of Internet sees. If the questioner had picked the right StackExchange site, xe would have seen this question answered over and over again on ServerFault. – JdeBP Jun 10 '11 at 22:40
up vote 0 down vote accepted

I assume your BIND nameserver is only accessible by systems inside the network.

What you need to do is create zones in your named.conf for your domains which list the internal IP addresses of your web server(s) instead of the public IP address. The zone entry in your named.conf will look something like this:

zone "" {
        type master;
        file "/var/lib/bind/pri/"; //edit as necessary
        allow-query {; }; //edit to match your internal network
        allow-transfer { localhost; };
        allow-update { none; };

Then you need to create the zone file in /var/lib/bind/pri/ (or wherever the zone file is stored) which will look something like this:

$TTL    3600
@       IN      SOA (
                     2011061000         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
@       IN      NS      hostname.of.BIND.server.   ;fully-qualified address with trailing dot
@       IN      A    ; change this IP address as needed
www     IN      A    ; change this IP address as needed
share|improve this answer

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