All invalid requests end up at searchguide.level3.com....

July 12, 2014 3.9k views

Basically if I make a request to some non-existent host, I get a response from searchguide.level3.com which makes it impossible to tell which http requests actually went through and which one's didn't. The other interesting part is that this only happens about 30% of the time. This is what I'm talking about:

var_dump(file_get_contents("http://www.aaaabinsafdg.com/"));
exit;

That URL obviously does not exist. This is the response I get 2 out of 3 times:

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/test3.php on line 8

Warning: file_get_contents(http://www.aaaabinsafdg.com/): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/test3.php on line 8
bool(false)

Makes sense as such host does not exist on the Internet. Now this is what I get other times:

string(295) "<html><head><meta http-equiv="refresh" content="0;url=http://searchguide.level3.com/search/?q=http://www.aaaabinsafdg.com/&t=0"/></head><body><script>window.location="http://searchguide.level3.com/search/?q="+escape(window.location)+"&r="+escape(document.referrer)+"&t=0";</script>
</body></html>"

Why would I want this and how do I turn it off?

1 Answer

Edit /etc/resolv.conf and replace its contents with the following:

nameserver 8.8.8.8
nameserver 8.8.4.4

Then edit /etc/network/interfaces if you're on Debian/Ubuntu or /etc/sysconfig/network-scripts/ifcfg-eth0 if you're on CentOS/Fedora and replace 4.2.2.2 with 8.8.8.8.

Have another answer? Share your knowledge.