Home / Alt manpages / mii-tool(8)

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

Check and Carefully Reset Ethernet Link Negotiation with mii-tool

You will use mii-tool to inspect a physical Ethernet interface, read a more detailed MII report, and restart autonegotiation when a link needs a nudge. Allow about ten minutes. You need the net-tools package, an interface backed by an MII-capable device, and usually root privileges 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 manual page are the useful contract here. MII means 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

First 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. The following lists link devices without changing them:

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

Replace enp0s31f6 in the examples with your own wired interface. Do not use lo, a bridge, or a container veth when you are trying to inspect the 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. The useful parts are the negotiated media mode and whether the link is reported as up. A line such as no link means the physical negotiation has not produced a usable link; it is not proof that the interface name is wrong.

Checkpoint: if the command reports Operation not permitted, repeat 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. Do not keep changing flags in the hope of making an unsupported driver work.

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 the output as a report, not as a list of commands to paste back. Run mii-tool -vv only when you genuinely need raw MII register contents. The manual warns that using verbosity three times forces reads of non-standard registers, which can hang PHY communication on some hardware. That 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. Expect a brief interruption while the link partner negotiates again. This is a service-affecting action for traffic on that interface, although it does not edit a configuration file. If the interface carries an SSH session, use a console or a second path first.

There is no persistent undo step for -r: it asks the MII to negotiate again. If the result is worse, wait for the partner to settle and query again. A reboot, network-manager restart, or cable swap is not a substitute for identifying 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 do not include it in 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. The utility does not provide a general rollback command. Your recovery is to apply the intended settings again, normally through the system's network configuration, then bring the interface back under that configuration's control.

6. Understand forcing versus advertising

The two configuration modes are mutually exclusive. -A enables autonegotiation but restricts the media types advertised. -F disables autonegotiation and forces one mode. The documented media names include 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

These examples change the live link mode. They are troubleshooting tools, not harmless probes. A forced full-duplex setting must agree with the switch; a mismatch can leave the link apparently up while performance and error rates are poor. Record the previous report before changing anything, and prefer the normal autonegotiated configuration unless the other end is a known passive or fixed-speed device.

To return from a forced mode to a restricted but negotiated set, use -A with the media your link partner supports. To return to the adapter's default set, -R is the documented reset, but it may also clear other MII choices. Verify after every live change and then make the lasting setting in the network configuration managed by your distribution, otherwise a restart may undo it.

For an intermittent cable or switch port, -w polls once per 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 with -w if link changes should be written to the system log instead of standard output. A watch process is temporary and makes no persistent configuration change, but it does keep polling until you stop it.

Done means

  • You identified the physical interface and confirmed the installed net-tools version.
  • A privileged status query reports the negotiated mode and link state.
  • You used -v for detail without forcing risky raw-register reads.
  • Any restart or mode change was planned as a brief service interruption.
  • You verified the result and recorded any live setting that must be made persistent elsewhere.