This applies to Fedora and CentO/S distributions.
To quickly check NIC port link status from the Linux CLI, you can use the "ethtool ethx" command:
[root@localhost net]# ethtool eth0 Settings for eth0: Supported ports: [ TP ] 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: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 1 Transceiver: internal Auto-negotiation: on MDI-X: on Supports Wake-on: pumbg Wake-on: g Current message level: 0x00000007 (7) drv probe link Link detected: yes
If you need to check the NIC port status from a script or Linux CLI, you can display the "operstate" and "carrier" files in the "/sys/class/net/ethx" directories:
If the NIC port is up and linked, you will see these outputs:
[root@localhost net]# cat /sys/class/net/eth0/operstate up [root@localhost net]# cat /sys/class/net/eth0/carrier 1
If the NIC port is turned down and not linked, you will see these outputs:
[root@localhost net]# cat /sys/class/net/eth0/operstate down [root@localhost net]# cat /sys/class/net/eth0/carrier 0