[Clfs-support] NIC interface by MAC address ??

mike spam at kleiderschrank51.de
Sun Sep 28 03:27:50 PDT 2008


Michael A. Peters schrieb:
> I'm looking through the ifup script and I don't see a way to ensure 
> that a specific configuration is applied to a specific MAC address.
>
> The issue I'm having is that I have two nics - one configured at boot 
> and the other not - but it seems random which one is actually seen at 
> eth0 and which is seen as eth1.
>
> Is there a way (IE setting variable in ipv4 file) to make sure it 
> brings up eth0 by hardware address? Because if so, I don't seem to be 
> seeing it.
>
> In RHEL you just set HWADDR in the nic config which is then used by 
> the script /etc/sysconfig/network-functions
>
> Browsing that script it looks like there is way via /sbin/ip to set 
> the interface to a specific mac address before calling
>
> ip link set ${NET_IF} up
>
> but before I try and hack something myself in I want to know if I'm 
> just missing something simple that's already there.
>
> It's curious to me that sometimes at boot it wants eth0 to be onboard 
> nvidia nic (which I have found to be problematic with my hub - but it 
> works well if I bypass the hub and go straight to router 
> interestingly) and sometimes it wants eth0 to be the tulip nic (which 
> works well and is what the cat5 is plugged into)
>
> Thanks for any suggestions
> _______________________________________________
> Clfs-support mailing list
> Clfs-support at lists.cross-lfs.org
> http://lists.cross-lfs.org/listinfo.cgi/clfs-support-cross-lfs.org
>
hi,

you must use udev for handling your nic's. somthing like this:

/etc/udev/rules.d/90-user.rules

# Networkdevice handling
KERNEL=="eth*", SYSFS{address}=="00:13:d4:85:11:da", NAME="lan"
KERNEL=="eth*", SYSFS{address}=="00:c0:26:00:be:9f", NAME="gateway"

or so:

/etc/udev/rules.d/70-persistent-net.rules

# net device
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", 
ATTR{address}=="00:0b:cd:26:83:66", ATTR{type}=="1", KERNEL=="eth*", 
NAME="eth1"

# net device
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", 
ATTR{address}=="00:04:75:af:82:97", ATTR{type}=="1", KERNEL=="eth*", 
NAME="eth0"

theoretically you have a script /lib/udev/write_net_rules which will 
handle the nic's. this script should add this 'persistent-net.rules' 
file. after creating this rule, you can leave it as is or modify to your 
choice. udev will rename the nic's after every reboot after this rule.

mike / germany



More information about the Clfs-support mailing list