[ale] Assigning NICs to ethernet devices

Chris Woodfield rekoil at semihuman.com
Sun Jan 27 10:10:44 EST 2008


Replying a few weeks late:

In my debian system I did this by editing /etc/udev/udev.rules to add  
the following line:

KERNEL=="eth*", SYSFS{address}=="00:13:d3:36:3a:f9", NAME="gige0"

If you have more than one NIC simply repeat said line with your  
assigned interface name and corresponding MAC address.

-C

On Jan 16, 2008, at 11:04 PM, Daniel Kahn Gillmor wrote:

> On Wed 2008-01-16 19:12:16 -0500, Jeffrey B. Layton wrote:
>
>> I thought would push this out before charter blamed the snow
>> for their crappy network. But I was wondering how people
>> assign NICs to ethernet devices during installation (and even
>> after installation)?  Pick whatever distro you like, I would like
>> the ability to assign eth0 to a certain NIC, eth1 to another, and
>> so on. I've not had any trouble with FC8 or CentOS, but I'm
>> having trouble with a different distro that I'm testing (I don't
>> want to say anything since the distro is not really "out" yet).
>
> on modern (>= etch) debian systems running udev, the easiest way to
> permanently assign nic's to names is by modifying
> /etc/udev/rules.d/z25_persistent-net.rules.  That file is
> automagically populated with a MAC-address-matching line upon first
> recognition of any ethernet device.  It's simple enough to modify that
> line, but then getting udev to re-recognize the device without a
> reboot is trickier:
>
> if you only have one device of that class, the simplest thing is to
> unload and reload the associated module.  For example, if the device
> uses the e100 module, and no other devices that you care about on that
> system do:
>
>  modprobe -v -r e100
>  modprobe -v e100
>
> udev will name the device with your preferred name as soon as the
> module is re-loaded.
>
> But what if you have two e100 devices, say, and you're currently
> connected via ssh via one of them which you don't want to get
> deconfigured while you're working on this?  In that case, you'll want
> to use sysfs-style device unbinding/binding to keep the module loaded,
> but make the device show up anew:
>
> http://lwn.net/Articles/143397/
>
>> Also, is there a nice simple tool that allows you to move NICs and
>> device names that also allows you to configure the interface (IP,
>> netmask, gateway, etc.) and will fix up the routing table for you?
>
> You're probably looking for /bin/ip, which is part of the iproute (or
> iproute2, depending on your distro) package.
>
> For example:
>
>  ip link set eth0 name fubar
>  ip link set fubar up
>  ip addr add 10.11.12.13/24 dev fubar
>  ip route add default via 10.11.12.1 dev fubar
>
> It is well worth your while to learn this tool, even if you already
> feel comfortble with netstat, ifconfig, and route.  Not only is
> iproute becoming the recommended network configuration suite on
> GNU/Linux, but it logically and clearly breaks apart the different
> layers of the modern networking stack, which can help to understand
> it.
>
> hth,
>
>        --dkg
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale



More information about the Ale mailing list