Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Friday, July 9, 2010

Switch eth0 and eth1

Source
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:
# PCI device 0x14e4:0x170c (b44)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:c5:6d:b1:9e", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
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 like wan or lan 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.

No comments: