From a8048346129cc6b166bd2a0594f46e33585b5b7b Mon Sep 17 00:00:00 2001 From: Bryan Kadzban Date: Tue, 24 Oct 2006 01:41:23 +0000 Subject: [PATCH] Add an explanation of how to find the PCI bus position of network devices, to fix #1904. Also switch the sample udev rule from ID== to KERNELS== (required for udev >=098). git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@7835 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter01/changelog.xml | 10 ++++++++++ chapter07/network.xml | 43 ++++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index dd9398ead..bfd25d154 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -36,6 +36,16 @@ --> + + 2006-10-23 + + + [bryan] - Add an explanation of how to discover PCI bus + locations for network devices. Fixes #1904. + + + + 2006-10-21 diff --git a/chapter07/network.xml b/chapter07/network.xml index 2d1881431..6adc1bb38 100644 --- a/chapter07/network.xml +++ b/chapter07/network.xml @@ -71,23 +71,44 @@ EOF rule on one physical line. - If you are going to use the bus position as a key, create - Udev rules similar to the following: + If you are going to use the bus position as the key, find the + position of each card with the following commands: + +for dir in /sys/class/net/* ; do + [ -e $dir/device ] && { + basename $dir ; readlink -f $dir/device + } +done + + This will yield output similar to: + +eth0 +/sys/devices/pci0000:00/0000:00:0c.0 +eth1 +/sys/devices/pci0000:00/0000:00:0d.0 + + In this example, eth0 has PCI bus position + 0000:00:0c.0 (domain 0000, bus 00, device 0c, + function 0), and eth1 has PCI bus position + 0000:00:0d.0 (domain 0000, bus 00, device 0d, + function 0). + + Now create Udev rules similar to the following: cat > /etc/udev/rules.d/26-network.rules << EOF -ACTION=="add", SUBSYSTEM=="net", BUS=="pci", ID=="0000:00:0c.0", \ +ACTION=="add", SUBSYSTEM=="net", BUS=="pci", KERNELS=="0000:00:0c.0", \ NAME="realtek" -ACTION=="add", SUBSYSTEM=="net", BUS=="pci", ID=="0000:00:0d.0", \ +ACTION=="add", SUBSYSTEM=="net", BUS=="pci", KERNELS=="0000:00:0d.0", \ NAME="intel" EOF - These rules will always rename the network cards to - realtek and intel, independently - of the original numbering provided by the kernel (i.e.: the original - eth0 and eth1 interfaces will no longer - exist, unless you put such descriptive names in the NAME - key). Use the descriptive names from the Udev rules instead - of eth0 in the network interface configuration files + Regardless of which method you use, these rules will always rename + the network cards to realtek and intel, + independently of the original numbering provided by the kernel (i.e.: the + original eth0 and eth1 interfaces will no + longer exist, unless you put such descriptive names in the + NAME key). Use the descriptive names from the Udev rules instead of + eth0 in the network interface configuration files below. Note that the rules above don't work for every setup. For example,