绑定

配置

bond配置

cat /etc/sysconfig/network-scripts/ifcfg-bond1
# Generated by playbook_optimize
DEVICE=bond1
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.3.35.13
NETMASK=255.255.255.0
GATEWAY=10.3.35.254
TYPE=Bond
BONDING_OPTS="mode=0 miimon=100"

eth0 配置

cat /etc/sysconfig/network-scripts/ifcfg-eth0
# Generated by playbook_optimize
DEVICE=eth0
HWADDR=ec:38:8f:79:12:cd
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
SLAVE=yes
MASTER=bond1

eth1 配置

cat /etc/sysconfig/network-scripts/ifcfg-eth1
# Generated by playbook_optimize
DEVICE=eth1
HWADDR=ec:38:8f:79:12:ce
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
SLAVE=yes
MASTER=bond1

常用命令

查看状态

cat /proc/net/bonding/bond1

绑定切换

ifenslave bond1 eth0 eth1 

批量配置

git clond

配置 hosts

[all]
node01 ...

配置 bond.yaml

bond_mode: 1
bond_name: bond0
bond_menber:
    - eth0
    - eth1