Slow ping on Debian

Today’s problem : my browser spends way too much time trying to connect to a website.

Ping is really slow when trying for Google :

$ time ping google.fr -c 4    

When trying for the IP, it’s much faster :

$ time ping 173.194.45.55 -c 4    

Hmm… After googling that, it appears it’s the reverse DNS which is causing troubles. You can check that with :

$ time ping -n google.fr -c 4    

If it’s the case, you can try the suggestions from stackexchange. Personnally, I used Google’s nameserver in /etc/resolv.conf and it worked well. However, this file is rewritten if you use DHCP or Network Manager. If you use Gnome, it’s probably Network Manager, so pleas refer to Debianwiki for instructions. Otherwise, you can check you use DHCP with /etc/network/interfaces. Then you should have a line along :

$ iface eth0 inet dhcp   

If that’s the case, you need to edit /etc/dhcp/dhclient.conf and add :

$ supersede domain-name-servers 8.8.8.8, 8.8.4.4;  

Now, you are good to go.