BayaiM__linux双网卡绑定文档
开门贱山:以下内容纯属原创,如有雷同,爱咋咋滴吧~~!!
——————————————————————————————————————————
1,备份网卡信息。
命令: cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-bond0
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/eth0_bak
cp /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/eth1_bak
2,修改网卡信息。
A.修改eth0
vi /etc/sysconfig/network-scripts/ifcfg-eth0
修改为:
DEVICE=eth0
BOOTPROTO=none
HWADDR=B8:AC:6F:83:7E:A6(mac地址根据具体情况而定)
ONBOOT=yes
MASTER=bond0
SLAVE=yes
B.修改eth1
vi /etc/sysconfig/network-scripts/ifcfg-eth1
修改为:
DEVICE=eth0
BOOTPROTO=none
HWADDR=B8:AC:6F:83:7E:A6(mac地址根据具体情况而定)
ONBOOT=yes
MASTER=bond0
SLAVE=yes
C.修改bond0
vi /etc/sysconfig/network-scripts/ifcfg-bond0
修改为:
DEVICE=bond0
BOOTPROTO=none
IPADDR=172.16.87.2(IP地址根据具体情况而定)
GATEWAY=172.16.87.224(根据具体情况而定)
NETMASK=255.255.255.0(根据具体情况而定)
ONBOOT=yes
BONDING_OPTS="mode=1 miimon=100 primary=eth2"
3,增加内核模块
vi /etc/modprobe.conf
alias bond0 bonding
options bond0 miimon=100 mode=1
4,重启network
5,检查绑定状态
cat /proc/net/bonding/bond0
6,回滚
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/eth0_bak2
cp /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/eth1_bak2
mv /etc/sysconfig/network-scripts/eth1_bak /etc/sysconfig/network-scripts/ ifcfg-eth1
mv /etc/sysconfig/network-scripts/eth0_bak /etc/sysconfig/network-scripts/ ifcfg-eth0
mv /etc/sysconfig/network-scripts/ifcfg-bond0 /etc/sysconfig/network-scripts/bond0_bak
service network restart
____________________________________________________________________________________________________________________