Linux udev persistent net rule

linuxslackwareudev

I have a Linux system (Slackware Linux 13.0) with two network interfaces. Let's call them NIC0 and NIC1

My goal is to make NIC0 to appear as eth0 in the system.

I know this can be achieved via udev rules that map network aliases to MAC addresses of network interfaces. In Slackware Linux the file /etc/udev/rules.d/70-persistent-net.rules contains such rules.

The trickiest part of my problem is that I need to fake the MAC address of NIC0. I know I can dynamically change the MAC addres of a network interface with the command:

ifconfig eth0 hw ether <new MAC address>

Do you see the problem? This supposes that the network interfaces are already set up.

So my question is: If I would have an udev rule for NIC1(the one that shall go up as eth1, with its original MAC address), would it be enough for the system to bring the other network interface (NIC0) as eth0 by default? This way I could change its MAC address later, after the udev machinery completes and the network aliases are brought up.

Best Answer

I'm using Slackware 10 as a reference, so there may be a slight variation in configuration files.

/etc/rc.d/rc.inet1 is the init script for the network interface, which is where I would begin for customizing any start time network configuration.

It looks like this init script does not have any logic for specifying the hardware address. However, a simple modification should be able to enable this functionality.

As far as your specific question, I think you're asking if specifying NIC1 as eth1 in udev will result in NIC0 defaulting to eth0? If so: probably, but I'd recommend testing this. Otherwise, please clarify.