当前位置: > Ubuntu >

Debian/Ubuntu下的网卡绑定-四网卡双bond

时间:2019-12-07 13:19来源:linux.it.net.cn 作者:IT
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


(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容