July 22, 2014
 
 
RSSRSS feed

Arch Linux Backup Server-- Headless Administration - page 2

Installation and Serial Console

  • October 29, 2010
  • By Carla Schroder

My cheapo motherboard has only 10/100 onboard Ethernet, so I installed a Realtek Gig-E NIC. Every time you boot a multihomed system you run the risk of having your interface names come up differently, and then networking is all goofed up. Which happened to me. There are several ways to manage this. In the olden days I used ifrename to map NIC names to their MAC addesses. Another option is to blacklist the driver of the NIC you don't to use so it does not load at boot, assuming you want to use only one. How do you know which driver is used by each NIC? Good old lspci tells you:

$ lspci -k
02:07.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)
Subsystem: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet
Kernel driver in use: r8169
Kernel modules: r8169

00:05.0 Bridge: nVidia Corporation CK8S Ethernet Controller (rev a2)
Subsystem: Elitegroup Computer Systems Device 2501
Kernel driver in use: forcedeth
Kernel modules: forcedeth

The various distros all handle blacklisting kernel modules a little differently. On Arch Linux this is done in the Modules section of /etc/rc.conf. Preface modules you don't want to load with a bang, which is the exclamation point, like this:

MODULES=(!forcedeth)

In these modern times the udev subsystem handles persistent device naming. I followed the instructions in the Arch wiki to create the appropriate rules to give my NICs persistent names. You can name your network cards anything you want, and you need to know the MAC addresses. Find these with the ifconfig command:

$ ifconfig -a|grep -i hw
eth0 Link encap:Ethernet HWaddr 00:22:2A:33:43:D6
eth1 Link encap:Ethernet HWaddr 00:0A:CD:23:61:92

But maybe you've forgotten which one is which-- no worries, for ethtool will tell you:

#ethtool -i eth0
driver: forcedeth

I want the nVidia NIC to be lan0, and the Realtek card to be lan1. So I created /etc/udev/rules.d/10-network.rules and entered these lines in it:

SUBSYSTEM=="net", ATTR{address}=="00:22:2a:33:43:d6", NAME="lan0"
SUBSYSTEM=="net", ATTR{address}=="00:0a:cd:23:61:92", NAME="lan1"

There is big gotcha here-- udev wants lowercase MAC addresses. It won't work with uppercase. Now change all other configuration files that reference your NIC names; on my Arch system this is /etc/rc.conf and /etc/rc.local. Reboot and check your work with ifconfig -a.

All righty then, come back next week to learn about WOL, wake-on-LAN, and automated wakies and shutdowns.

Carla Schroder is the author of the Linux Cookbook and the Linux Networking Cookbook (O'Reilly Media), the upcoming Book of Audacity (NoStarch Press), a lifelong book lover, and the managing editor of LinuxPlanet and Linux Today.

Sitemap | Contact Us