启动时无链接的绑定接口

启动时无链接的绑定接口

服务器重启后,bond0由于它的一个从属以太网(eth2)没有链接而无法启动,我必须手动设置它:

ip link set dev eth2 up

服务器与 LAN 有一个绑定(带有 KVM 桥接器),drbd 与另一台服务器有另一个绑定:

    kvm + lan                       drbd
 ##############################################
 +------------------------+
 |           br0          |
 +------------------------+
 +---------------+ +------+   +---------------+
 |     bond0     | | vnet |   |     bond1     |
 +---------------+ +------+   +---------------+
 +------+ +------+            +------+ +------+
 | eth0 | | eth2 |            | eth1 | | eth3 |
 +------+ +------+            +------+ +------+

两个服务器都运行 Debian Wheezy,如下所示/etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# to the switch
auto bond0
iface bond0 inet manual
  slaves eth0 eth2
  bond-mode 802.3ad
  bond-miimon 100
  bond-downdelay 200
  bond-updelay 200

# bridge for KVM
auto br0
iface br0 inet static
  address 192.168.0.92
  netmask 255.255.255.0
  network 192.168.0.0
  broadcast 192.168.0.255
  gateway 192.168.0.101
  bridge_ports bond0
  bridge_stp off
  bridge_fd 0
  bridge_maxwait 0

# bond for drbd
auto bond1
iface bond1 inet static
  address 10.200.200.2
  netmask 255.255.255.0
  network 10.200.200.0
  broadcast 10.200.200.255
  slaves eth1 eth3
  bond-mode balance-rr
  bond-miimon 100
  bond-downdelay 200
  bond-updelay 200

另一台服务器启动正确,两者之间的唯一区别interfaces在于声明staticmanualbond0

iface bond0 inet static

我怎样才能防止这种情况再次发生?

添加ip link set接口是个好主意吗?

auto bond0
iface bond0 inet manual
    pre-up ip link set eth0 up
    pre-up ip link set eth2 up
    (...)

static和之间有什么区别manual?或者更好的是,我在哪里可以找到接口文件的完整文档?(man interfaces没有提到绑定、桥接、无线..选项)

答案1

只需简单添加:

auto eth0
iface eth0 inet manual
    up ip link set eth0 up
    down ip link set eth0 down

auto eth1
iface eth1 inet manual
    up ip link set eth1 up
    down ip link set eth1 down

auto eth2
iface eth2 inet manual
    up ip link set eth2 up
    down ip link set eth2 down

auto eth3
iface eth3 inet manual
    up ip link set eth3 up
    down ip link set eth3 down

static和之间的区别manual在于静态由参数配置(如地址、网络掩码、从属...),而手动由命令序列定义(pre-up、up、down、post-down)

相关内容