Host Doing Unnecessary Dns Lookup for Localhost

host doing unnecessary dns lookup for localhost

Check that you have files listed before dns for the hosts entry in /etc/nsswitch.conf.

[me@home]$ grep "^hosts" /etc/nsswitch.conf 
hosts: files dns

If dns comes first, then your system will always query DNS to resolve hostnames before falling back to /etc/hosts.

Getting DNS error for curl localhost:8080

One guess is your http request is going through a proxy. You can unset the HTTP_PROXY variable and try again.

Otherwise, try using 127.0.0.1 or the IP address for your machine. :8080 means the HTTP server is binding to all IPs.

DNS Lookup failed - Error with all browsers

Run the following from your command prompt.

nslookup www.millennialmedia.com

This should respond with an IP address as well as let you know your current DNS server that's resolving your requests. On my machine the output was as below which implies the site is accessible to me.

nslookup millennialmedia.com
Server: <hidden>
Address: <hidden>

Non-authoritative answer:
Name: millennialmedia.com
Addresses: 216.146.46.11
216.146.46.10

Root can resolve localhost, while normal user cannot

I guess that /etc/hosts is not readable by ordinary users. What are the permissions of that file?



Related Topics



Leave a reply



Submit