Linux Bonding Configuration Tool
A command-line tool written in Rust for configuring network interface bonding on RHEL-based Linux systems.
- Interactive and parameter modes
- Support for all 7 bonding modes (0-6)
- Dynamic member management (add/remove/replace slaves)
- VLAN configuration support
- CIDR and separate IP format support
- Automatic backup before configuration changes
- Automatic language detection (Chinese/English)
- Single static binary - no runtime dependencies
- RHEL / CentOS 7, 8, 9
- Rocky Linux / AlmaLinux 8, 9
- Kylin V10 SP3+
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu
# Download and install (auto-detect architecture)
curl -sL "https://api.github.com/repos/fangeus/bondcli/releases/latest" \
| grep '"tag_name"' | head -1 | sed -E 's/.*"([^"]+)".*/\1/' \
| while read TAG; do
VER="${TAG#v}"
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH_SHORT="x86_64" ;;
aarch64|arm64) ARCH_SHORT="aarch64" ;;
*) echo "Unsupported arch: $ARCH"; exit 1 ;;
esac
TAR="bondcli-${VER}-linux-${ARCH_SHORT}.tar.gz"
curl -sLO "https://github.com/fangeus/bondcli/releases/latest/download/${TAR}"
tar xzf "$TAR"
cd "bondcli-${VER}-linux-${ARCH_SHORT}"
sudo sh install.sh
done
source /etc/profile
bondcli <TAB> # tab-completion availableOr use the Makefile shortcut:
sudo make install-prebuiltRequirements:
- Rust 1.70+ (install via rustup)
- Cargo
git clone https://github.com/fangeus/bondcli.git
cd bondcli
make release
sudo make installShell completions are automatically registered by install.sh. To manually generate:
# Bash
bondcli completion bash > /etc/bash_completion.d/bondcli
# Zsh
bondcli completion zsh > /usr/share/zsh/site-functions/_bondcli
# Fish
bondcli completion fish > /usr/share/fish/vendor_completions.d/bondcli.fish
# PowerShell
bondcli completion powershell > ~/Documents/PowerShell/bondcli.ps1sudo bondcli --interactive
# or
sudo bondcli -i# Create a bond with DHCP
sudo bondcli create --name bond0 --slaves eth0 eth1 --mode 1 --dhcp
# Create a bond with static IP
sudo bondcli create --name bond0 --slaves eth0 eth1 --mode 1 --ip 192.168.1.100/24 --gateway 192.168.1.1
# Create a bond with VLAN
sudo bondcli create --name bond0 --slaves eth0 eth1 --mode 1 --dhcp --vlan-id 100bondcli create [OPTIONS]
Options:
-n, --name <NAME> Bond interface name [default: bond0]
-m, --mode <MODE> Bond mode (0-6) [default: 1]
-s, --slaves <SLAVES> Slave interfaces (1-4, required)
--dhcp Use DHCP for IP configuration
--ip <IP/CIDR> Static IP in CIDR format
--gateway <IP> Gateway IP address
--vlan-id <ID> VLAN ID (1-4094)
--miimon <MS> MII monitoring interval [default: 100]
--primary <IFACE> Primary slave (mode 1 only)
--dry-run Show what would be done
--no-restart Do not activate interfaces (skip ifup/ifdown)bondcli add <BOND> <SLAVE> [--dry-run] [--no-restart]bondcli remove <BOND> <SLAVE> [--dry-run] [--no-restart]bondcli replace <BOND> <OLD> <NEW> [--dry-run] [--no-restart]bondcli delete <BOND> [--dry-run] [--no-restart] [--no-restore]| Option | Description |
|---|---|
--no-restore |
Do not restore slave configs from backup (skip ifup); by default, configs are restored and interfaces are brought up |
bondcli list# Show all bonds with detailed info
bondcli status
# Show a specific bond
bondcli status bond0Example output:
=== bond0 ===
模式 : 1. active-backup
Miimon : 100ms
状态 : up
CIDR : 192.168.1.100/24
网关 : 192.168.1.1
主网卡 : eth0
成员:
- eth0 (UP: true) (活动)
- eth1 (DOWN: false) (备份)
当前活动 : eth0
| Mode | Name | Description |
|---|---|---|
| 0 | Round-Robin | Sequential transmission on all slaves |
| 1 | Active-Backup | Only one slave active at a time |
| 2 | Balance-XOR | Transmit based on source/dest MAC XOR |
| 3 | Broadcast | Transmit on all slaves |
| 4 | 802.3ad (LACP) | IEEE 802.3ad Dynamic Link Aggregation |
| 5 | Balance-TLB | Transmit Load Balancing |
| 6 | Balance-ALB | Adaptive Load Balancing |
The interactive mode guides you through 7 steps to create a bonded interface. Below is a walkthrough of a real session — creating an Active-Backup bond with two physical NICs (eth0, eth1) using a static IP.
$ sudo bondcli --interactive
── Step 1: Bond Name ──
Enter bond name [bond0]:
← press Enter to accept default
── Step 2: Bond Mode ──
Available modes:
0. Round-Robin
* 1. Active-Backup
2. Balance-XOR
3. Broadcast
4. 802.3ad (LACP)
5. Balance-TLB
6. Balance-ALB
Select bond mode [1]:
← press Enter to accept default (mode 1)
── Step 3: Select Slave Interfaces (1-4) ──
Available interfaces:
1. eth0 (MAC: 00:1a:2b:3c:4d:01, IP: -, state: UP)
2. eth1 (MAC: 00:1a:2b:3c:4d:02, IP: -, state: UP)
3. eth2 (MAC: 00:1a:2b:3c:4d:03, IP: 10.0.0.50, state: UP)
⚠ This interface eth2 has IP config, it will be lost after bonding
Select 1-4 interface(s) (enter index, space-separated for multiple):
> 1 2 ← select eth0 and eth1
Selected: eth0, eth1
── Step 4: IP Configuration ──
Select IP configuration:
1. Static IP (CIDR format)
2. Static IP (separate)
3. DHCP
> 1 ← choose CIDR format (or press Enter for default)
Enter IP/CIDR (e.g., 192.168.1.100/24): 192.168.1.100/24
Enter gateway (optional, press Enter to skip): 192.168.1.1
── Step 5: VLAN ──
Configure VLAN? [no]:
← press Enter to skip
── Step 6: MII Monitoring ──
Enter MII monitoring interval (ms) [100]:
← press Enter to accept default 100ms
── Step 7: Confirm ──
Configuration Summary:
Name: bond0
Mode: 1. Active-Backup
Slaves: eth0, eth1
Miimon: 100ms
IP: 192.168.1.100/24, Gateway: 192.168.1.1
Confirm creation? (y/N): y
[SUCCESS] Bond created successfully
| Step | Prompt | What to enter |
|---|---|---|
| 1 | Bond name | bond0 — bondN format, or press Enter for default |
| 2 | Bond mode | 0–6, or press Enter for default (mode 1) |
| 3 | Slave interfaces | Index numbers (e.g. 1 2) — 1-4 required. Only UP and available NICs are shown. NICs with existing IP config show a warning |
| 4 | IP config | 1 = CIDR, 2 = IP + Netmask separately, 3 = DHCP. Enter to default to CIDR |
| 5 | VLAN | y/yes to configure, Enter or n to skip |
| 6 | MII monitor | Interval in ms, Enter for default 100ms |
| 7 | Confirm | y/yes to proceed, anything else cancels |
Note: The bonding tool enforces a minimum of 1 and maximum of 4 slave interfaces in both interactive and command modes.
You can also see all steps at once by using
bondcli create -hfor the parameter mode.
sudo bondcli create -n bond0 -s eth0 eth1 -m 1 --dhcpsudo bondcli create -n bond0 -s eth0 eth1 -m 4 --ip 10.0.0.100/24 --gateway 10.0.0.1sudo bondcli add bond0 eth2sudo bondcli replace bond0 eth0 eth3sudo bondcli delete bond0Warning: This tool will permanently disable NetworkManager.
If NetworkManager is already stopped and disabled, the tool will detect this and skip the disable step automatically.
If you need to restore NetworkManager later:
sudo systemctl enable --now NetworkManagerVLAN ID and IP address are independent. The VLAN ID is used only to create a VLAN sub-interface.
Example: --vlan-id 100 creates interface bond0.100
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Interface not found or already in use |
| 3 | Configuration file write error |
| 4 | Network service restart failed |
| 5 | Operation prohibited |
| 6 | User cancelled |
Run with sudo: bondcli requires root privileges.
Check network service status:
systemctl status network
journalctl -u network -n 50Verify interface exists:
ip link show
ls /sys/class/net/# Build
make build
# Run tests
make test
# Lint
make lint
# Build release
make release
# Clean
make cleanLicensed under the MIT License.
See LICENSE for details.