This one always gets me. With Debian & Ubuntu  I can never remember the @^!*% file that lists the association between the MAC address and the interface name (eth0, eth1, etc.).  If there is only one NIC, then it’s not a big deal, but with my servers with multiple NICs then my OCD kicks in and I like to have my ports in a nice orderly fashion.  For example, if I have three NICs in a server where one is the going to be the primary NIC, and then the other two are for LACP for storage, etc. then I like to make eth0 my primary and eth1/2 my bonded interface.

Well, with most iterations of Debian/Ubuntu the file is located here:

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

Just use your favorite editor to edit that file and adjust the names to your liking:

# This file was automatically generated by the /lib/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, and change only the value of the NAME= key.

# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:19.0 (e1000e)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”fc:4d:d4:32:64:9d”, ATTR{dev_id}==”0x0″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 (igb)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”90:e2:ba:31:48:58″, ATTR{dev_id}==”0x0″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth1″

# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1 (igb)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”90:e2:ba:31:48:59″, ATTR{dev_id}==”0x0″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth2″

You don’t even need to keep the names as ethN according to this post.  Gotta love Linux!  Just wish they’d standardize on where the files that contain these settings are located.  I do like how you can set this in CentOS directly from the file:

/etc/sysconfig/network-scripts/ifcfg-ethN

although I guess the downside is that you need to edit multiple files.  Guess you can’t have your cake and eat it, too…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s