I am trying to resolve localhost which right now is "not found"
if I ping localhost - I am getting
ping: cannot resolve localhost: Unknown host
I have made sure that the /etc/hosts file has the below entries that are necessary to have the resolution for localhost -
127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost
However, when I ping 127.0.0.1 it is successful -
PING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.052 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.066 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.054 ms ^C --- 127.0.0.1 ping statistics --- 3 packets transmitted, 3 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.052/0.057/0.066/0.006 ms
In doubts of this getting blocked by my antivirus - I have also disabled my "web root secure anywhere" anti-virus... and it did not solve anything.
Also, I have noticed that when I restarted my machine - for the first few mins the ping localhost worked and stopped working after few mins. not sure how to track what stopped it from working.
Based on the answer at DNS not resolving on Mac OS X - tried "dig @188.8.131.52 localhost" only to find that there was no "answer" section at all.
localhost:~ $ dig @184.108.40.206 localhost ; <<>> DiG 9.8.3-P1 <<>> @220.127.116.11 localhost ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 3535 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;localhost. IN A ;; AUTHORITY SECTION: . 805 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2016081801 1800 900 604800 86400 ;; Query time: 20 msec ;; SERVER: 18.104.22.168#53(22.214.171.124) ;; WHEN: Thu Aug 18 17:15:07 2016 ;; MSG SIZE rcvd: 102
As requested, the output for "ls -le@ /etc/hosts" -
$ ls -le@ /etc/hosts -rw-r--r-- 1 root wheel 6126 Aug 18 17:09 /etc/hosts