Bridge

啟動時沒有連結的綁定介面

  • April 11, 2014

伺服器重新啟動後,由於其中一個從屬乙太網 ( ) 沒有連結,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是聲明而static不是聲明manual``bond0

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不告訴綁定,橋接,無線..選項)

只需簡單地添加:

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)定義

引用自:https://serverfault.com/questions/587767