{"id":844,"date":"2010-11-17T09:42:58","date_gmt":"2010-11-17T14:42:58","guid":{"rendered":"http:\/\/www.gamescheat.ca\/?p=844"},"modified":"2019-09-04T19:57:39","modified_gmt":"2019-09-05T00:57:39","slug":"nslookup-resolves-addpress-but-ping-is-unable-to-resolve-hostname-on-unix-server","status":"publish","type":"post","link":"http:\/\/www.gamescheat.ca\/?p=844","title":{"rendered":"Nslookup resolves address but ping is unable to resolve hostname on Unix server"},"content":{"rendered":"<div style=\"float: left;\"><div style=\"margin: 15px 15px 15px 15px\";><script type=\"text\/javascript\"><!--\ngoogle_ad_client = \"pub-3319935785736004\";\ngoogle_alternate_color = \"FFFFFF\";\ngoogle_ad_width = 468;\ngoogle_ad_height = 60;\ngoogle_ad_format = \"468x60_as\";\ngoogle_ad_type = \"text_image\";\ngoogle_ad_channel =\"\";\ngoogle_color_border = \"cccccc\";\ngoogle_color_link = \"cc0000\";\ngoogle_color_bg = \"ffffff\";\ngoogle_color_text = \"000000\";\ngoogle_color_url = \"008000\";\n\/\/--><\/script>\n<script type=\"text\/javascript\"\n  src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\n<\/script><\/div><\/div><p>I came across this issue on my newly built Solaris 10 server.  I was able to ping a remote machine by Ip address, but not by its hostname. This indicated that I had the correct route and gateway. Using nslookup and dig I verified that the DNS servers were resolving the hostname to IP address.  I confirmed that the file \/etc\/resolv.conf had the correct syntax for search domain-name.com.<\/p>\n<p>Here is what my \/etc\/resolv.conf looks like, the two DNS servers are defined correctly as it the search domain.<br \/>\n<strong>domain andrewlin.com<br \/>\nnamesserver 10.10.10.11<br \/>\nnamesserver 10.10.11.13<br \/>\nsearch andrewlin.com<\/strong><br \/>\nThe gateway was defined in \/etc\/defaultrouter.<br \/>\n<strong>10.10.0.1<\/strong><br \/>\nIt seems that ping did not know how to resolve an address.  I was also not able to surf the internet with the Firefox browser in the Sun Java Desktop System for Soalris.  All symptoms indicated that the nsswitch.conf did not have the correct environment defined.  The \/etc\/nsswitch.conf file defines which services are to used to retrieve information such as hostnames, password files, and group files.  So in this case for the command ping and firefox which wants to resolve and address, it will check the nsswitch.conf file to see what services to use.<\/p>\n<p>Below are the lines I changed in \/etc\/nsswitch.conf, by adding dns to the end of each lines.<br \/>\n<strong>hosts: files dns<br \/>\nipnodes: files dns<\/strong><br \/>\nI am now able to ping and surf the internet without any issues.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I came across this issue on my newly built Solaris 10 server. I was able to ping a remote machine by Ip address, but not by its hostname. This indicated that I had the correct route and gateway. Using nslookup&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/www.gamescheat.ca\/?p=844\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[19],"tags":[21,55,33,64,75,35],"_links":{"self":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/844"}],"collection":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=844"}],"version-history":[{"count":3,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":963,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions\/963"}],"wp:attachment":[{"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gamescheat.ca\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}