立即注册 登录
About云-梭伦科技 返回首页

Aningorg的个人空间 https://www.aboutyun.com/?70889 [收藏] [复制] [分享] [RSS]

日志

双网卡绑定bond 0

已有 1047 次阅读2018-10-19 11:31 |个人分类:linux|系统分类:大数据| 双网卡绑定

做了bond之后,的确可以实现网口的冗余  和  网络性能的提高
# 停止ֹNetworkManager
/etc/init.d/NetworkManager stop

chkifconfig NetworkManager off

# 编辑网卡 eth0
vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes


# 编辑网卡 eth1
vim /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes


# 编辑网卡 bond0
#
vim /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPADDR=80.40.16.158
NETMASK=255.255.255.0
GATEWAY=80.40.16.254
IPV6INIT=no
USERCTL=no
NAME="System bond0"
DNS1=80.40.16.39


# 编辑bonding.conf
vim /etc/modprobe.conf
或者
vim /etc/modprobe.d/bonding.conf

添加
alias bond0 bonding
options bond0 miimon=100 mode=6


#
# gw (gateway)网关
vim /etc/rc.local

最后一行   gw (gateway)网关
route add -net 0.0.0.0 netmask 0.0.0.0 gw xx.xx.xx.xx
添加 ifenslave bond0 eth1 eth2

重启服务器,测试
# 重启服务NetworkManager
/etc/init.d/NetworkManager restart

# 查看绑定状态
 cat /proc/net/bonding/bond0
 [root@htxx5 ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)

Bonding Mode: adaptive load balancing
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 0c:c4:7a:95:1f:76
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 0c:c4:7a:95:1f:77
Slave queue ID: 0
[root@htxx5 ~]# ^C

#查看绑定之后的速度 正常为2000
cat /sys/class/net/bond0/speed

Bond有7种模式,我们常用的是
mode=0:平衡负载模式,有自动备援,但需要”Switch”支援及设定
mode=1:自动备援模式,其中一条线若断线,其他线路将会自动备援。
mode=6:平衡负载模式,有自动备援,不必”Switch”支援及设定。

可参考
https://wenku.baidu.com/view/9da953426f1aff00bfd51e51.html
https://www.cnblogs.com/guixia621/p/6766895.html

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

关闭

推荐上一条 /2 下一条