-sys-class-net-bond-bonding-miimon
The /sys/class/net/bond*/bonding/miimon file in Linux contains the MII (Media Independent Interface) monitoring interval in milliseconds for a bonded network interface. This value is used in network interface bonding (also called NIC teaming) to determine how frequently the kernel checks the link status of each network slave interface.
Example of Usage
Check the
miimoninterval for a bonding interface (e.g.,bond0):
cat /sys/class/net/bond0/bonding/miimonExample Output:
100This output indicates that the link status is being checked every 100 milliseconds.
Explanation:
The
miimonvalue sets the time interval (in milliseconds) between checks of the link status for each slave in the bond.A value of
0means that MII monitoring is disabled.The most commonly used values are
100ms (a check every 0.1 seconds) or1000ms (a check every 1 second), depending on the desired frequency of the status check.
How it Works:
When MII monitoring is enabled (with a non-zero miimon value), the bonding driver sends MII status requests to each interface in the bond. If the driver detects a failure in any slave interface (such as a cable being unplugged), it will mark the interface as "down" and stop sending traffic over that interface. If the interface comes back up, it will be marked as "up," and traffic will resume on that interface.
Adjusting the miimon value:
miimon value:The miimon value can be set when configuring the bonding interface, for example:
sudo ifenslave bond0 eth0 eth1
sudo echo 100 > /sys/class/net/bond0/bonding/miimonAlternatively, you can set the miimon value in your network interface configuration file (e.g., /etc/network/interfaces or /etc/sysconfig/network-scripts/ifcfg-bond0), depending on your Linux distribution.
Example configuration (Debian/Ubuntu):
auto bond0
iface bond0 inet static
address 192.168.1.100
netmask 255.255.255.0
bond-slaves eth0 eth1
bond-miimon 100
bond-mode active-backupThis would set up a bond interface bond0 with MII monitoring at 100 ms intervals.
Summary
The /sys/class/net/bond*/bonding/miimon file allows you to check the current link monitoring interval for a bonded interface. By adjusting this value, you can control how frequently the bonding driver checks for link failures, balancing between faster detection of issues and CPU/network overhead from too frequent checks.
Last updated