Ubuntu – Need to enter a dhclient at every restart at Ubuntu

Ubuntu

my internet was working just fine until one certain day. From this day until today every time I restart the pc I have to execute a dhclient to make internet connection work again.
I searched old threads and found this: Have to dhclient each restart to access internet
Unfortunatelly none of the proposed solutions worked for me. Here my /etc/network/interface it is:

auto lo

iface lo inet loopback

I changed the two lo to eth0 and didn't work. Then I looked at the /var/lib/dhcp3/dhclient.leases and there exists a line

interface "eth0"

so following the link tip, changing the internet interface of /etc/network/interface to the same value of /var/lib/dhcp3/dhclient.leases should work, but it didn't for me.
Also putting dhclient at the /etc/rc.local didn't work.

So, any tips?


Sorry to open this question. The mistake was mine, the last line was

iface lo inet loopback

and I changed it to

iface eth0 inet loopback

instead of changing it to

iface eth0 inet dhcp

Anyway, how was possible that this file was changed (I am assuming that before it was

iface eth0 inet dhcp

to this loopback interface? What could possible happen to provoke that?

Best Answer

You should not change the entries in /etc/network/interfaces that refer to the lo interface.

Your entries for eth0 should look like this:

auto eth0
iface eth0 inet dhcp

For a detailed howto see: http://www.cyberciti.biz/faq/setting-up-an-network-interfaces-file/

Also this question on superuser: https://superuser.com/questions/151936/how-to-automate-running-the-dhclient-in-ubuntu