手机
当前位置:查字典教程网 >操作系统 >unix linux >Debian 双网卡bond
Debian 双网卡bond
摘要:1.安装ifenslaveifenslave的作用是网卡的负载均衡#apt-getinstallifenslave2.修改/etc/netw...

1. 安装ifenslave

ifenslave的作用是网卡的负载均衡

# apt-get install ifenslave

2. 修改/etc/network/interface

{root@b01 359 ~}

# cat /etc/network/interfaces

# 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

auto <A href="/tag/bond/">bond</A>0

iface bond0 inet static

address 192.168.1.5

netmask 255.255.255.0

gateway 192.168.1.1

up ifenslave bond0 eth0 eth1

down ifenslave -d bond0 eth0 eth1

dns-nameservers 8.8.8.8

iface eth0 inet static

iface eth1 inet static

3. 加载bonding模块(这块费了大部分时间)

# cat /etc/modprobe.d/aliases-bond

install bond0 /sbin/modprobe bonding miimon=100 mode=0

bond的mode一共有七种:

0: (balance-rr) Round-robin policy: (平衡抡循环策略):传输数据包顺序是依次传输,直到最后一个传输完毕, 此模式提供负载平衡和容错能力。

1: (active-backup) Active-backup policy:(主-备份策略):只有一个设备处于活动状态。 一个宕掉另一个马上由备份转换为主设备。mac地址是外部可见得。 此模式提供了容错能力。

2:(balance-xor) XOR policy:(广播策略):将所有数据包传输给所有接口。 此模式提供了容错能力。

3:(balance-xor) XOR policy:(平衡策略): 传输根据原地址布尔值选择传输设备。 此模式提供负载平衡和容错能力。

4:(802.3ad) IEEE 802.3ad Dynamic link aggregation.IEEE 802.3ad 动态链接聚合:创建共享相同的速度和双工设置的聚合组。

5:(balance-tlb) Adaptive transmit load balancing(适配器传输负载均衡):没有特殊策略,第一个设备传不通就用另一个设备接管第一个设备正在处理的mac地址,帮助上一个传。

6:(balance-alb) Adaptive load balancing:(适配器传输负载均衡):大致意思是包括mode5,bonding驱动程序截获 ARP 在本地系统发送出的请求,用其中之一的硬件地址覆盖从属设备的原地址。就像是在服务器上不同的人使用不同的硬件地址一样

一个小技巧:

为了防止修改网卡配置或其他配置错误导致不能连接服务器,写一个crontab, 将正确的网卡配置文件恢复后重新network restart或者

重启机器 (iptable等类似风险操作也可以这样来处理)

{root@b01 361 ~}

# crontab -l

# m h dom mon dow command

#20 * * * * cp -pr /etc/network/interfaces.org /etc/network/interfaces

#21 * * * * /sbin/init 6

【Debian 双网卡bond】相关文章:

Linux的常用网络命令

FreeBSD 6.0-RELEASE下建立高速DNS缓存服务器的方法

Linux 备份 恢复方法

Red Hat Linux 安全设置指南

Linux 常用软件列表

Linux下清空用户登录记录和命令历史的方法分享

vmware中linux如何设置网卡

linux 双网卡绑定网络设置方法

用SHELL实现子目录文件列表操作指南

给Linux新手[系列之四]

精品推荐
分类导航