双网卡绑定配置
// 修改网卡配置文件
cd /etc/sysconfig/network-scripts
cp ifcfg-lo ifcfg-bond0
vi ifcfg-bond0
DEVICE=bond0 IPADDR=10.1.2.3 NETMASK=255.255.255.0 ONBOOT=yes NAME=bond0 BOOTPROTO=none USERCTL=no GATEWAY=10.1.2.1 DNS1=10.10.10.10 DNS2=10.10.10.11
vi ifcfg-eth0
DEVICE=eth0 HWADDR=00:0C:29:96:E1:07 TYPE=Ethernet UUID=5fa57856-a597-4f64-af31-13ed16e28615 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=none USERCTL=no MASTER=bond0 SLAVE=yes
vi ifcfg-eth1
DEVICE=eth1 HWADDR=00:0C:29:96:E1:11 TYPE=Ethernet UUID=fb8dd150-605c-4eb2-bcbf-a92b32217863 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=none USERCTL=no MASTER=bond0 SLAVE=yes
// 新建bonding.conf文件,将bonding和bond0关联
vi /etc/modprobe.d/bonding.conf
alias bond0 bonding options bond0 miimon=100 mode=0
// 重启网卡查看,一切就绪
service network restart
双网卡bond解绑
cd /etc/sysconfig/network-scripts
rm -f /etc/sysconfig/network-scripts/ifcfg-bond0
rm -f /etc/modprobe.d/bonding.conf
vi ifcfg-eth0
DEVICE=eth0 HWADDR=00:0C:29:96:E1:07 TYPE=Ethernet UUID=5fa57856-a597-4f64-af31-13ed16e28615 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=none USERCTL=no IPADDR=10.1.2.3 NETMASK=255.255.255.0 GATEWAY=10.1.2.1 DNS1=10.10.10.10 DNS2=10.10.10.11
vi ifcfg-eth1
DEVICE=eth1 HWADDR=00:0C:29:96:E1:11 TYPE=Ethernet UUID=fb8dd150-605c-4eb2-bcbf-a92b32217863 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=none USERCTL=no IPADDR=192.168.1.201 NETMASK=255.255.255.0
最后执行:
rmmod bonding && service network restart
完成解绑
全程远程操作,安全!