usb0 vs eth0

David Ford david at blue-labs.org
Mon Jun 1 18:05:35 CEST 2009


The udev operation is simple.  The net interface naming is normally 
based on the MAC address and is stored in /etc/udev/rules.d/{something} 
like 70-persistent-net.rules IF your distribution runs the persistence 
script.  Otherwise device naming is based on the order in which devices 
are found by the kernel.  If you load modules by hand, and you alternate 
which you load first, then you would see the associated order change.

Mind you, if everything is done automatically by the kernel, the device 
order can change if the kernel's sequence of loading drivers changes.  
Every once in a great while that happens.

Here's my server's persistent net file:

Colt ~ # cat /etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib64/udev/write_net_rules
# program run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.

# PCI device 0x14e4:0x1659 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", 
ATTR{address}=="00:1e:c9:2a:1c:64", ATTR{type}=="1", KERNEL=="eth*", 
NAME="eth0"

# PCI device 0x14e4:0x1659 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", 
ATTR{address}=="00:1e:c9:2a:1c:65", ATTR{type}=="1", KERNEL=="eth*", 
NAME="eth1"


These are rules and they can be changed.  If you want the 1c:64 device 
to be named "funkadiddle" instead of "eth0", you'd simply edit the file 
and make the change of NAME="funkadiddle"

If you alter the MAC address of your device, either by hand or on boot 
such as in Qi etc, then it won't match if you have a rule set for the 
old MAC address and it'll get the next available interface name.

So, simply set up your persistent-net rules file like you want and be 
happy.  Name your interfaces "usbcable" and "wifi" and set your 
/etc/network/interfaces file to match if it pleases you so.





More information about the community mailing list