Home / Alt manpages / mii-tool(8)

  • mii-tool(8)
  • Admin command
  • linux

Check and Carefully Reset Ethernet Link Negotiation with mii-tool

mii-tool checks and, when it stalls, carefully nudges Ethernet link negotiation back to life. You will inspect a physical interface, read a detailed MII report, and restart autonegotiation when a link needs a shove. Allow about ten minutes. You need the net-tools package, an interface backed by an MII-capable device, and usually root for the query itself.

This guide describes the installed net-tools 2.10 program. The manual page is older than the package, so the local command and its own --help or usage output are the contract that actually applies here. MII stands for Media Independent Interface: the part of many Ethernet adapters that reports or negotiates speed and duplex with the link partner.

1. Confirm the command and choose a real interface

Check what will run. These are ordinary read-only commands:

$ command -v mii-tool
/usr/sbin/mii-tool
$ mii-tool --version
net-tools 2.10
David Hinds based on Donald Becker's mii-diag

Use an interface name from the kernel, not a placeholder copied unchanged from an example. This lists link devices without changing anything:

$ ip -o link show
2: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...

Replace enp0s31f6 in the examples with your own wired interface. Skip lo, a bridge, or a container veth when you are trying to inspect a physical Ethernet transceiver.

Run the first query with elevated privileges. The command does not alter the interface, but many kernels restrict MII access to root:

$ sudo mii-tool enp0s31f6
enp0s31f6: negotiated 100baseTx-FD, link ok

The exact speed and duplex depend on the adapter and its link partner. What matters is the negotiated media mode and whether the link is reported as up. A line such as no link means physical negotiation has not produced a usable link; it is not proof the interface name is wrong.

Checkpoint

If the command reports Operation not permitted, rerun it with sudo. If it reports No such device, list interfaces again and correct the name. If it reports Operation not supported, the device does not expose the MII interface this tool expects, and no amount of flag-juggling will fix an unsupported driver.

3. Ask for the detailed report

Add -v for more status information:

$ sudo mii-tool -v enp0s31f6
enp0s31f6: negotiated 100baseTx-FD, link ok
  product info: vendor ..., model ..., rev ...
  basic mode:   autonegotiation enabled
  basic status: link ok
  capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
  advertising:  100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD

The product and capability lines vary by hardware, driver and link partner: treat this as a report, not a set of commands to paste back. Only run mii-tool -vv when you genuinely need raw MII register contents. The manual warns that stacking verbosity three times forces reads of non-standard registers, which can hang PHY communication on some hardware, so it is a poor first diagnostic.

4. Restart autonegotiation

If the switch and adapter should negotiate normally but the link has stalled, restart negotiation with -r:

$ sudo mii-tool -r enp0s31f6
restarting autonegotiation...
$ sudo mii-tool enp0s31f6
enp0s31f6: negotiated 100baseTx-FD, link ok

The exact restart message can differ between builds, and expect a brief interruption while the link partner negotiates again.

Warning

This is service-affecting for traffic on that interface, even though it edits no configuration file. If the interface carries your SSH session, use a console or a second path first. There is no persistent undo for -r, it just asks the MII to negotiate again; if the result is worse, wait for the partner to settle and query once more. A reboot, network-manager restart or cable swap is not a substitute for finding a bad cable, switch port or incompatible forced setting.

5. Reset the MII defaults only with a reason

-R resets the MII to its default configuration. It changes link behaviour and can interrupt traffic, so keep it out of a routine status check:

$ sudo mii-tool -R enp0s31f6
$ sudo mii-tool -v enp0s31f6

Use this only when you are deliberately clearing a temporary MII setting and have a maintenance window. There is no general rollback command: recovery means applying the intended settings again, normally through your system's network configuration, then handing the interface back to that configuration's control.

6. Understand forcing versus advertising

The two configuration modes are mutually exclusive. -A keeps autonegotiation on but restricts which media types are advertised. -F switches autonegotiation off and forces one mode. The documented media names are 100baseTx-FD, 100baseTx-HD, 10baseT-FD and 10baseT-HD:

$ sudo mii-tool -A 100baseTx-FD,10baseT-FD enp0s31f6
$ sudo mii-tool -v enp0s31f6

$ sudo mii-tool -F 100baseTx-FD enp0s31f6
$ sudo mii-tool -v enp0s31f6

Warning

These examples change the live link mode. A forced full-duplex setting must agree with the switch; a mismatch can leave the link looking up while performance and error rates are poor. Record the previous report before changing anything, and stick to normal autonegotiation unless the other end is a known passive or fixed-speed device.

To back out of a forced mode into a restricted but negotiated set, use -A with the media your partner supports. -R is the documented reset back to defaults, but it may clear other MII choices too. Verify after every live change, then make the lasting setting in your distribution's network configuration, or a restart will undo it.

For an intermittent cable or switch port, -w polls once a second and reports changes:

$ sudo mii-tool -w enp0s31f6
enp0s31f6: negotiated 100baseTx-FD, link ok
enp0s31f6: link down
enp0s31f6: negotiated 100baseTx-FD, link ok

Press Ctrl-C to stop watching. Add -l only alongside -w if link changes should go to the system log instead of standard output. The watch itself makes no persistent configuration change, but it keeps polling until you stop it.

Done means

  • Interface identified. You confirmed the installed net-tools version and the physical interface.
  • Status read. A privileged query reports the negotiated mode and link state.
  • Detail without risk. You used -v without forcing raw-register reads.
  • Change planned. Any restart or mode change was treated as a brief service interruption.
  • Result verified. You checked the outcome and recorded any live setting that must be made persistent elsewhere.