This mii-diag command configures, controls and monitors the transceiver management registers for network interfaces, and configures driver operational parameters. For transceiver control mii-diag uses the Media Independent Interface (MII) standard (thus the command name). It also has additional Linux-specific controls to communicate parameters such as message enable settings and buffer sizes to the underlying device driver.
The MII standard defines registers that control and report network transceiver capabilities, link settings and errors. Examples are link speed, duplex, capabilities advertised to the link partner, status LED indications and link error counters.
A summary of options is as follows.
Speed is one of: 100baseT4, 100baseTx, 100baseTx-FD, 100baseTx-HD, 10baseT, 10baseT-FD, 10baseT-HD. For more precise control an explicit numeric register setting is also allowed.
Calling the command with just the interface name produces extensive output describing the transceiver capabilities, configuration and current status.
The '--monitor' option allows scripting link beat changes.
This option is similar to --watch, but with lower overhead and simplified
output. It polls the interface only once a second and the output format
is a single line per link change with three fixed words
<unknown|down||negotiating|up> <STATUS> <PARTNER-CAP>
Example output: mii-diag --monitor eth0
down 0x7809 0x0000
negotiating 0x7829 0x45e1
up 0x782d 0x45e1
down 0x7809 0x0000
This may be used as
mii-diag --monitor eth0 |
while read linkstatus bmsr linkpar; do
case $linkstatus in
up) ifup eth0 ;;
down) ifdown eth0 ;;
esac
done
It may be useful to shorten the DHCP client daemon timeout if it does not receive an address by adding the following setting to /etc/sysconfig/network: DHCPCDARGS="-t 3"