Lost my eth0 on my way to upgrade

Long time no post…

Today’s post is not too entertaining, but might help someone. Who knows?

So I was making various tests upgrading portage profiles, too see how systems react before I try doing it on more important servers.

During my tets, on an old machine I never updated, I was trying to update “baselayout” (via “emerge -av baselayout”), as part of the thing I needed to update by moving to the 2007.0 profile.

Okay. So on that machine, I couldn’t update because a silly old version of dhcp was installed.

Fine, I said. I removed the package – thinking I’ll update later.

One “emerge -C dhcp” later and my baselayout installed fine.

All is well, I thought. Lets see if it holds water and reboot everything.

Forgettign about dhcp.

So, you know where I’m going, right?

The server boots fine, but now my connection to the network is also gone.

Of course, I can’t emerge dhcp back (as I should’ve before rebooting…)

So here’s how to get your network card back up again, without dhcp:

ifconfig eth0 up <ip_address>

Where <ip_address> is a valid ip address for your machine.

route add default gw <gateway_ip_address>

Where <gateway_ip_address> is the ip address of your gateway server.

From there, I could get my dhcp back up again and everything’s fine.