1

Im trying to understand how the DNS and nslookup work, I'm a bit confused.

This is a test setup, I have a DNS server with the IP 192.168.102.159 (A Cent OS VM) the DNS is configured with a zone abc.i.

When I nslookup abc.i it results with the server address of 192.168.102.2 which is the IP address of the VM Workstation's default gateway, this is confusing me, is my DNS working ?

Isn't it suppose to return the DNS server address 192.168.102.159?

The nslookup query in the screenshot above is run in PuTTY through which I'm logged into the DNS server as a root user, basically I'm running a DNS query on a DNS server itself, querying it's own IP.

If someone could clarify it a bit, it's really confusing.

Also if this is not the way to test it how else can I test it?

enter image description here

3

“Isn't it suppose to return the DNS server address 192.168.102.159?”

Yes, you are right.

On the other hand, I think you misunderstood the output of the nslookup command. According to the picture you posted your DNS server couldn't find the record you asked for, that's why it says NXDOMAIN.

I also noticed you said you configured a zone called abc.i and asked for ns1.abc.ie instead of ns1.abc.i

If you are using VMware Workstation and the network card of your VM is set to NAT, VMWare is going to assign an IP by DHCP which usually by default ends in 192.168.x.2. You can change the DNS server your client VM is querying to in the /etc/resolv.conf file.

The sintax is as follows:

search abc.i   
nameserver 192.168.102.159

I hope this helps.

  • Thanks for the reply, I had to change the abc.ie to abc.i becasue there is actually a web domain and the result shows it, I did try ns1.abc.i and abc.i the result is always 192.168.102.2, I tried to edit the resolv.conf file but on reboot it resets back to default.. – Huud Rych Dec 30 '18 at 0:01
  • Also when I do a check on the zone and conf file the results are all OK.. – Huud Rych Dec 30 '18 at 0:11
  • This can be happening because you're using network manager which by default modifies the resolv.conf file. – Manuel Florian Dec 30 '18 at 16:30
  • The output „Server: 192.168.102.2“ is not the result, it is the target of the query. – eckes Jan 6 at 22:17
2

You are misinterpreting the results of your nslookup.

The server is not returning anything for your request. It is not returning 192.168.102.2.

What it is actually saying is that it queried (asked) the DNS server at 192.168.102.2 about ns1.abc.ie and it responded with non-existent domain. In other words, the server at 192.168.102.2 doesn't know anything about ns1.abc.ie.

When you run nslookup it defaults to querying the DNS server(s) that are configured in your networking settings. Apparently, your server is configured with a DNS server IP address of 192.168.102.2. You can check that in /etc/resolv.conf.

If you want to query a different server, you'll need to use the server directive.

nslookup
server 192.168.102.159
ns1.abc.ie

However, you don't mention if you actually have an A record in your zone file for ns1. If it doesn't exist, you're just going to get the same response NXDOMAIN.

If you want to configure a static DNS server for your server. Which isn't really relevant to this problem at this time. Read here: http://ask.xmodulo.com/configure-static-dns-centos-fedora.html

  • Thank you for the detailed reply, I found out the resolv.conf file is used by VMWare and thus cannot be edited. I have an A record that points to the DNS server itself, I have also tried the server directive, same response. – Huud Rych Dec 30 '18 at 9:03
  • This is a static DNS, currently I found this DNS configuration on Cent OS and I'm attempting this..unixmen.com/setting-dns-server-centos-7 – Huud Rych Dec 30 '18 at 9:05
  • My bad, I tried server directive in an earlier setup, the day before, not with this one, so I tried with the server directive, and the result is [root@localhost ~]# nslookup > server 192.168.102.159 Default server: 192.168.102.159 Address: 192.168.102.159#53 – Huud Rych Dec 30 '18 at 9:15
  • However, it does not resolve the ns1.abc.ie in the same way, this was attempted from a client, it says connection timed out no servers could be reached, also I had to change the abc.ie to abc.i as there exists a web domain abc.ie.. – Huud Rych Dec 30 '18 at 9:16
0

This issue is resolved, apparently, I was so into it that I even forgot I was using a client machine that is not configured properly to check the DNS, even though the client was in the NAT network as the Cent OS, it was not issued a DHCP by the Cent OS Server and thus it did not have any DNS configuration either, I was testing through the client by manually adding DNS entries.

Finally I tested it through putty as before and both forward and reverse lookups are resolving.

Thank you all for your time, appreciate it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.