Which Nic is in which PCI slot ?

Robert Citek rwcitek at alum.calberkeley.org
Thu Jul 21 06:55:37 UTC 2005


On Jul 20, 2005, at 7:54 PM, Andrew Mather wrote:
> Does anyone know of a single command I can use to list which nic is in
> which slot in multi-nic machines ?

You will probably have to cobble together a script.  Some leads:

ifconfig -a | cut -d' ' -f 1 | xargs  # lists all network devices
dev=eth0                      # assume device is eth0
grep $dev /proc/interrupts | cut -c 34- # shows which IRQ goes with $dev
irq=11                        # assume IRQ for $dev is 11
lspci -v | tr '\t\n' ' \t' | sed -e '/\t\t/\n/g' |
   grep -w "IRQ *$irq" | cut -d' ' -f 1  # gets slot for $irq
slot=0000:00:0a.0             # assume slot for $irq
echo $dev : $irq : $slot

Add a for-loop, tidy it up, and you should be good to go.

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource software.  Distribute FLOSS
for Windows, Linux, *BSD, and MacOS X with BitTorrent




More information about the fedora-list mailing list