> For the complete documentation index, see [llms.txt](https://linux-tutorial-cli.gitbook.io/linux-cli-tutorial/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://linux-tutorial-cli.gitbook.io/linux-cli-tutorial/txt-files/file-systems-cocepts/lpic3-306/sys-class-net-bond-bonding-miimon.md).

# -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

1. **Check the `miimon` interval for a bonding interface (e.g., `bond0`):**

```bash
cat /sys/class/net/bond0/bonding/miimon
```

#### Example Output:

```
100
```

This output indicates that the link status is being checked every 100 milliseconds.

#### Explanation:

* The `miimon` value sets the time interval (in milliseconds) between checks of the link status for each slave in the bond.
* A value of `0` means that MII monitoring is disabled.
* The most commonly used values are `100` ms (a check every 0.1 seconds) or `1000` ms (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:

The `miimon` value can be set when configuring the bonding interface, for example:

```bash
sudo ifenslave bond0 eth0 eth1
sudo echo 100 > /sys/class/net/bond0/bonding/miimon
```

Alternatively, 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):

```bash
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-backup
```

This 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.
