第一步,设置设定文件:
- /etc/sysconfig/network-scripts/ifcfg-bond0
- DEVICE=bond0
- BOOTPROTO=none
- ONBOOT=yes
- IPADDR=192.168.0.100
- NETMASK=255.255.255.0
- NETWORK=192.168.0.0
- BROADCAST=192.168.0.255
- BROADCAST广播地点
- /etc/sysconfig/network-scripts/ifcfg-eth0
- DEVICE=eth0
- BOOTPROTO=none
- MASTER=bond0
- SLAVE=yes
- /etc/sysconfig/network-scripts/ifcfg-eth1
- DEVICE=eth1
- BOOTPROTO=none
- MASTER=bond0
- SLAVE=yes
第二步,修改modprobe相干设定文件,并加载bonding模块:
1.在这里,我们直接建设一个加载bonding的专属设定文件/etc/modprobe.d/bonding.conf
- [root@test ~]# vi /etc/modprobe.d/bonding.conf
追加
- alias bond0 bonding
- options bonding mode=0 miimon=200
2.加载模块(重启体系后就不消手动再加载了)
- [root@test ~]# modprobe bonding
3.确认模块是否加载乐成:
- [root@test ~]# lsmod | grep bonding
- bonding 100065 0
第三步,重启一下收集,然后确认一下状况:
- [root@test ~]# /etc/init.d/network restart
- [root@test ~]# cat /proc/net/bonding/bond0
- Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)
- Bonding Mode: fault-tolerance (active-backup)
- Primary Slave: None
- Currently Active Slave: eth0
- ……
-
- [root@test ~]# ifconfig | grep HWaddr
- bond0 Link encap:Ethernet HWaddr 00:16:36:1B:BB:74
- eth0 Link encap:Ethernet HWaddr 00:16:36:1B:BB:74
- eth1 Link encap:Ethernet HWaddr 00:16:36:1B:BB:74
从上面简直认信息中,我们可以看到3个重要信息:
1.此刻的bonding模式是active-backup
2.此刻Active状态的网口是eth0
3.bond0,eth1的物理地点和处于active状态下的eth0的物理地点沟通,这样是为了停止上位互换机产生紊乱。
恣意拔掉一根网线,然后再见见你的处事器,看收集是否照旧通的。
第四步,体系启动自动绑定、增进默认网关:
- [root@test ~]# vi /etc/rc.d/rc.local
追加
- ifenslave bond0 eth0 eth1
- route add default gw 192.168.0.1
如可上网就不消增进路由,0.1地点按情形修改.
把稳:前面只是2个网口绑定成一个bond0的环境,假如我们要配置多个bond口,好比物理网口eth0和eth1构成bond0,eth2和eth3构成bond1,
那么网口配置文件的配置要领和上面第1步讲的要领沟通,只是/etc/modprobe.d/bonding.conf的设定就不能像下面这样简朴的叠加了:
- alias bond0 bonding
- options bonding mode=1 miimon=200
- alias bond1 bonding
- options bonding mode=1 miimon=200
正确的配置要领有2种:
第一种,你可以看到,这种方法的话,多个bond口的模式就只能设成沟通的了:
- alias bond0 bonding
- alias bond1 bonding
- options bonding max_bonds=2 miimon=200 mode=1
(编辑:湖南网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|