LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   nslookup not working from client machine (https://www.linuxquestions.org/questions/linux-newbie-8/nslookup-not-working-from-client-machine-4175586106/)

arun natarajan 08-02-2016 01:40 PM

nslookup not working from client machine
 
hi,

i have configured DNS on server(node1) and client(node2).
on server everything is fine, when i tried to check DNS configuration from client end using ping and nslookup its failing.
====================================
server configuration details
=====================================

[root@node1 ~]# uname -a
Linux node1.cluster.com 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@node1 ~]#
[root@node1 ~]# ifconfig | head -3
eth0 Link encap:Ethernet HWaddr 00:0C:29:80:BF:63
inet addr:192.168.1.51 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fec0::10:20c:29ff:fe80:bf63/64 Scope:Site
[root@node1 ~]#
[root@node1 ~]# dig node1.cluster.com

; <<>> DiG 9.7.0-P2-RedHat-9.7.0-5.P2.el6 <<>> node1.cluster.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33283
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;node1.cluster.com. IN A

;; ANSWER SECTION:
node1.cluster.com. 86400 IN A 192.168.1.51

;; AUTHORITY SECTION:
cluster.com. 86400 IN NS node1.cluster.com.

;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Aug 3 00:03:11 2016
;; MSG SIZE rcvd: 65

[root@node1 ~]#
[root@node1 ~]# dig -x 192.168.1.51

; <<>> DiG 9.7.0-P2-RedHat-9.7.0-5.P2.el6 <<>> -x 192.168.1.51
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64313
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;51.1.168.192.in-addr.arpa. IN PTR

;; ANSWER SECTION:
51.1.168.192.in-addr.arpa. 86400 IN PTR node1.cluster.com.

;; AUTHORITY SECTION:
1.168.192.in-addr.arpa. 86400 IN NS node1.cluster.com.

;; ADDITIONAL SECTION:
node1.cluster.com. 86400 IN A 192.168.1.51

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Aug 3 00:03:22 2016
;; MSG SIZE rcvd: 104

[root@node1 ~]# nslookup cluster.com
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: cluster.com
Address: 192.168.1.51

====================================
client configuration details
=====================================


[root@node2 ~]# uname -a
Linux node2.cluster.com 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
[root@node2 ~]#
[root@node2 ~]#
[root@node2 ~]# cat /etc/hosts
192.168.1.52 node2.cluster.com node2 # Added by NetworkManager
127.0.0.1 localhost.localdomain localhost
::1 node2.cluster.com node2 localhost6.localdomain6 localhost6
[root@node2 ~]#
[root@node2 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=node2.cluster.com
[root@node2 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search cluster.com
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
[root@node2 ~]#
[root@node2 ~]# ifconfig | head -3
eth0 Link encap:Ethernet HWaddr 00:0C:29:6F:83:4B
inet addr:192.168.1.52 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fec0::10:20c:29ff:fe6f:834b/64 Scope:Site
[root@node2 ~]#
[root@node2 ~]#
[root@node2 ~]# ping 192.168.1.51
PING 192.168.1.51 (192.168.1.51) 56(84) bytes of data.
64 bytes from 192.168.1.51: icmp_seq=1 ttl=64 time=0.373 ms
64 bytes from 192.168.1.51: icmp_seq=2 ttl=64 time=0.544 ms
64 bytes from 192.168.1.51: icmp_seq=3 ttl=64 time=0.540 ms
^C
--- 192.168.1.51 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2929ms
rtt min/avg/max/mdev = 0.373/0.485/0.544/0.083 ms
[root@node2 ~]#
[root@node2 ~]# ping node1.cluster.com
ping: unknown host node1.cluster.com
[root@node2 ~]#
[root@node2 ~]# nslookup cluster.com
;; connection timed out; no servers could be reached


bathory 08-02-2016 02:55 PM

Quote:

[root@node2 ~]# nslookup cluster.com
;; connection timed out; no servers could be reached
You don't have any nameserver defined in /etc/resolv.conf

Just follow the instructions given in /etc/resolv.conf and add your nameserver in the appropriate script:
Quote:

[root@node2 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search cluster.com
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
Regards

arun natarajan 08-02-2016 10:49 PM

hi,

i have added below entry, i works fine now.

[root@node2 network-scripts]# cat /etc/resolv.conf
# Generated by NetworkManager
search cluster


# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
nameserver 192.168.1.51

bathory 08-03-2016 02:04 AM

Quote:

Originally Posted by arun natarajan (Post 5585027)
hi,

i have added below entry, i works fine now.

[root@node2 network-scripts]# cat /etc/resolv.conf
# Generated by NetworkManager
search cluster


# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
nameserver 192.168.1.51

You should follow the instructions in /etc/resolv.conf and add the dns entry in the script used to bring up your nic. Otherwise if you're using NM, the entry you've added manually in /etc/rseolv.conf will be lost in the next reboot.
I guess you're running an RHEL based distro, in which case you should add in /etc/sysconfig/network-scripts/ifcfg-eth0
Code:

DNS1=192.168.1.51

arun natarajan 08-03-2016 03:34 AM

hi ,

done the same.


[root@node2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
HWADDR="00:0C:29:6F:83:4B"
MTU="1500"
NM_CONTROLLED="yes"
ONBOOT="yes"
IPADDR=192.168.1.52
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.51
#DOMAIN=node1.cluster.com
[root@node2 ~]#


All times are GMT -5. The time now is 10:22 AM.