我有一个物理接口(eth0)和两个虚拟接口(eth0:1,eth0:2),两个虚拟接口都有公网 IP 地址。我想将这两个虚拟接口绑定到bond0
,如您所见/etc/network/interfaces
:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 144.yy.xx.124
netmask 255.255.255.224
network 144.yy.xx.96
broadcast 144.yy.xx.127
gateway 144.yy.xx.109
dns-nameservers 8.8.8.8 4.2.2.2 4.2.2.4
auto eth0:1
allow-bond0 eth0:1
iface eth0:1 inet static
address 148.aa.bb.197
netmask 255.255.255.248
bond-master bond0
bond-primary eth0:1
auto eth0:2
allow-bond0 eth0:2
iface eth0:2 inet static
address 148.cc.dd.198
netmask 255.255.255.248
bond-master bond0
auto bond0
iface bond0 inet static
address 10.31.1.5
netmask 255.255.255.0
network 10.31.1.0
gateway 10.31.1.254
bond-slaves none
bond_mode balance-rr
bond_miimon 100
bond_downdelay 200
bond_updelay 200
但是当尝试时sudo ifup bond0
,它返回:
Waiting for a slave to join bond0 (will timeout after 60s)
No slave joined bond0, continuing anyway
我还添加bonding
了/etc/modules
更新:我也尝试过这种配置/etc/网络/接口:http://paste.ubuntu.com/11980915/但它有同样的问题。
虚拟接口可以绑定接口吗?有什么问题?
答案1
要绑定两个虚拟接口eth0:1
并eth0:2
创建自动故障转移接口,请尝试以下操作:
打开终端,
按Ctrl++AltT
运行:
要启用绑定,您必须安装以下ifenslave
软件包:
sudo apt-get update
sudo apt-get install ifenslave
要配置它,您必须修改文件/etc/network/interfaces
:
sudo nano /etc/network/interfaces
在打开的文件中修改以下行:
auto bond0
iface bond0 inet static
address 10.31.1.5
netmask 255.255.255.0
network 10.31.1.0
gateway 10.31.1.254
slaves eth0:1 eth0:2
bond_mode active-backup
bond_miimon 100
bond_downdelay 200
bond_updelay 200
Ctrl+ O,保存文件。Ctrl+ X,关闭 nano。