quinta-feira, janeiro 29, 2009

Changing ethernet names in Ubuntu 8.04

So, I was trying my stuff around Vyatta, and realized I didn't have enough NICs to virtualize everything I had. Our company's basic routing landscape involves two modems, one device acting as router + DHCP + DNS cache+access point (802.11g), another AP (802.11n 5.0Ghz), and the VPN router (RIP). The server only had 2 gigabit NICs though. If I moved the DHCP, DNS cache and VPN routing to VMs, I'd have to plug the 2 modems and the 2 wireless routers on it. Tha put me on a deficit of 2 network cards.

Thankfully, I had some extra hardware lying around, I picked up 2 spare realtek-based NICs and plugged them on the server. 100Mbit/s is plenty for our current ADSL speeds.

That was when I hit a small problem: ifconfig -a only showed eth0, eth1 and eth2. One of the NICs was dead.

Oh, well. It would be a matter of switchingthe cards. It was not top-prority, so I went to grokking the software configuration. After some time I remembered I had some more cards lying on another machine, which was not in use. And those were some good 3com cards. I went on and picked out both of my realtek cards and plopped the 3com in.

Then I noticed something: ifconfig showed eth0 and eth1 (onboard gigabit), then eth3 and eth4.

Being a nitpicky guy I wanted eth2 back! Well, remembering which card held which eth* alias between boots is actually a good thing, but in this case i wanted to use eth2. Just for the fun of it.

Using the same eth* alias can also save reconfiguration trouble for people who had a NIC die on them. Replace the hardware, make the system poin to the new card with the old name, everything works again.

At least to me it was a bit hard to dig out the information on where it was, but I found it.

Ubuntu (udev) has this little file where it registers the eth* name given to each NIC to make naming persstent between boots. If you want to change some ethernet number, just go there and change it to your liking:

run via the command line:
sudo vim /etc/udev/rules.d/70-persistent-net.rules
(or use your editor of choice)

Nenhum comentário: