linux下网卡绑定

网卡绑定的作用:1、冗余,防止单点故障 

        2、防止传输瓶颈

1.交换机端口绑定:

1 system-view
2 link-aggregation group 1 mode manual
3 
4 比如把端口1和2进行绑定
5 
6 interface Ethernet1/0/1                  #进入交换机1口
7 port link-aggregation group 1        #把当前端口加入汇聚组1
8 interface Ethernet1/0/2                  #进入交换机2口
9 port link-aggregation group 1        

2.系统网卡绑定

1.设置Bounding
vi /etc/modules.conf   #添加以下内容
alias bond0 bonding
options bonding mode=1 miimon=200 primary=eth2 use_carrier=1

2. 加载bonding模块
modprobe bonding

3.创建/修改bond0 eth0 eth1 配置文件
vi /et/sysconfig/network-ifcfg-“网卡名”

DEVICE='bond0'
BOOTPROTO='static'
BROADCAST='x.x.x.x'
IPADDR='x.x.x.x'

DEVICE=eth0
BOOTPROTO='static'
STARTMODE='onboot'

DEVICE=eth1
BOOTPROTO='static'
STARTMODE='onboot'

4.重启所有网卡
rcnetwork restart

5.绑定eth0 eth1 到bond0
ifenslave bond0 eth0
ifenslave bond0 eth1

6.重启后自动加载设置:

在/etc/init.d/中添加bonding启动文件
vi /etc/init.d/bonding  #添加以下语句
case “$1in
    start)
/sbin/ifenslave bond0 eth0
/sbin/ifenslave bond0 eth1
;;
        *)
;;
esac

7.把加载bonding模块的脚本加入启动脚本中

vi /etc/init.d/boot.local
modprobe bonding

 

转载于:https://www.cnblogs.com/cpy-devops/p/3961383.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值