How to Setup a DNS Server in Ubuntu

Overview
Would you like to setup a DNS Server in Ubuntu? How about setting up a private internal domain name at home? Well, you’ve come to the right place. There are number of tutorials on the internet showing you how to setup a DNS Server with Ubuntu using Bind 9. So, why another how-to document? That’s a good question. I’ve decided I needed to write a simple tutorial that anyone with a little bit of Linux knowledge would be able to follow. In the process, I hope readers are also able to learn how DNS works. Ok, let’s jump right to it!

What is DNS?

First of all, let’s cover the basics. What is DNS? DNS stands for Domain Name Server. It’s a service that runs on a server that translates humanly recognizable domain names such as www.yahoo.com or www.google.com into its assigned IP addresses. If the DNS server does not recognize the domain name being requested, it will forward the domain name request to another DNS server and so on until the name is resolved.

A typical DNS request is when someone is accessing a website. Let’s use the www.yahoo.com domain as an example. When a user clicks a Yahoo link or types the Yahoo URL on the address bar of the browser, the DNS server processes the domain request. If it doesn’t find www.yahoo.com on its DNS table, it will forward the request to another DNS server with a higher authority and so on until it finds a server with the URL entry. The IP address information is then sent back to the user’s browser. If the domain name is not found, a “server not found” message is displayed on the browser.

Assumptions

Enough with the DNS background. Let’s now start configuring our own DNS server. Let’s assume that we have the following: we want to create a private internal domain name called mydomain.com, our private internal network is 192.168.0.x and our router and gateway is set at 192.168.0.1. Let’s assume all devices are going to be configured with static IP addresses. Normally, most computer systems nowadays are configured to automatically obtain IP addresses from the DHCP server/router. In this example, we will use static IP addresses to show how DNS works. Finally, we have 3 computers connected to our network:

  • Ubuntu Server, the DNS server – 192.168.0.9
  • Ubuntu Desktop – 192.168.0.10
  • PC – 192.168.0.11

Instructions

1. To install the DNS server, we need to install Bind 9.

sudo apt-get install bind9

2. Let’s configure Bind. We need to touch 5 files.

We will edit 3 files.

  • /etc/bind/named.conf.local
  • /etc/bind/named.conf.options
  • /etc/resolv.conf

We will create 2 files.

  • /etc/bind/zones/mydomain.com.db
  • /etc/bind/zones/rev.0.168.192.in-addr.arpa

A. First step. Lets add our domain zone – mydomain.com.

sudo vi /etc/bind/named.conf.local
# Our domain zone
zone "mydomain.com" {
   type master;
   file "/etc/bind/zones/mydomain.com.db";
};
 
# For reverse DNS 
zone "0.168.192.in-addr.arpa" {
   type master;
   file "/etc/bind/zones/rev.0.168.192.in-addr.arpa";
};

Save file. Exit.

We just created a new domain. Please note: later we will create two files named mydomain.com.db and rev.0.168.192.in-addr.arpa files. Also, notice the reverse IP address sequence in the reverse DNS section.

B. Let’s add the DNS servers from your ISP. In my case, I’m using Comcast DNS servers. You can place the primary and secondary DNS servers here separated by semicolons.

sudo vi /etc/bind/named.conf.options
forwarders {
   68.87.76.178;
};

Save file. Exit.

C. Now, let’s modify the resolv.conf file found in /etc and place the IP address of our DNS server which is set to 192.168.0.9.

$ sudo vi /etc/resolv.conf
search mydomain.com.
nameserver 192.168.0.9

D. Now, let’s define the zones.

sudo mkdir /etc/bind/zones
sudo vi /etc/bind/zones/mydomain.com.db
$TTL 3D
@ IN SOA ns.mydomain.com. admin.mydomain.com. (
   2007062001
   28800
   3600
   604800
   38400
);
mydomain.com.  IN      NS         ns.mydomain.com.
ubuntudesktop  IN      A          192.168.0.10
www            IN      CNAME      ubuntudesktop
pc             IN      A          192.168.0.11
gw             IN      A          192.168.0.1
                       TXT        "Network Gateway"

The TTL or time to live is set for 3 days
The ns.mydomain.com nameserver is defined
ubuntudesktop, pc and gateway are entered as an A record
An alias of www is assigned to ubuntudesktop using CNAME

E. Let’s create a “rev.0.168.192.in-addr.arpa” file for reverse lookup.

sudo vi /etc/bind/zones/rev.0.168.192.in-addr.arpa
$TTL 3D
@       IN      SOA     ns.mydomain.com. admin.mydomain.com. (
                2007062001
                28800
                604800
                604800
                86400
)
        IN      NS      ns.mydomain.com.
1       IN      PTR     gw.mydomain.com.
10      IN      PTR     ubuntudesktop.mydomain.com.
11      IN      PTR     pc.mydomain.com.

3. Let’s restart Bind to activate our latest changes.

sudo /etc/init.d/bind9 restart

4. Finally, let’s test our new domain and DNS entries.

Dig

$ dig mydomain.com

Nslookup

nslookup gw

5. That’s it.

106 thoughts on “How to Setup a DNS Server in Ubuntu

  1. Thanks… after three other how to’s this one worked fof my setup. I was going crazy trying to figure out why my internal ip’s wouldn’t resolve.

  2. I just study Linux. And I want to know how to set up DNs, Mail Sever and Web Server in my Linux(Only one pc or labtop).
    Thanks for reply,..

  3. Great work.
    Liked it loads, easy to understand.
    I have a question though:
    I have about 10 windows work station and two linux boxes. i want to be able to refer to each PC or System with its name. Say, i want to be able to ping them by their names e.g instead of pinging a system with it’s IP address, i want to ping it with it’s name; like thing : ping PC-ubuntu-desktop instead of ping 192.168.0.20. How can i achieve this please.

  4. Hi Kay,

    1. First, you will need to assign a static ip addresses to all your workstations. The last thing you need is a host with a different ip address each time you are connected to the network.

    2. Second, you need to enter several A records to your zone file, e.g. /etc/bind/zones/mydomain.com.db in this example.

    ubuntudesktop-1 IN A 192.168.0.11
    ubuntudesktop-2 IN A 192.168.0.12
    ubuntudesktop-3 IN A 192.168.0.13
    ubuntudesktop-4 IN A 192.168.0.14

    and so forth….

    3. For reverse lookup, make the appropriate entries to your reverse DNS file, rev.0.168.192.in-addr.arpa in this example. Here, we are making a reverse DNS entry for ubuntudesktop-1 at ip 192.168.0.11.

    11 IN PTR ubuntudesktop-1.mydomain.com.

    Don’t forget that period in the end of the domain.

    Hope that helps.

  5. Dear Ulysses,

    What do I need to do if I need to use the same DNS server for several subnets, such as:

    192.168.100.0 255.255.255.0
    192.168.110.0 255.255.255.0
    192.168.120.0 255.255.255.0

    Would it work if I made a separate reverse dns entry in named.conf.local for each subnet and create a separate file for each entry?

  6. Yes, creating 3 reverse DNS entries in named.conf.local and making 3 separate reverse files in /etc/bind/zones/ should do the trick. Let me know how it goes.

  7. I haven’t gotten it to work. The actual subnets I am using are:

    192.168.1.252 255.255.255.252
    192.168.20.0 255.255.255.0

    I have the Ubuntu Server 7.10 named GutsyServer at:

    192.168.1.254 255.255.255.252

    I have the Windows XP client named Client-B3 at:

    192.168.20.11 255.255.255.0

    I wonder if I named the reverse-dns files correctly. If I want to use just one reverse-dns file for a 192.168.0.0 255.255.0.0 network, could I just create a file named rev.168.192.in-addr.arpa. In the file I made reference to Client-B3 such:

    11.20 IN PTR Client-B3.Gutsy.org

    Is that the correct way to do it?

    I have tried using two separate reverse-dns files, one for 192.168.1.252 and one for 192.168.20.11, but I could not get it to work. In each file I stated the SOA. Is that correct? I wonder if that is the source of my error.

  8. I am able to do a tracert from Client-B3 to GutsyServer, but for some reason the browser will not work with the internet? It seems like internally the DNS server works, but will not work with the ISP’s DNS server? I made sure the forwarders are correct. Is there something else that needs to be configured?

  9. Daniel, I thought about this for a little bit. I haven’t use multiple multiple networks locally, much more use DNS across 2 or multiple networks. The rule is to always get your network working first. Make sure you can ping the DNS server from all the networks.

  10. I have already gotten the network working. When I use Windows 2003 Server everything works smoothly. When I use Ubuntu as a DNS Server I am able to resolve dns names from the server itself, including http://www.microsoft.com. I checked it with nslookup. When I try to use nslookup from one of the clients that I’ve assigned to the DNS Server with the A command and the PTR command, I am successful. But when I do nslookup for http://www.microsoft.com from the client, I get a message saying that the query was denied. It seems that the ISP’s DNS servers are rejecting my DNS server’s request for a query when I do the request from a client. This is odd to me. I’ve looked at about a dozen tutorials. None of them address this issue. I wonder if there is something else involved rather than DNS, like perhaps ldap.

    In any case, thanks for the reply.

    Daniel

  11. I have a dns cache defined as “home”
    —————————————————
    $TTL 3D
    @ IN SOA ns1.home. admin.home. (

    2006081401
    28800
    3600
    604800
    38400
    );

    home. IN NS ns1.home.
    server1 IN A 192.168.1.3
    www IN CNAME server1
    ————————————————–
    and my reverse lookup is
    ————————————————–
    $TTL 3D
    @ IN SOA ns1.home. admin.home. (
    2006081401;
    28800;
    604800;
    604800;
    86400
    );

    IN NS ns1.home.
    3 IN PTR server1.home.
    ———————————————————
    I have just installed apache and havent touched its default config yet. When I type

    server1.home –> it works (apache default page)
    but, when I type

    home –> Works (apache default page)
    or
    server2.home — > Works (apache default page)

    Why?

    When I type any other canonical, like server3.home or server100.home, it doesnt work.

    I have cleared cache in firefox, but still result is the same. From where is it finding server2 or just home?

    I am a bit confused, any tip would help. Thanks.

  12. I read the stuff about the ibuntu server and i think you did an excellent job.I have been for sometime now been working how to configure an ubuntu dns server.The stuff is very simple and i wish to say CONGRATULATIONS.I have learnt lots more from you.
    I want to know if you also do anything on configratioon of an ubuntu proxy server.
    Best wishes to you.You are just too wonderful.

  13. Hi Ulysses,

    I liked your tutorial about setting up DNS for a local network and followed directions to try and set up mine. Apparently I overlooked that it was for a local network so after a day of trying (and not getting it to work) I woke up the next day and realized I may need a tutorial for a web server rather than a local network. Duh! So, do you have a tutorial to set up DNS for a web server? If not can you point me one? I am trying to set up Apache on ubuntu on a server at home and want to handle my own DNS. I have a few towers and am wondering if I should setup DNS on the same tower I have my www files/Apache on, or set DNS up on a seperate tower? I have 5 static IP addresses I can use.

    Thanks Ulysses!!

  14. Ya hurre
    But can you tell me that how to add the ubuntu clients in the dns and how to add the windows machines in this domain e.g. mydomain.com

  15. I was wondering if i set up a dns server from home do i not need to register my domain name? or if can it work as a redirect service for people trying to access my site externally?

  16. dude, this is wonderfull im so glad and thankful that u wrote this. it worked perfectly.

    thanx a lot once again,

    take care

  17. If I was to have a purchased domain : thisdomain.com and had it point to my home static IP address, would this work as a real host. Assuming I have apache installed and the firewall configured properly.

  18. Hello there,

    I have a question that maybe someone can help me. I try to setup a server (Ubuntu 8.04) to be mail, ftp, www, dns, dhcp server. The Linux Box has 2Networks card, one for ISP with public STatic IP :

    ETH1 : (ISP)
    eth1 IP : 216.12.37.88
    Subnet : 255.255.255.237
    gateway : 216.12.37.80

    DNS : 206.181.2.8
    206.181.2.9

    ETH0 : (Internal)
    eth0 IP : 10.10.8.1
    subnet : 255.255.255.0
    gateway : 216.12.37.88

    DNS : 10.10.8.1

    Any idea to setup DNS and DHCP server, i don’t know nothing for now about Linux, i’m studying now.

    Thank’s

  19. If I was to have a purchased domain : thisdomain.com and had it point to my home static IP address, would this work as a real host. Assuming I have apache installed and the firewall configured properly.

  20. hi ulysses.
    I just want to make a simple thing. I’m really new to Linux.

    I got a static ipaddress in my dormitory. Here is what I got from TCP/IP properties on my windows.
    IP address 129.125.101.82
    subnest mask 255.255.0.0
    default gateway 129.125.101.251

    preferred DNS server: 129.125.36.9
    alternate DNS server: 129.125.4.13

    I have changed the third one (IP address, sbnt mask and gatwy) through this command sudo vi /etc/network/interfaces

    now, how can I put the 129.125.36.9 on my ubuntu? where should I put it?

    Really thanks

  21. floating away:

    edit your /etc/resolv.conf file

    nameserver 129.125.36.9
    nameserver 129.125.4.13

    hope that helps.

  22. Thanks for the post, very straightforward – to the point. I’m in the process of setting up name servers for the first time and this is a big help – setting up a private system to play with. It’s great.

  23. I found this very useful. Now I want to take this one step further by setting up a load of forward aliases (for HTTP headers) to be used setup a number of IIS (web) sites on the same server which happens to be a KVM machine running win2003. so if my domain was “test.com” should I able to ping ssp or mysite or team and if so what would be their qualified names.. I have tried to ping
    ssp.win2003-01.test.com and it times out where as win2003-01.test.com is ok

    win2003-01 IN A 192.168.1.110
    www IN CNAME win2003-01
    ssp IN CNAME win2003-01
    Mysite IN CNAME win2003-01
    team IN CNAME win2003-01

    Thanks in advance

    1. Daniel,

      Have you tried this format instead of an ip address?

      `subdomain1 IN CNAME domain.com`

      or

      `ssp IN CNAME win2003-01.test.com`

      It’s worth a try.

      1. Thanks for your help. In the end I just changed the order of the DNS servers and this worked. I think this article could do with an example windows client TCP/IP configuration which ensures I can resolve my local machine/aliases addresses as well as all my other www adresses.

        Also I guess we need to automatically start bind9 automatically on server power up. Have you done this?

        Regards

        Daniel

  24. Would have been great if the following had been explained instead of just saying here it is, use it:

    “0.168.192.in-addr.arpa”

    @ IN SOA ns.mydomain.com. admin.mydomain.com. (
    2007062001
    28800
    3600
    604800
    38400
    );
    mydomain.com. IN NS ns.mydomain.com.
    ubuntudesktop IN A 192.168.0.10
    www IN CNAME ubuntudesktop
    pc IN A 192.168.0.11
    gw IN A 192.168.0.1
    TXT “Network Gateway”

    Unfortunately I didn’t learn anything from the tutorial except how to copy and paste :(

  25. Being on Linode, the service offers its own DNS server, and I know that many web hosts, VPS, and dedicated server companies also do the same. However there are real benefits in running your own DNS server, with editing speed and ease of use being one of them. Although for full disclosure I have decided to use Linode’s DNS service to reduce load on my own server. Nonetheless, this guide will go through the relatively simple process of setting up a DNS server in Ubuntu Linux.

    The first thing one needs to do is to install Bind. Bind is a file based DNS server that is pretty simple to use once you understand it; however there are multiple files to edit. When installed using sudo apt-get install bind9 a default configuration file is created for you as well.

    The second step is to update the /etc/bind/named.conf.local configuration file to add our zone. Our zone specifies what domains this DNS server is responsible for. For this tutorial I will use example.com as the sample domain. Therefore in name.conf.local you will add both the zone definition as well as the reverse DNS entry for your IP. They should be written as:

    zone “example.com” in {
    type master;
    file “/etc/bind/zones/example.com.db”;
    allow-transfer { any;};
    };

    zone “1.0.168.192.in-addr.arpa” {
    type master;
    file “/etc/bind/zones/1.0.168.192.db”;
    };

    Please remember to replace example.com with your real domain name and 192.168.0.1 (written in reverse) with your real IP address.

    The third, and optional step, is to configure some default DNS server options. The file used to do this is /etc/bind/named.conf.options The main settings that ought to be of interest are: forwarders, notify, and directory. Forwarders specify which DNS server should be used when your DNS server is queried for a domain that it is not responsible for. Notify specifies whether slave DNS servers should be notified of changes when they are made on this server. Directory specifies where DNS configuration files should be looked for if a full file parameter is not used in our zone entries in step two. Samples of three options are:

    forwarders { 208.67.222.222; 208.67.222.220; }
    notify { yes; }
    directory { “/dns/zones”; }

    The fourth step in our Ubuntu DNS server setup is creating our zone file. I am assuming that you did not specify a custom zone directory like the options example above. Therefore you will want to create your zone files in the folder /etc/bind/zones by just creating example.com.db and filling it with entries such as:

    // TTL = Time to live for records on slave (2 days)
    // 2009030700 = Serial for Bind to check whether an update has occured
    // 6H = Time between refresh requests
    // 1H = Time between retry attempts
    // 1W = Expiry time for the record on slave
    // 1D = Amount of time an invalid response is stored on slave
    $TTL 2D
    @ IN SOA ns1.example.com. root.example.com. (
    2009030700
    6H
    1H
    1W
    1D
    )

    // ns1.example.com. = Name server
    // mail.example.com. = Mail server
    // http://www.example.com. = HTTP server
    // *.example.com. = Wildcard entry
    example.com. IN NS ns1.example.com.
    example.com. IN MX 10 mail.example.com.
    ns1 IN A 192.168.0.1
    www IN A 192.168.0.1
    mail IN A 192.168.0.1
    * IN A 192.168.0.1

    The above zone definition file sets some basic servers and points them to the computer with the IP address 192.168.0.1. You can host each service on a different IP if they are on different servers. You can also point to other name servers by using CNAME instead of A records. Please note that all domain names end with a “.”.

    While a reverse DNS zone file is optional, for things like mail servers if a reverse entry is not available it can be flagged as a possible spam server. So it is good practice to do it. For our example zone file the reverse would be in the file 1.0.168.192.db and look like:

    // TTL = Time to live for records on slave (2 days)
    // 2009030700 = Serial for Bind to check whether an update has occured
    // 6H = Time between refresh requests
    // 1H = Time between retry attempts
    // 1W = Expiry time for the record on slave
    // 1D = Amount of time an invalid response is stored on slave
    $TTL 2D
    @ IN SOA ns1.example.com. root.example.com. (
    2009030700
    6H
    1H
    1W
    1D
    )

    IN NS ns1.example.com.
    1 IN PTR example.com.

    After the files have been created restart bind through the command /etc/init.d/bind9 restart and using the command dig @192.168.0.1 http://www.example.com to use your own DNS server to query the record http://www.example.com. If an answer is given (should look like your entry for www in the example.com.db file) then everything is set up correctly. You should now update your domain name registar’s DNS records to point to your server.

  26. Instructions are clear and easy to follow. I set this up relatively quickly and am able to resolve by using the dns name setup in the config files. I dropped the firewall and added the linux IP to my Windows system dns entry under the network config. I’m trying to use the dns server on my windows box now but cant resolve unless I use the entire domain name. On my linux box I can ping gw but on my Windows box I have to ping gw.example.com in order for it to resolve. If I ping gw from my windows box it does not resolve. Does anyone know of an additional step needed to use the dns on all local computers without having to type in the entire domain name? Thanks in advance.

    1. Dennis, The only thing I can recommend is to make sure your Windows clients are pointing to your internal DNS. The other thing I did was added this: ‘domain.com. IN A xxx.xxx.xxx.xxx’ in the zone file. Just replace the xxx with your ip address.

  27. Nice job on your website here. I too am attempting to build a site for my small home construction business. Its a long story, but I’m not very good at this techy stuff. I like the site theme you have used here and was wondering what it was named? I bought Brian Gardner’s theme but just gave up. I want to supplement my bills in the winter time and thought I could do it. Its a long road ahead. Anyway, I just stumbled across your article here and am glad to have met you. virtually of course :-).

  28. Hey! Thanks for not obeying standard practices, posting any warnings, or stating which systems versions you’re using.

    My computer, ubuntu 9.10, no longer goes online after following these instructions. It’s offline totally. Thanks, bud.

    TO ALL USERS: Use Webmin. I’ve been able to ‘mostly’ repair my system and set things back to defaults using webmin. I should have used webmin in the first place before taking advice from self-declared ‘guru’s.

      1. Hey, thanks for the reply :)

        My resolv.conf is (as expected) built automatically:
        $ sudo less /etc/resolv.conf
        # Generated by NetworkManager
        domain 532
        search 532
        nameserver 192.168.0.1

        ^ that nameserver 0.1 is the address of the router. 532 is the LAN’s SSID. Any pointers? I would think that’s right (not only because its automated) because the request should just be passed on to the nearest authority (the router), right?

    1. Hey, I’m going to start a thread on unix.com and stop abusing your comments area – sorry :(

      To answer your question, this is on a laptop (not a server) in a home network (not a business), so there’s no domain (no name servers or anything in this house). The whole network is setup fairly close to the defaults of our Dlink router. If you have any suggestions what I could look up to give me a lead, that’d be awesome! (ps, great article, I’m going to set up a domain just for kicks pretty soon)

  29. I think am stuck here, how come u get to configure you DNS over static IP? Secondly, am trying to set up one on with DHCP but can’t get it to work. I can’t even ping with the hostname. I need your help here.
    Do reply.

  30. Ulysses, thank you. I found them via google (didn’t expect it to be that easy), and discovered that they’re also in my router (linksys WRT54G) on the status tab.

  31. Hi Ulysses,

    I’ve got bind up and working thanks to your tutorial.
    I don’t know if it’s possible but can I define a single host that is not part of my domain?

    I’ve got a .no-ip.org domain name which I can’t access local due to anti-spoofing on my firewall, so I would like my bind server to anwser a query for the no-ip.org address with the equivalent local ip.

    Does that make an sense?

    Regards,
    Brett

      1. Ok,

        I have a “home” domain, lets say mydomain.com that I have bind setup and working for.

        I also have a legitimate domain myhost.no-ip.org (free D-DNS service) which allows me to access my server externally without needing a fixed ip address, this all works fine.
        However if I try to reach myhost.no-ip.org (external ip address) from my home network my router basically denies the request as it thinks it’s spoofed.

        What I would like is my local DNS to respond with the internal address (192.168.0.x) when I lookup myhost.no-ip.org from my home network rather than the authortative address from no-ip.org (external address), I suppose for my local DNS server to respond with a local ip instead of forwarding the request even though the domain name is different.

        Any clearer?

        Thanks,
        Brett

        1. Thanks for the clarification. Yes, it makes a whole lot of sense now. You can try several things. The first one is probably the easiest. #1 You can add myhost.no-ip.org to your hosts file. For example, if your server is 192.168.0.10, then you would add ’192.168.0.10 myhost.no-ip.org’ to your hosts file. #2 You can add a second domain to your local DNS. It’s similar setup to how you did mydomain.com. One last thing, make sure your resolv.conf is pointing your local DNS. It’s 192.168.0.9 in my example above.

  32. Hi Ulysses,

    I’m avoiding the hosts file option as i would need to change it whenever I took my laptop out of the house…

    I did try adding no-ip.org to named.config.local which worked, however I don’t really want a “fake” master as I then can’t resolve any other no-ip.org addresses, or am I missing a trick here?

    Thanks again,
    Brett

  33. Hi Ulysses,

    I followed exact steps but bind9 process failing to start.
    Could you please help me on this?

    Thanks in advance
    Vj

  34. Hi,

    I am getting following error.

    please help me.

    #dig pc.mydomain.com

    ; <> DiG 9.7.0-P1 <> pc.mydomain.com
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 10185
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

    ;; QUESTION SECTION:
    ;pc.mydomain.com. IN A

    ;; Query time: 0 msec
    ;; SERVER: 172.16.16.109#53(172.16.16.109)
    ;; WHEN: Sat Nov 20 21:45:50 2010
    ;; MSG SIZE rcvd: 33

  35. Hi,

    I am getting following error.

    please help me.

    zone mydomain.com/IN: NS ‘ns.mydomain.com’ has no address records (A or AAAA)
    zone mydomain.com/IN: not loaded due to errors.

  36. when i perform sudo /etc/init.d/bind9 restart
    command am getting an error , etc/default/bind9: 5: Syntax error: Unterminated quoted string

  37. when i perform sudo /etc/init.d/bind9 restart
    command am getting an error , etc/default/bind9: 5: Syntax error: Unterminated quoted string

    1. I would check the config files. Look for entries involving quotes that needs to be closed/terminated. You just have a missing end quote. That’s all.

  38. @Ulysses Yeah that’s definitely the most compact, straight-forward, tutorial on setting up bind that I’ve ever read.

    That said there were a few more steps need to get both the Linux and Windows machines running on my network, you can see the successful results of that endeavor over at: http://serverfault.com/questions/220974/bind9-dns-ubuntu-names-pingible-on-server-but-not-on-windows-machines

    (Basically the question’s answer in the link above handles the Windows Advanced TCP/IP settings side of things.)

  39. Hi Andrew, thanks for sharing the solution. When you ping, do you use the host name only or the fully qualified domain name? Just curious. It looks like adding the DNS entry in Windows fixes that issue.

  40. Thank you for this very concise and helpful information. This is sooo exactly what I was looking for I can’t even explain it. The one thing I had to figure out was to replace ‘ns’ in a few places with the hostname I’d given the server hosting the DNS server.

  41. No luck,
    trying this on Ubuntu server 10.10, and it doesn’t work. I’ve actually copied the examples straight from the site just for the heck of it to see if I could get it to work using your example.

    Nslookup and DIG both give me SERVFAIL results.

  42. The odd part is that I’ve been able to empty out my resolve.conf and named.conf.options file completely and outside DNS requests still work (despite restarting bind). How is it getting that information?

    For giggles I’m restarting the server… very odd.

  43. Even weirder.. Reverse lookup works… but forward lookup doesn’t. I used named-checkzone and both of the zone files are happy. Not sure why this is failing.

  44. Now I’ve got reverse lookup fully working, however the best I can get for forward lookup is an “NXDOMAIN” status in DIG (which is a step up from SERVFAIL from before).

  45. Correction… and this is really odd. I had fatfingered my resolv.conf file to use my router’s IP address (gateway). With this set up… forward lookups were in a an NXDOMAIN state, and reverse lookups were in an NOERROR state. Correcting it to the DNS server address of 192.168.1.200 has now put it back in a SERVFAIL state. For the hell of it, I’ve completely unplugged any external source just to see if I can get this working as a private setup without any forwarding.

  46. Hi Ulysses, thanks a lot for this very good tutorial. But I am stuck somewhere at the Comcast IP. Suppose I only want a local connection between my server and another terminal laptop and I want to use the default domain (mydomain.com). I have a wireless router whose control panel is activated by http://192.168.1.1 and this router has already given two IP addresses to my server and my other laptop (server 192.168.1.101) the other laptop was given (192.168.1.100). I imagine that after the setup has completed I would be able to open the website (mydomain.com) hosted on my server from the other machine.
    I would be so grateful if you would be able to explain for me what to do in terms of IP addresses and any other thing. Much thanks

  47. I hope I’m able to answer your question correctly. You would like to be able to connect to any desktop, laptop or server on your local network using a hostname or a fully qualified domain name. To do this you need to point the DNS entry of each machine to your DNS server. In this example, let’s assume your DNS server is 192.168.1.10. Typically, the DNS entries point to your router, 192.168.1.1. If you make that change to every machine on your network, you should be able to resolve a hostname in your local network as well as the internet, assuming your DNS server is routing properly.

  48. Thanks for your reply. Let us suppose that I am at the stage of

    sudo vi /etc/bind/named.conf.options

    forwarders {
    68.87.76.178;
    };

    what IP address I should put instead of 68.87.76.178 (because this is not my ISP address). Did you mean that I should put 192.168.1.10 instead? How to point the DNS entry of each machine to my DNS server- can u please explain practically how to do this. My assumed server IP is 192.168.1.101 and my other terminal laptop is 192.168.1.100.

    Assume also that I am going to put a web page hosted on my server so that it can be reached from my terminal just by writing the domain name mydomain.com

    Your help is very much appreciated as I am still very new in this field, very interested in learning.

  49. The forwarders should be the DNS server of your ISP. To resolve your local domain, you need to change the network settings of your terminal laptop to use 192.168.1.101 as DNS instead of 192.168.1.1.

    In Windows, you need to go to Control Panels, Network Connections, Properties, TCP/IP and then enter 192.168.1.101 as your DNS.

    I hope that makes sense.

  50. I thought that you might help me better if I explain my environment settings. I have two laptops and I am intending to make one of them as a server for learning purposes. My router has given the server the IP 192.168.1.100 and the other was given the IP 192.168.1.101. I am intending to make the first one as the server. The router IP is 192.168.1.1 . As I am still new in this field, I was totally confused on the number of parameter used on your tutorial. I am especially confused about the IP to use for the DNS server. Suppose I am not able to get the static IP; will it be possible to use the local IP(s) mentioned in this message?. And then what IP should be used in the forwarder. My Terminal shows the prompt

    sarmad@sarmad-HP-G61-Notebook-PC:~$

    I would be so grateful if you reformulate your tutorial in view of my environment settings to enable me to build the local domain mydomain.com

  51. If your DNS server is 192.168.1.100, then you need to change the DNS network setting on your laptop to point to 192.168.1.100. Simple.

  52. Had same problem but all I did is restart the bind9 process anyway and that was all. I used the line below:

    $ sudo service bind9 restart

    To explicitly confirm bind9 is running, use this line:

    $ service bind9 status

  53. Thanks a lot for all. I could reinstall Bind again and no problem with it now. Now I installed apache22 on a Windows 7 and and I created a testing site on a folder I called c:\mysites and a server name I called it site1.local. And all the necessary setting I have done in the httpd.conf file. I also tweaked the hosts file inside Windows 7. I am intending to request the name http://site1.local from my other laptop browser (Ubuntu 10.10) but I am not succeeding. I am getting the error (Forbidden

    You don’t have permission to access / on this server) please note that I also opened port 80.

  54. i m getting following error-

    sudo /etc/init.d/bind9 restart
    * Stopping domain name service…bind9 rndc: connect failed: 127.0.0.1#953: connection refused

  55. Whenever i am trying this domain name system for my ubuntu system. it is not running. is any additional configuration or packages need to config dns. now i m using ubuntu 10.10. please help me..

  56. This seems kinda pointless. To quote yourself ..
    “Let’s assume all devices are going to be configured with static IP addresses. Normally, most computer systems nowadays are configured to automatically obtain IP addresses from the DHCP server/router. ”

    Why give an example that is not applicable to “most computer systems nowadays”?

    1. I think you are confusing DHCP which automatically assigns IP addresses to computers vs DNS which makes server names stick that’s accessible from any computer in the same network. That’s what we are after here. We want DNS to work internally as well as forward outside of the internal domain.

Comments are closed.