I have a simple problem. I have a computer running Ubuntu server 8.04 LTS with 2 NICs. One on the motherboard going to the internet and one PCI card going to an internal network. During the install it detected the NIC on the motherboard as eth1 and the PCI card as eth0. I would like them the other way around. Especially because the PCI NIC will not be being used by the host server, only for some virtual machines that will be running on it.
So, currently the machine boots up activates eth1 (motherboard NIC) gets an IP with dhcp while leaving eth0 (PCI NIC) alone. This is exactly what I want except for eth0 and eth1 to switch.
Thanks.
As mentioned by tzafrir.net without much more explanation, on Debian based systems which include Ubuntu you need to check the
/etc/udev/rules.d/70-persistent-net.rules
file and you will find a line similar to:You will obviously find one for with NAME="eth0" and another with "NAME=eth1" but will each have the respective MAC addresses. You can simply swap the
NAME
values and restart your computer and the system will rename them. You could even name them something different likewan
orlan
it doesn't matter so long as your routes and other configurations use the same names.On RedHat based systems, including Fedora and CentOS, this would be accomplished by changing the
HWADDR
line found in the appropriate/etc/sysconfig/network-scripts/ifcfg-ethX
file.The point of it is to maintain the same NIC upon reboots as the kernel has been known in the past to change the order that PCI cards are addressed which can swap the NIC order.
You can painlessly change the names of the two devices in /etc/udev/rules.d/70-persistent-net.rules