Ubuntu resets /etc/hosts [SOLVED]

Due to a hardware problem on the computers at home I had to assemble an Ubuntu box from an old box. (actually Kubuntu because I just find KDE easier to work with). I had a minor issue that the drive had died, but thanks to a USB stick and a DVD I was able to get Kubuntu installed pretty quickly.

I did learn that while 12.10 is nicer than 12.04, 13.04 daily is far from ready for daily use. Things just wouldn’t install properly, but fortunately re-installing from 13.04 to 12.10 was fast.

I dislike advertisments and being tracked so I use the MVPS hosts file. It is super easy to install:

wget -O - http://winhelp2002.mvps.org/hosts.txt | sudo cat - >> /etc/hosts

However I found that everytime I rebooted my ubuntu box it reset the hosts file.

After some Googling it was variously reported that this could be an error, but also related to the fact that when using DHCP, the client updates /etc/hosts with entries for 127.0.0.1. The solution therefore is to use:

127.1.1.1

Which you can add in-line:

sudo sh -c 'wget -O - http://winhelp2002.mvps.org/hosts.txt | sed 's/^127\.0\.0\./127.1.1./' >> /etc/hosts'

Thanks for everyone that pointed out that it needed to change network.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: