Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides
https://forum.ivorde.com/

How to identify each ethX device in Linux to what dual or quad port interface card it belongs to
https://forum.ivorde.com/how-to-identify-each-ethx-device-in-linux-to-what-dual-or-quad-port-interface-card-it-belongs-to-t14801.html
Page 1 of 1

Author:  mandrei99 [ Mon Jul 22, 2013 10:08 am ]
Post subject:  How to identify each ethX device in Linux to what dual or quad port interface card it belongs to

As described in a previous post http://forum.ivorde.ro/how-to-list-pci-devices-in-linux-lspci-t14791.html, you can use the lspci command to list all pci devices under a Linux server.

To find the PCI bus address of each ethernet device, find the devices in the kernel pseudo filesystem /sys and map them against the output from lspci.

How to find PCI bus address of all the ethernet devices in a Linux server
Code:
# ip a l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: sit0: <NOARP> mtu 1480 qdisc noop
    link/sit 0.0.0.0 brd 0.0.0.0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:30:48:d0:2f:f9 brd ff:ff:ff:ff:ff:ff
    inet 172.30.72.230/23 brd 172.30.73.255 scope global eth0
    inet6 fe80::230:48ff:fed0:2ff9/64 scope link
       valid_lft forever preferred_lft forever
4: eth7: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:e0:ed:13:33:c6 brd ff:ff:ff:ff:ff:ff
5: eth6: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:e0:ed:13:33:c7 brd ff:ff:ff:ff:ff:ff
6: eth11: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:e0:ed:13:33:d6 brd ff:ff:ff:ff:ff:ff
7: eth10: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:e0:ed:13:33:d7 brd ff:ff:ff:ff:ff:ff
8: eth9: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:e0:ed:13:33:e4 brd ff:ff:ff:ff:ff:ff
9: eth8: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:e0:ed:13:33:e5 brd ff:ff:ff:ff:ff:ff
10: eth5: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:30:48:5f:d2:90 brd ff:ff:ff:ff:ff:ff
11: eth4: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:30:48:5f:d2:91 brd ff:ff:ff:ff:ff:ff
12: eth3: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:30:48:5f:d2:92 brd ff:ff:ff:ff:ff:ff
13: eth2: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:30:48:5f:d2:93 brd ff:ff:ff:ff:ff:ff
14: eth1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:30:48:d0:2f:f8 brd ff:ff:ff:ff:ff:ff


Code:
#  lspci -tv
-[0000:00]-+-00.0  Intel Corporation 5400 Chipset Memory Controller Hub
           +-01.0-[0000:01]--+-00.0  Intel Corporation 82598EB 10 Gigabit AF Dual Port Network Connection
           |                 \-00.1  Intel Corporation 82598EB 10 Gigabit AF Dual Port Network Connection
           +-03.0-[0000:11]--+-00.0  Intel Corporation 82598EB 10 Gigabit AF Dual Port Network Connection
           |                 \-00.1  Intel Corporation 82598EB 10 Gigabit AF Dual Port Network Connection
           +-05.0-[0000:21]--+-00.0  Intel Corporation 82598EB 10 Gigabit AF Dual Port Network Connection
           |                 \-00.1  Intel Corporation 82598EB 10 Gigabit AF Dual Port Network Connection
           +-07.0-[0000:31-34]----00.0-[0000:32-34]--+-01.0-[0000:33]--+-00.0  Intel Corporation 82575EB Gigabit Network Connection
           |                                         |                 \-00.1  Intel Corporation 82575EB Gigabit Network Connection
           |                                         \-02.0-[0000:34]--+-00.0  Intel Corporation 82575EB Gigabit Network Connection
           |                                                           \-00.1  Intel Corporation 82575EB Gigabit Network Connection
           +-09.0-[0000:41-52]--+-00.0-[0000:42-51]--+-00.0-[0000:43]--
           |                    |                    \-02.0-[0000:51]--+-00.0  Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
           |                    |                                      \-00.1  Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
           |                    \-00.3-[0000:52]--
           +-0f.0  Intel Corporation 5400 Chipset QuickData Technology Device
           +-10.0  Intel Corporation 5400 Chipset FSB Registers
           +-10.1  Intel Corporation 5400 Chipset FSB Registers
           +-10.2  Intel Corporation 5400 Chipset FSB Registers
           +-10.3  Intel Corporation 5400 Chipset FSB Registers
           +-10.4  Intel Corporation 5400 Chipset FSB Registers
           +-11.0  Intel Corporation 5400 Chipset CE/SF Registers
           +-15.0  Intel Corporation 5400 Chipset FBD Registers
           +-15.1  Intel Corporation 5400 Chipset FBD Registers
           +-16.0  Intel Corporation 5400 Chipset FBD Registers
           +-16.1  Intel Corporation 5400 Chipset FBD Registers
           +-1d.0  Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #1
           +-1d.1  Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #2
           +-1d.2  Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #3
           +-1d.7  Intel Corporation 631xESB/632xESB/3100 Chipset EHCI USB2 Controller
           +-1e.0-[0000:53]----01.0  ATI Technologies Inc ES1000
           +-1f.0  Intel Corporation 631xESB/632xESB/3100 Chipset LPC Interface Controller
           +-1f.1  Intel Corporation 631xESB/632xESB IDE Controller
           +-1f.2  Intel Corporation 631xESB/632xESB SATA AHCI Controller
           \-1f.3  Intel Corporation 631xESB/632xESB/3100 Chipset SMBus Controller


Code:
# find /sys/devices/ -name "eth*"
/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/net/eth7
/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1/net/eth6
/sys/devices/pci0000:00/0000:00:03.0/0000:11:00.0/net/eth11
/sys/devices/pci0000:00/0000:00:03.0/0000:11:00.1/net/eth10
/sys/devices/pci0000:00/0000:00:05.0/0000:21:00.0/net/eth9
/sys/devices/pci0000:00/0000:00:05.0/0000:21:00.1/net/eth8
/sys/devices/pci0000:00/0000:00:07.0/0000:31:00.0/0000:32:01.0/0000:33:00.0/net/eth5
/sys/devices/pci0000:00/0000:00:07.0/0000:31:00.0/0000:32:01.0/0000:33:00.1/net/eth4
/sys/devices/pci0000:00/0000:00:07.0/0000:31:00.0/0000:32:02.0/0000:34:00.0/net/eth3
/sys/devices/pci0000:00/0000:00:07.0/0000:31:00.0/0000:32:02.0/0000:34:00.1/net/eth2
/sys/devices/pci0000:00/0000:00:09.0/0000:41:00.0/0000:42:02.0/0000:51:00.0/net/eth1
/sys/devices/pci0000:00/0000:00:09.0/0000:41:00.0/0000:42:02.0/0000:51:00.1/net/eth0


This is useful to identify each "ethX" device in Linux to what quad , dual or single port interface card it belongs to.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/