Debian/Ubuntu下的网卡绑定-四网卡双bond
2016-06-23 10:39
375 查看
1、安装软件
apt-get install ifenslave
2、编辑bonding模块开机自动加载文件
操作系统为Debian Wheezy时,修改/etc/modules文件,添加如下行:
bonding max_bonds=2 mode=6 miimon=100
操作系统为Debian Jessie时,新建/etc/modprobe.d/bonding.conf文件,添加如下行:
alias bond0 bonding
alias bond1 bonding
options bonding max_bonds=2 mode=6 miimon=100
3、修改/etc/network/interfaces文件,具体如下,IP可根据实际配置:
#############################################################
# 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 bond0
iface bond0 inet static
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
post-up ifenslave bond0 eth0 eth2
pre-down ifenslave -d bond0 eth0 eth2
auto bond1
iface bond1 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
post-up ifenslave bond1 eth1 eth3
pre-down ifenslave -d bond1 eth1 eth3
##############################################################
##虚拟网卡绑定模式##
虚拟网卡绑定虚拟网桥配置:
auto br0
iface br0 inet static
bridge_ports bond0
address 10.80.10.100
netmask 255.255.255.0
gateway 10.80.10.1
auto br1
iface br1 inet static
bridge_ports bond1
address 10.80.20.100
netmask 255.255.255.0
gateway 10.80.20.1
auto bond0
iface bond0 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
post-up ifenslave bond0 eth0 eth1
pre-down ifenslave -d bond0 eth0 eth1
auto bond1
iface bond1 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
post-up ifenslave bond0 eth2 eth3
pre-down ifenslave -d bond0 eth1 eth3
##############################################################
##以下几行可不添加,多网卡绑定模式下,物理网卡默认为混杂模式##
auto eth0
iface eth0 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
auto eth1
iface eth1 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
auto eth2
iface eth2 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
auto eth3
iface eth3 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
apt-get install ifenslave
2、编辑bonding模块开机自动加载文件
操作系统为Debian Wheezy时,修改/etc/modules文件,添加如下行:
bonding max_bonds=2 mode=6 miimon=100
操作系统为Debian Jessie时,新建/etc/modprobe.d/bonding.conf文件,添加如下行:
alias bond0 bonding
alias bond1 bonding
options bonding max_bonds=2 mode=6 miimon=100
3、修改/etc/network/interfaces文件,具体如下,IP可根据实际配置:
#############################################################
# 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 bond0
iface bond0 inet static
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
post-up ifenslave bond0 eth0 eth2
pre-down ifenslave -d bond0 eth0 eth2
auto bond1
iface bond1 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
post-up ifenslave bond1 eth1 eth3
pre-down ifenslave -d bond1 eth1 eth3
##############################################################
##虚拟网卡绑定模式##
虚拟网卡绑定虚拟网桥配置:
auto br0
iface br0 inet static
bridge_ports bond0
address 10.80.10.100
netmask 255.255.255.0
gateway 10.80.10.1
auto br1
iface br1 inet static
bridge_ports bond1
address 10.80.20.100
netmask 255.255.255.0
gateway 10.80.20.1
auto bond0
iface bond0 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
post-up ifenslave bond0 eth0 eth1
pre-down ifenslave -d bond0 eth0 eth1
auto bond1
iface bond1 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
post-up ifenslave bond0 eth2 eth3
pre-down ifenslave -d bond0 eth1 eth3
##############################################################
##以下几行可不添加,多网卡绑定模式下,物理网卡默认为混杂模式##
auto eth0
iface eth0 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
auto eth1
iface eth1 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
auto eth2
iface eth2 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
auto eth3
iface eth3 inet manual
up ip address add 0/0 dev $IFACE
up ip link set $IFACE up
down ip link set $IFACE down
相关文章推荐
- 软件测试-编写测试用例
- JUQERY 获取同名称的所有CHECKBOX ,获取已经选择的,并且jquery进行勾选!
- 表情包EmojiDialog的使用
- detect_indent_fft.hdev
- Mesos 1.0.x 版本新的功能或改动
- IOS 中的 _cmd 代表本方法的名称
- 学生选课系统数据库的设计与实现
- linux下源码编译安装mysql详解
- Rule12:复制对象时勿忘其每一个成分
- strcpy的使用--安全编程策略
- struts2 从一个action 跳转到另一个action的两种方法
- php中三种处理mysql数据库的扩展库(mysql、mysqli、pdo)的区别?
- IOS基础:深入理解Objective-c中@class的含义
- HDU——2473Junk-Mail Filter(并查集删点)
- centos7安装node方式整理记录~
- UIView与UIViewController
- /laravel IOC理解以及依赖注入
- Android智能指针浅析
- 三目运算符
- ToStringBuilder学习总结