[olug] Two Network Cards

Christopher Cashell topher-olug at zyp.org
Sat Mar 8 00:20:10 UTC 2008


On Fri, Mar 7, 2008 at 4:12 PM, Todd Christopher Hamilton
<netarttodd at gmail.com> wrote:
> Thanks for the info.  question: how does the os know the MAC address for
>  eth0 and eth1?  How does it know "where" the network card hardware is?

This is somewhat dependent on Linux distribution.  Red Hat/CentOS has
support for specifying a MAC address in the ethernet configuration
file, allowing you to tie the MAC to a named ethernet device.  Debian
does not currently have a way to do *from the network config files*.

For all distributions, the names are determined based on the order
that the OS first saw them.  The first NIC that Linux sees on it's
first boot up will be named eth0.  The second one it sees, on first
boot up, or if added later, will be named eth1.  Previously, in
Debian, this could be a little bit troublesome, because if you change
hardware and the network cards were detected in a different order,
they would change names.

Recent versions of Debian has added support for persistent device
naming for network cards via udev, though, which makes the whole thing
a lot more reliable.  udev is really the best way to handle this, as
it can control device naming when the device is loaded (in contrast,
RH/CentOS's current way of handling things is to let the OS name the
devices however it wants, and then later in the boot, go in and rename
the devices as needed, per network config files).  The first time a
new network card is found, an entry is added to
/etc/udev/rules.d/z25_persistent-net.rules that matches a MAC address
to a device name.  After that, any time that MAC address is seen, udev
will name the device according to the rule.

You can check that file to ensure that your network cards are properly
added (or even rename them to something else) if you want.

>  Todd Christopher Hamilton
>  (402) 660-2787

-- 
Christopher



More information about the OLUG mailing list