debian 8.2 bond 双网卡详解程序员
bonding有0-6七种模式,常用的工作方式为0、1、6三种:
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 在本地系统发送出的请求,用其中之一的硬件地址覆盖从属设备的原地址。就像是在服务器上不同的人
使用不同的硬件地址一样
本次参考主库,采用 模式1
安装ifenslave,用作bonding
# apt-get install ifenslave
让系统开机自动加载模块bonding
# echo "bonding" /etc/modules
没有重启需要手动添加进linux 内核
# modprobe bonding
创建vip bond
# cd /etc/network/interfaces.d # vi bond0:1 # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The bond0:1 network interface auto bond0:1 iface bond0:1 inet static address 192.168.56.99 netmask 255.255.255.0 network 192.168.56.0 gateway 192.168.56.1
添加如下网卡配置文件
# vi /etc/network/interfaces # The primary network interface auto bond0 iface bond0 inet static address 192.168.56.100 netmask 255.255.255.0 gateway 192.168.56.1 bond-mode 1 bond-primary eth0 bond-slaves eth0 eth1 bond-miimon 100 bond-downdelay 400 bond-updelay 800 #post-up ifenslave bond0 eth0 eth1 #pre-down ifenslave -d bond0 eth0 eth1
重新启动网卡
# /etc/init.d/networking restart
配置网卡信息****/
# cd /etc/network/interfaces.d/ # ls -l 总用量 4 -rw-r--r-- 1 root root 137 6月 21 19:19 bond0:1 # cat bond0:1 auto bond0:1 iface bond0:1 inet static address 192.168.56.99 netmask 255.255.255.0 network 192.168.56.0 gateway 192.168.56.1
# cat interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* #*/ # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto bond0 iface bond0 inet static address 192.168.56.100 netmask 255.255.255.0 gateway 192.168.56.1 bond-mode 1 bond-primary eth0 bond-slaves eth0 eth1 bond-miimon 100 bond-downdelay 400 bond-updelay 800
bond0 Link encap:Ethernet HWaddr 08:00:27:7c:70:24 inet addr:192.168.56.100 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe7c:7024/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:100 errors:0 dropped:7 overruns:0 frame:0 TX packets:157 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:9967 (9.7 KiB) TX bytes:20953 (20.4 KiB) bond0:1 Link encap:Ethernet HWaddr 08:00:27:7c:70:24 inet addr:192.168.56.99 Bcast:192.168.56.255 Mask:255.255.255.0 UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 eth0 Link encap:Ethernet HWaddr 08:00:27:7c:70:24 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:93 errors:0 dropped:0 overruns:0 frame:0 TX packets:157 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:9511 (9.2 KiB) TX bytes:20953 (20.4 KiB) eth1 Link encap:Ethernet HWaddr 08:00:27:7c:70:24 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:7 errors:0 dropped:7 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:456 (456.0 B) TX bytes:0 (0.0 B) eth2 Link encap:Ethernet HWaddr 08:00:27:92:4c:bd inet addr:10.234.99.184 Bcast:10.234.99.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe92:4cbd/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:830 errors:0 dropped:0 overruns:0 frame:0 TX packets:82 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:70259 (68.6 KiB) TX bytes:10501 (10.2 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:83 errors:0 dropped:0 overruns:0 frame:0 TX packets:83 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:26004 (25.3 KiB) TX bytes:26004 (25.3 KiB)
删除vip
# ifquery --list bond0:1 bond0 eth2
# cd /etc/network/interfaces.d/ # mv ./bond0:1 ../ # /etc/init.d/networking restart
创建vip
# cd /etc/network/interfaces.d # vi bond0:1 auto bond0:1 iface bond0:1 inet static address 192.168.56.99 netmask 255.255.255.0 network 192.168.56.0 gateway 192.168.56.1 # ifquery --list bond0:1 bond0 eth2 # /etc/init.d/networking restart
1780.html
服务器部署程序员系统优化网站设置运维相关文章
- 今年老板要淘汰多少程序员才能止损呢?
- Scratch3.0——助力新进程序员理解程序(十二、画笔)
- Linux上安装redis详解程序员
- linux 去掉该文件下及子文件下所有文件的可执行权限详解程序员
- npm install 下载速度慢详解程序员
- for语句基本用法详解程序员
- IntelliJ IDEA添加过滤文件或目录详解程序员
- 定时任务之crontab命令详解程序员
- Linux-自疑惑详解程序员
- 织梦系统“当前位置”{dede:field.position}的修改方法详解程序员
- nagios安装详解程序员
- http statusCode(状态码)请求URL返回状态值的含义详解程序员
- Linux下更换jdk和配置环境变量详解程序员
- git pre-push hook详解程序员
- nginx截获客户端请求详解程序员
- Linux命令之chattr详解程序员
- 简单了解gzip、bzip2、xz详解程序员
- Linux chown命令详解程序员
- 原型模式 prototype 创建型 设计模式(七)详解程序员
- 在几年后,程序员的薪资会一直这么高么?
- 2015年开发程序员谨防八大心理疾病
- Java程序员的10道常见的XML面试问答题(XML术语详解)