3

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.

1 Answer 1

1

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.

5
  • @Warner: rc.local is absolutely not a workaround, network daemons would fail to bind to proper IP addresses if those get set later (rc.local is the last executed boot script). You've got my question absolutely right: I need to know for sure if an udev rule for a NIC as eth1 will cause the other NIC to default to eth0. I'm asking other people in hope they know the answer for sure, because testing would require unplugging and replugging some hardware. My goal is to minimize downtime so at this point I'm still trying to collect as much info as I can first.
    – Anonymous
    Mar 26, 2010 at 16:52
  • Fantastic point. I've removed that (bad) advice. Why not just specify them both? That way, there's no uncertainty.
    – Warner
    Mar 26, 2010 at 17:17
  • the problem is the need to fake the MAC on eth0 and this confuses me. Assuming I'll have an udev rule for NIC0, which MAC should I specify there? The real one? The fake one? And why?
    – Anonymous
    Mar 26, 2010 at 17:27
  • The real one, as you're simply identifying what interface to apply the udev rule to. Later, you could change the MAC. According to this page (alien.slackbook.org/dokuwiki/doku.php?id=slackware:network) you can specify the MAC using HWADDR in inet1.conf. Maybe the init script was changed after Slackware 10?
    – Warner
    Mar 26, 2010 at 17:42
  • indeed, the HWADDR setting seems to be the last piece of the puzzle that I was missing. I can't try and see if this works ATM, but it seems to make perfect sense. Thanks for your hints.
    – Anonymous
    Mar 26, 2010 at 17:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .