Ethernet device rename

I have been looking recently to find a way of creating a bridge interface on SliTaz in order to get KVM/libVirt working with the expected br0 interface. Unfortunately, the network configuration files of SliTaz do not provide any information, neither the documentation. A post on the forum didn’t get any replies either. Rather than trying figuring how a proper bridge interface would work on SliTaz, I thought of renaming eth0 to br0, as the later would be expected by KVM/libVirt. As far as I know the following process would need to be followed for other distros as well as there is no specific way of renaming an interface other than using udev rules.

On SliTaz, the required udev rule is defined /etc/udev/rules.d/70-persistent-net.rules. The default entry looks like the following (where Xs the MAC address):

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="XX:XX:XX:XX:XX:XX",
ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

The generated rule matches the eth0 interface with the specific network card. The required change is the renaming of the NAME field to br0. If the targeted system is a virtual machine with changeable MAC address, or most likely a live distro like in my case, the ATTR field, that specifies the MAC address, would need to be changed as well. Changing it to 0* would work and on the next boot the device should be renamed. The final udev rule:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="0*",
ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="br0"

There is one more addition to do on SliTaz and that is to rename the default ethernet device in /etc/network.conf from eth0 to br0. That would allow higher level applications and scripts to look for br0 rather the non-existant eth0.

Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s