多 bonding 使用不同 mode 方法
来源:互联网 发布:高中数学教学视频软件 编辑:程序博客网 时间:2024/05/17 03:00
环境,
多网卡, 多 bond 设备, 需要使用不同的工作方式, 如下:
eth0 eth1 -> bond0 -> mode 0 ( active-backup )
eth2, eth3 -> bond1 -> mode 1 (balance-rr)
参考:
[root@hh-yun-puppet-129021 kickstarts]# yum install -y kernel-doc
[root@hh-yun-puppet-129021 kickstarts]# rpm -ql kernel-doc | grep bonding.txt
/usr/share/doc/kernel-doc-2.6.32/Documentation/networking/bonding.txt
其中该文档描述
/etc/modprobe.d/bond.conf 需要具有下面的配置
<pre class="plain" name="code">alias bond0 bondingoptions bond0 -o bond0 mode=balance-rr miimon=100alias bond1 bondingoptions bond1 -o bond1 mode=balance-alb miimon=50
但上述文档只能够针对 centos 5 或之前版本, 而文档也没有更新 centos 6, 7 下的方法
而 centos 6,7 将不可以使用 -o 参数进行参数定义, 另外, 假如把配置, 参数都写入 /etc/modprobe.d/bond.conf 如
alias bond0 bondingoptions bond0 mode=balance-rr miimon=100alias bond1 bondingoptions bond1 mode=balance-alb miimon=50
看上去 bond0, bond1 可以启动, 但从内核参数显示, 上述的设备只会使用相同的工作模式, 不满足不同 bond 设备使用不同模式方法
参考:
[root@hh-yun-compute-130026 ~]# grep Mode /proc/net/bonding/bond0Bonding Mode: load balancing (round-robin)[root@hh-yun-compute-130026 ~]# grep Mode /proc/net/bonding/bond1Bonding Mode: load balancing (round-robin)
centos 6, 7 上正确配置方法:
/etc/modprobe.d/bond.conf
alias bond0 bondingalias bond1 bonding
/etc/sysconfig/network-scripts/ifcfg-bond0
BONDING_OPTS='mode=1 miimon=100'
/etc/sysconfig/network-scripts/ifcfg-bond1
BONDING_OPTS='mode=0 miimon=100'
另: 注意, centos 7 下, 假如关闭 ipv6 模块使用, 那么 bond 模块也是无法正常使用的.
而 centos 7 已推荐使用 teamd 进行 bond 配置
teamd 与 bond 实现相同功能, 但新增不少新特性, 比较灵活, 相关信息自己看官方文旦
测试配置方法
[root@node147 network-scripts]# cat ifcfg-eth0DEVICE="eth0"DEVICETYPE=TeamPortONBOOT=yesTEAM_MASTER=team0TEAM_PORT_CONFIG='{"prio": 100}'[root@node147 network-scripts]# cat ifcfg-eth1DEVICE=eth1DEVICETYPE=TeamPortONBOOT=yesTEAM_MASTER=team0TEAM_PORT_CONFIG='{"prio": 100}'[root@node147 network-scripts]# cat ifcfg-eth2DEVICE="eth2"DEVICETYPE=TeamPortONBOOT=yesTEAM_MASTER=team1TEAM_PORT_CONFIG='{"prio": 100}'[root@node147 network-scripts]# cat ifcfg-eth3DEVICE="eth3"DEVICETYPE=TeamPortONBOOT=yesTEAM_MASTER=team1TEAM_PORT_CONFIG='{"prio": 100}'
team 配置与 mode 配置
[root@node147 network-scripts]# cat ifcfg-team0DEVICE=team0DEVICETYPE=TeamONBOOT=yesBOOTPROTO=noneIPADDR=192.168.48.147GATEWAY=192.168.48.1PREFIX=24TEAM_CONFIG='{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}'[root@node147 network-scripts]# cat ifcfg-team1DEVICE=team1DEVICETYPE=TeamONBOOT=yesBOOTPROTO=noneIPADDR=10.0.0.147PREFIX=24TEAM_CONFIG='{"runner": {"name": "loadbalance"}, "link_watch": {"name": "ethtool"}}'
校验方法
[root@node147 network-scripts]# teamdctl -o -v team0 state dump{"ports": {"eth0": {"ifinfo": {"dev_addr": "00:50:56:81:7e:82", "dev_addr_len": 6, "ifindex": 2, "ifname": "eth0"}, "link": {"duplex": "full", "speed": 10000, "up": true}, "link_watches": {"list": {"link_watch_0": {"delay_down": 0, "delay_up": 0, "name": "ethtool", "up": true}}, "up": true}}, "eth1": {"ifinfo": {"dev_addr": "00:50:56:81:7e:82", "dev_addr_len": 6, "ifindex": 3, "ifname": "eth1"}, "link": {"duplex": "full", "speed": 10000, "up": true}, "link_watches": {"list": {"link_watch_0": {"delay_down": 0, "delay_up": 0, "name": "ethtool", "up": true}}, "up": true}}}, "runner": {"active_port": "eth0"}, "setup": {"daemonized": false, "dbus_enabled": true, "debug_level": 0, "kernel_team_mode_name": "activebackup", "pid": 3191, "pid_file": "/var/run/teamd/team0.pid", "runner_name": "activebackup", "zmq_enabled": false}, "team_device": {"ifinfo": {"dev_addr": "00:50:56:81:7e:82", "dev_addr_len": 6, "ifindex": 8, "ifname": "team0"}}}[root@node147 network-scripts]# teamdctl -o -v team1 state dump{"ports": {"eth2": {"ifinfo": {"dev_addr": "00:50:56:81:7c:e7", "dev_addr_len": 6, "ifindex": 4, "ifname": "eth2"}, "link": {"duplex": "full", "speed": 10000, "up": true}, "link_watches": {"list": {"link_watch_0": {"delay_down": 0, "delay_up": 0, "name": "ethtool", "up": true}}, "up": true}}, "eth3": {"ifinfo": {"dev_addr": "00:50:56:81:7c:e7", "dev_addr_len": 6, "ifindex": 5, "ifname": "eth3"}, "link": {"duplex": "full", "speed": 10000, "up": true}, "link_watches": {"list": {"link_watch_0": {"delay_down": 0, "delay_up": 0, "name": "ethtool", "up": true}}, "up": true}}}, "setup": {"daemonized": false, "dbus_enabled": true, "debug_level": 0, "kernel_team_mode_name": "loadbalance", "pid": 3419, "pid_file": "/var/run/teamd/team1.pid", "runner_name": "loadbalance", "zmq_enabled": false}, "team_device": {"ifinfo": {"dev_addr": "00:50:56:81:7c:e7", "dev_addr_len": 6, "ifindex": 9, "ifname": "team1"}}}
- 多 bonding 使用不同 mode 方法
- 多 bonding 使用不同 mode 方法
- bonding mode 4 测试
- linux 多网卡bonding
- Bonding
- bonding
- 多网卡绑定配置-bonding
- Ubuntu14配置Bonding多网卡
- 转贴:Linux 环境下多网卡使用一个IP提高效率--Bonding
- bonding-多网卡绑定一起,作为一个网卡使用,实现负载均衡和提高带宽
- RedHat / CentOS:如何在线更改当前网口 Slave的状态(bonding mode)
- linux下如何实现多网卡bonding
- 多网卡绑定Bonding生产实战
- Linux下多网卡绑定bonding bond6
- 多个eclipse启动分别使用不同JDK的方法
- zend framework2 中不同模块使用不同layout的方法
- CSS居中的不同情况使用不同的方法
- AJAX不同方法的对比使用
- matlab打印图形
- bzoj1259: [CQOI2007]矩形rect 暴力
- 仿函数续
- Android获取Manifest中<meta-data>元素的值
- Android中使用代码截图的各种方法总结
- 多 bonding 使用不同 mode 方法
- Maven简单学习摘要
- 动态规划之插头DP入门
- ArrayList的iterator()方法剖析
- ARM程序的执行过程
- bzoj1257: [CQOI2007]余数之和sum
- 八款Java开发者必备的工具
- POSIX semaphore: sem_open, sem_close, sem_post, sem_wait
- Ubuntu 12.04安装交叉编译器arm-none-linux-gnueabi-gcc arm-linux-gcc