ubuntu快速配置网卡bonding

网卡bonding可以带来网络处理能力的提升,网络接口的冗余等.

前提条件:至少两块可用的网卡,下面以简洁的步骤描述如何快速配置bonding:

1.加载内核模块

vi /etc/modules 加入

bonding

配置好后类似以下:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

loop
lp
rtc
bonding

2.断开网络

stop networking

3.加载模块

modprobe bonding

4.编辑网卡配置,加入bonding

vi /etc/network/interfaces  eth0 eth1设置为bonding模式,编辑好后类似如下:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet manual
bond-master bond0

auto eth1
iface eth1 inet manual
bond-master bond0

auto bond0
iface bond0 inet static
    address 192.168.1.110
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
    # load balancing and fault tolerance
    #bond-mode balance-rr
    bond-mode 802.3ad
    bond-miimon 100
    bond-lacp-rate 1
    bond-slaves none
    #bond-downdelay 200
    #bond-updelay 200
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 192.168.1.1

5.启动网络

start networking

注:这里的bond-mode有多种,根据实际情况和需求进行设置:

Mode 0

balance-rr

Round-robin policy: 从第一块可用的slave网卡开始顺序传输数据包.拥有负载均衡和容错的能力。

Mode 1

active-backup

Active-backup policy: 同一时刻只有一块网卡处于工作模式,另外一块仅当active出现故障时才会启用. 

Mode 2

balance-xor

XOR policy: 基于目的mac异或运算传输数据包,提供负载均衡和容错能力.

Mode 3

broadcast

Broadcast policy: 所有数据包要传送至所有slave,具有很高的容错能力.

Mode 4

802.3ad  遵循IEEE 802.3ad 规范.

 

Mode 5

balance-tlb

自适应负载均衡: 流出流量基于当前各slave速率负载. 进入流量由当前active slave接收.如果流入处理失败,由其他slave接替.

Mode 6

balance-alb

自适应负载均衡: 包含tlb和rlb, 流入负载基于arp协商. 

 

参考文档:https://help.ubuntu.com/community/UbuntuBonding

其他参考:https://www.kernel.org/doc/Documentation/networking/bonding.txt

 younstar原创内容,本人转载

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值