7

I have a Linux machine with two Ethernet cards both using the Intel e1000 driver. lspci reports different models of Ethernet cards, but I can't tell which is eth0 and which is eth1. Other than turning off the machine and reading the chips, how can I tell which model is eth0 and which is eth1?

0

5 Answers 5

13

I haven't tried it myself, but try the ethtool command. With

ethtool -p eth0

you can get the LEDs on the card to blink. You can then easily identify which card is blinking.

1
6

Parse the output of ifconfig. It will give you the hardware MAC address that you can use to identify which card is which.

2
  • Is there a mapping somewhere from lspci output to mac address? Unfortunately, I don't have the mac addresses written down.
    – User1
    Commented Nov 3, 2010 at 3:53
  • This is useful when the MAC address is written on a sticker on (an accessible place of) the card. Commented Aug 19, 2015 at 13:34
2

Connect only one of the interfaces to a switch then use the output of mii-diag, ethtool or mii-tool (depending on which is installed) to see which has a link. You'll then know which physical card is which interface. The output of dmesg should then help you work out which is which.

2

I know the thread is old, but I think the anwsers missed the point.

To associate the device as listed with ifconfig with the physical device, I do the following:

ethtool -i DEVICE

This will give you the bus-info which you can correlate with the infomation obtained from :

lspci

The bus-info should match the numbers at the beginning of the line returned by lspci.

5
  • 1
    This is nice but how do you map the PCI bus number to a physical card? Commented Oct 30, 2013 at 12:40
  • How does this help you to know which one is your left-hand card, and which is the right-hand one? Commented Oct 30, 2013 at 17:37
  • @pabouk you can use lspci -nn, which shows the PCI number at the end, like (1234:abcd)
    – zymhan
    Commented Aug 18, 2015 at 21:42
  • 1
    @WildVelociraptor: This option will show PCI vendor and device codes. My point was: The tools will show you the bus code and device code but anyway you will need a documentation for your computer describing where are the particular buses physically located. Commented Aug 19, 2015 at 13:31
  • @pabouk Ah okay, I understand. Yeah unfortunately I don't think there is a standard numbering convention for PCI slots, and it seems dependent on how many "integrated" components you have that are connected to the PCI bus. Which unfortunately means that there's no real way for Linux or additional software to know the physical layout of your board, barring some sort of ascii-art generator of your mobo layout based on some sort of JSON configuration file.....this gives me an idea.
    – zymhan
    Commented Aug 20, 2015 at 13:16
0

To relate PCI number with device name, check

ls /sys/net/eth0/driver

this will show PCI number.

1
  • lspci -nn is a much easier alternative to this, if you have it available.
    – zymhan
    Commented Aug 18, 2015 at 21:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .