Problem Configuring DNS on ubuntu server running as a virtual machine

9,035

After trying for hours and hours, I was finally able to solve the problem and get DNS working. The major problem was the settings of the virtual box machine. Earlier I wasn't paying much attention to them but as suggested by @abdulkadir(see comments), I spent time there and got the success.

network details

network: 192.168.2.0/24 
gateway/router : 192.168.2.1

Here is the solution:

first of all network settings for dns server:

enter image description here

network settings on the client machine:

enter image description here

Interface file(DNS side):

enter image description here

named.conf.options file:

enter image description here

named.conf.local file:

enter image description here

forward zone file:

enter image description here

reverse zone file:

enter image description here

Interface file(client side)

enter image description here

This setup worked absolutely fine for me. I would specifically like to mentions that I didn't make any changes to "resolv.conf", "hosts" or "hostnames" file. Some of the sources on the web were suggesting that.

Thanks.

Share:
9,035

Related videos on Youtube

harshitgupta
Author by

harshitgupta

Updated on September 18, 2022

Comments

  • harshitgupta
    harshitgupta over 1 year

    I am running "ubuntu-14.04-server-amd64" server as a virtual machine via virtual box on my MAC OSX 10.9.X. I am trying to learn how to configure DNS via linux. I crawled websites for continuously for two days but no success.Following are the snapshots of my work.

    /etc/network/interfaces looks like:
    

    enter image description here

    ifconfig looks like:
    

    enter image description here

    named.conf.local looks like:
    

    enter image description here

    named.conf.options
    

    enter image description here

    domain.com.db looks like:
    

    enter image description here

    rev.0.168.192.in-addr.arpa looks like:
    

    enter image description here

    resolv.conf looks like:
    

    enter image description here

    hosts.png looks like:

    enter image description here

    while testing it looks like:

    enter image description here

    I don't know whats wrong with it. Please suggest me something. Any help is appreciated.

    • Lucio
      Lucio almost 10 years
      Am I wrong or you have a trailing dot on file domain.com.db on the domain.com. line?
    • harshitgupta
      harshitgupta almost 10 years
      yes sir, the dot is there. shouldn't it be there?
    • Lucio
      Lucio almost 10 years
      You should try without the trailing dot
    • harshitgupta
      harshitgupta almost 10 years
      it didn't solved it, @Lucio
    • Dan Hibbert
      Dan Hibbert almost 10 years
      I don't see the problem jumping out at me. But for stuff like this, the dig command is really helpful. If you have bind installed, then you probably already have it. It lets you directly test what a nameserver responds with when a request is made. (you can specify a specific nameserver by using the @ sign, like @8.8.8.8.
    • Dan Hibbert
      Dan Hibbert almost 10 years
      Is domain.com something you are using as an example, or the actual address you are using?
    • Abdul Kadir
      Abdul Kadir almost 10 years
      I had the same problem figure out. You have configured DNS correctly but the problem with the Network or Subnet mask. your virtual-box IP address is very different network related to your DNS configuration There is some configuration in virtual-box settings. Go to virtual machine settings > Select Network change your NAT settings to Internal Network. If it does not work then change one by one. You DNS will work for you.
    • harshitgupta
      harshitgupta almost 10 years
      @Azendale m using domain.com as dummy domain... could use anything.. but used it for the sake of simplicity..
    • harshitgupta
      harshitgupta almost 10 years
      @AbdulKadir thanks for the suggestion. I will try that and let you know. But before that I have question for you. By changing NAT to internal network, will the machine be able to access outside network(google)... do I only need one adapter here(currently m using two, one dhcp another static).
    • Abdul Kadir
      Abdul Kadir almost 10 years
      @harshitgupta Yes you can access only your internal network on outside of the network. If you use multiple network on your VM then settings like 'bridge netowkr' for one lan card. or other for another one. may be your desire will fullfil. I dno't know exectly. try it.