Jan 7, 2015

How to Know Interface is Connected to network - Linux

If you are managing the Linux server remotely, and your Data Center technician informed you that he already connected the Cable to an interface, but in case of Blade servers he cannot identify he connected to which interface (Not only him, nobody). Most of the cases there will be more than 3 interfaces, in this case identify which interface is connected you can use the following command.

[root@compute ~]# ethtool em1
Settings for em1:
    Supported ports: [ TP FIBRE ]
    Supported link modes:   10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
                            1000baseT/Full
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
                            1000baseT/Full
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Speed: Unknown!
    Duplex: Unknown! (255)
    Port: Twisted Pair
    PHYAD: 2
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: Unknown
    Supports Wake-on: g
    Wake-on: d
    Link detected: no

[root@compute ~]#

Here is the output, and you can see the parameter Link detected: no. Which mean its not connected.

[root@compute ~]# ethtool p3p1
Settings for p3p1:
    Supported ports: [ FIBRE ]
    Supported link modes:   10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
                            1000baseT/Full
                            2500baseX/Full
                            10000baseT/Full
    Supported pause frame use: Symmetric Receive-only
    Supports auto-negotiation: Yes
    Advertised link modes:  10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
                            1000baseT/Full
                            2500baseX/Full
                            10000baseT/Full
    Advertised pause frame use: Symmetric Receive-only
    Advertised auto-negotiation: Yes
    Link partner advertised link modes:  1000baseT/Full
                                         10000baseT/Full
    Link partner advertised pause frame use: No
    Link partner advertised auto-negotiation: Yes
    Speed: 10000Mb/s
    Duplex: Full
    Port: FIBRE
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    Supports Wake-on: d
    Wake-on: d
    Current message level: 0x00000000 (0)
                  
    Link detected: yes
[root@compute ~]# 




In the second attempt but with another interface you can see the Link detected: yes. Change the interfaces names accordingly. In my case those are em1 and p3p1

No comments: