views:

142

answers:

1

Hello All,

Is there a simple way to detect nic and associated ports on systems loaded with linux.

From my study on this, i found lshw -C network would help me to some extent, by giving details on ports and interfaces.

But i didn't get clear differentiation done with nic and associated ports.

Say if i have 2 nic cards with one 4 ports and other nic with 2 ports, how to i detect this information using lshw or any way!!.

lshw -C network ( only portion of the information pasted here)

Using lshw -C network, we can use the serial number for example:

*-network:0 description: Ethernet interface product: 82575EB Gigabit Network Connection vendor: Intel Corporation physical id: 0 bus info: pci@0000:01:00.0 logical name: eth0 version: 02 serial: 00:14:4f:e7:40:e0

*-network:1 description: Ethernet interface product: 82575EB Gigabit Network Connection vendor: Intel Corporation physical id: 0.1 bus info: pci@0000:01:00.1 logical name: eth1 version: 02 serial: 00:14:4f:e7:40:e1

*-network:0 DISABLED description: Ethernet interface product: 82571EB Gigabit Ethernet Controller (Copper) vendor: Intel Corporation physical id: 0 bus info: pci@0000:2b:00.0 logical name: eth6 version: 06 serial: 00:15:17:be:e6:75

*-network:1 DISABLED description: Ethernet interface product: 82571EB Gigabit Ethernet Controller (Copper) vendor: Intel Corporation physical id: 0.1 bus info: pci@0000:2b:00.1 logical name: eth4 version: 06 serial: 00:15:17:be:e6:74

serial number kind of helps, the first five tuples help me to distinguish the nics and the last tuple in the serial number seems to be in sequence when in comes to different ports on given nic.

-Thanks Harish

+1  A: 

I'm not entirely sure what information you want to know. I'm guessing you want to know which ethernet interfaces are on the same board. One quick way to detect is via the sysfs directory which contains information about devices and drivers. This information can also be correlated to lspci.

Example:

find /sys/devices/ -type d | grep eth

Which outputs data on my system in the format of:

/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0

Where pci0000:00 is the bus, and the last number is the card (0000:02:00.0).

Then if I run lspci I can look up the card identifier to get more information

lspci | grep 02:00

Nets me:

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 02)

On your system, you should have multiple eth* mapped to each card. This should tell you the mapping of which eth to which card and more information about each specific card.

gte525u