brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ethtool eth0 shows the link speed and duplex of a network port

Linux
~/tips/tip-networking-ethtool-link-speed

sudo ethtool eth0

Shows the negotiated speed, duplex mode and link status of a network interface.

When a transfer between two machines on my own network is slower than it should be, the first suspect is the cable or the port, not the software. ethtool tells you what the network card negotiated.

ip -br link
sudo ethtool eth0

Look up the interface name first, since it is often something like enp3s0 rather than eth0. Run with just the device name, ethtool prints the current settings. The lines that matter are Speed, Duplex and Link detected.

A gigabit port that says Speed: 100Mb/s usually points at a bad cable, a worn connector or a port that only supports the lower speed. Duplex: Half on a modern switch is a red flag too, since that normally means negotiation went wrong. Link detected: yes only tells you a signal is present.

If auto-negotiation is on you can ask the card to negotiate again with sudo ethtool -r eth0.

Caveats: the settings part of the man page lets you force the speed with ethtool -s, and I would not do that over SSH, because a wrong value cuts off your own connection. On a virtual machine or a Wi-Fi interface the output is less useful, since the numbers come from a virtual device or from the driver, and iw dev wlan0 link is the better tool for Wi-Fi. Some systems need sudo for full output.

Further reading: ethtool(8) manual

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link