bond0配置

手动配置bond0

#bond0 配置
cat > /etc/sysconfig/network-scripts/ifcfg-bond0 <<EOF
NAME=bond0
TYPE=bond
DEVICE=bond0
BOOTPROTO=none
IPADDR=10.0.0.100
PREFIX=8
BONDING_OPTS="mode=1 miimon=100 fail_over_mac=1"
EOF

#eth0的bond0配置
cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
NAME=eth0
DEVICE=eth0
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
onboot=yes
EOF

#eth1的bond0配置
cat > /etc/sysconfig/network-scripts/ifcfg-eth1 <<EOF
NAME=eth1
DEVICE=eth1
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
onboot=yes
EOF

#查看bond0状态
/prov/net/bonding/bond0

#删除bond0
ifconfig bond0 down

 

nmcli实现bond0

#添加bond接口
nmcli con add type bond con-name mybond0 ifname bond0 mode active-backup ipv4.method manual ipv4.addresses 10.0.0.100/24

#添加从属接口
nmcli con add type bond-slave ifname eth0 master bond0
nmcli con add type bond-slave ifname eth1 master bond0

#要启动绑定,必须首先启动从属接口
nmcli con up bond-slave-eth0
nmcli con up bond-slave-eth1

#启动绑定
nmcli con up mybond0

 

posted @ 2022-12-05 23:21  whisper2008  阅读(463)  评论(0编辑  收藏  举报