Ethtool
ethtool - query or control network driver and hardware settings. Use this command to verify that your link is up (the Ethernet is physically connected to the network).
https://www.poftut.com/linux-ethtool-tutorial-usage-examples/
Is it plugged in?
On a physical server, with physical cables connected to them, it would probably look like:
$ sudo ethtool eth0 Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on Supports Wake-on: pg Wake-on: d Current message level: 0x000000ff (255) Link detected: yes
Note: Link detected: yes.
- If this was "no", you would want to physically inspect dev1's physical network connection.
On my RHEL 7 instance:
$ sudo ethtool eth0 Settings for eth0: Current message level: 0x000004e3 (1251) drv probe ifup rx_err tx_err tx_done Link detected: yes
ethtool has uses beyond simply checking for a link. It can also be used to diagnose and correct duplex issues. When a Linux server connects to a network, typically it autonegotiates with the network to see what speeds it can use and whether the network supports full duplex.
The Speed and Duplex lines in the example ethtool output illustrate what a 100Mb/s, full duplex network should report. If you notice slow network speeds on a host, its speed and duplex settings are a good place to look.
Run ethtool as in the previous example, and if you notice Duplex set to Half, then run:
$ sudo ethtool -s eth0 autoneg off duplex full
References:
[+] https://learning.oreilly.com/library/view/devops-troubleshooting-linux/9780133035513/ch05.html