CentOS 5/6/7网卡绑定方案
2017-01-11 20:34
337 查看
网卡绑定方法:
Centos/RHEL5/6 —— Bond方案
1. 网卡配置
#cd/etc/sysconfig/network-script/
#vi ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
#vi ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
#vi ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
IPADDR=X.X.X.X
NETMASK=X.X.X.X
GATEWAY=X.X.XX
2. 模块加载配置
a. Rhel/Centos6.x
#vi/etc/modprobe.d/bond.conf
alias bond1 bonding
options bond0miimon=100 mode=0
(配置模式这里配置为mode=0负载均衡模式0,mode参数为模式类型,具体请参考相关模式资料。miimon为监听时间,我设置100为0.1毫秒)
b. Rhel/Centos5.x
#vi /etc/modprobe.conf
加入以下两行内容
alias bond1 bonding
options bond0miimon=100 mode=0
3. 重启并测试
a. 重启系统
b. 用另外两台机器ping该机器
Ifconfig中可以看到eth0和eth1中流量有变化则说明OK
Centos/RHEL 7 —— Team方案
1. Ifcfg-ethx配置
[root@QD-254-28network-scripts]# cat ifcfg-eth0
NAME=eth0
DEVICE=eth0
DEVICETYPE=TeamPort
ONBOOT=yes
TEAM_MASTER=team0
2. Ifcfg-team0配置
[root@QD-254-28 network-scripts]# catifcfg-team0
NAME=team0
DEVICE=team0
DEVICETYPE=Team
ONBOOT=yes
BOOTPROTO=none
IPADDR=10.32.254.28
PREFIX=24
TEAM_CONFIG="{\"runner\":{\"name\": \"lacp\", \"active\": true,\"fast_rate\": true, \"tx_hash\": [\"eth\",\"ipv4\", \"ipv6\"]}, \"link_watch\": {\"name\":\"ethtool\"}, \"ports\":{\"eth0\": {}, \"eth2\":{}}}"
3. Ifcfg-team1配置
NAME=team1
DEVICE=team1
DEVICETYPE=Team
BOOTPROTO=none
#UUID=dd9fd5f2-1e36-4266-96fd-1de7eea23301
ONBOOT=yes
TEAM_CONFIG="{\"runner\":{\"name\": \"lacp\", \"active\": true,\"fast_rate\": true, \"tx_hash\": [\"eth\",\"ipv4\", \"ipv6\"]}, \"link_watch\": {\"name\":\"ethtool\"}, \"ports\":{\"eth1\": {},\"eth3\": {}}}"
IPADDR=119.167.254.28
PREFIX=24
GATEWAY=119.167.254.254
4. route-team0配置
ADDRESS0=10.0.0.0
NETMASK0=255.0.0.0
GATEWAY0=10.32.254.254
METRIC0=0
注意点:
1. 在centos7中必须启用NetworkManager
2. 不要在配置文件中加上DEFROUTE的设置,很坑
3. Centos7内网路由需要以route-team0文件的形式存在,加在rc.local中无效
Centos/RHEL5/6 —— Bond方案
1. 网卡配置
#cd/etc/sysconfig/network-script/
#vi ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
#vi ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
#vi ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=static
IPADDR=X.X.X.X
NETMASK=X.X.X.X
GATEWAY=X.X.XX
2. 模块加载配置
a. Rhel/Centos6.x
#vi/etc/modprobe.d/bond.conf
alias bond1 bonding
options bond0miimon=100 mode=0
(配置模式这里配置为mode=0负载均衡模式0,mode参数为模式类型,具体请参考相关模式资料。miimon为监听时间,我设置100为0.1毫秒)
b. Rhel/Centos5.x
#vi /etc/modprobe.conf
加入以下两行内容
alias bond1 bonding
options bond0miimon=100 mode=0
3. 重启并测试
a. 重启系统
b. 用另外两台机器ping该机器
Ifconfig中可以看到eth0和eth1中流量有变化则说明OK
Centos/RHEL 7 —— Team方案
1. Ifcfg-ethx配置
[root@QD-254-28network-scripts]# cat ifcfg-eth0
NAME=eth0
DEVICE=eth0
DEVICETYPE=TeamPort
ONBOOT=yes
TEAM_MASTER=team0
2. Ifcfg-team0配置
[root@QD-254-28 network-scripts]# catifcfg-team0
NAME=team0
DEVICE=team0
DEVICETYPE=Team
ONBOOT=yes
BOOTPROTO=none
IPADDR=10.32.254.28
PREFIX=24
TEAM_CONFIG="{\"runner\":{\"name\": \"lacp\", \"active\": true,\"fast_rate\": true, \"tx_hash\": [\"eth\",\"ipv4\", \"ipv6\"]}, \"link_watch\": {\"name\":\"ethtool\"}, \"ports\":{\"eth0\": {}, \"eth2\":{}}}"
3. Ifcfg-team1配置
NAME=team1
DEVICE=team1
DEVICETYPE=Team
BOOTPROTO=none
#UUID=dd9fd5f2-1e36-4266-96fd-1de7eea23301
ONBOOT=yes
TEAM_CONFIG="{\"runner\":{\"name\": \"lacp\", \"active\": true,\"fast_rate\": true, \"tx_hash\": [\"eth\",\"ipv4\", \"ipv6\"]}, \"link_watch\": {\"name\":\"ethtool\"}, \"ports\":{\"eth1\": {},\"eth3\": {}}}"
IPADDR=119.167.254.28
PREFIX=24
GATEWAY=119.167.254.254
4. route-team0配置
ADDRESS0=10.0.0.0
NETMASK0=255.0.0.0
GATEWAY0=10.32.254.254
METRIC0=0
注意点:
1. 在centos7中必须启用NetworkManager
2. 不要在配置文件中加上DEFROUTE的设置,很坑
3. Centos7内网路由需要以route-team0文件的形式存在,加在rc.local中无效
相关文章推荐
- edhat/Centos第二块网卡添加/绑定IP
- centos 6.4系统双网卡绑定配置详解
- CentOS 7.2 bond实现网卡聚合链路(双网卡绑定)脚本及验证(适合云平台)
- CentOS 6.9下双网卡绑定单个IP地址及装网卡绑定到一个网桥(转)
- Centos7多网卡绑定操作,通过nmcli命令操作。
- CentOS/Linux 双网卡绑定单一IP,网卡热备
- Linux学习之CentOS(二十九)--Linux网卡高级命令、IP别名及多网卡绑定
- CentOS单网卡绑定双IP
- centos6.5多网卡绑定
- Centos 6.5 64位双网卡绑定教程
- CentOS下双网卡绑定-bond0
- 转:Centos or Ubuntu 双网卡绑定
- bond网卡绑定(centos6.5 + centos 7)
- Centos 6.5双网卡绑定实现冗余
- 记录一次centos的双网卡绑定
- CentOS7 双网卡绑定
- centos 7 下多网卡绑定+ vlan 网卡配置
- CentOS7多网卡手动绑定
- Linux学习之CentOS(二十九)--Linux网卡高级命令、IP别名及多网卡绑定
- CentOS 6.5 网卡绑定