
我的伺服器在 bond0 上有多個適配器。
我不確定(即使經過廣泛的研究)如何在沒有 IP 位址的情況下啟動 bond0 設備。我希望 VLAN 使用 bond0,但伺服器上沒有未標記的介面。
auto eth0
iface eth0 inet manual
bond-master bond0
auto eth1
iface eth1 inet manual
bond-master bond0
auto bond0
iface bond0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
bond-slaves none
bond-miimon 100
bond-mode 802.3ad
auto vlan50
iface vlan50 inet static
address 192.168.248.241
netmask 255.255.255.0
network 192.168.248.0
vlan-raw-device bond0
上面的配置有效,並且工作正常,除了 bond0 的位址不在標記的 VLAN 上。
開關設定正確。 VLAN 工作正常。伺服器是多個 VLAN 的成員,上面的配置已簡化,因為其餘配置與我的問題無關。
是的,我可以將虛擬地址放入 bond0 介面中,但這對我來說似乎不太乾淨。
我嘗試了以下操作:
https://wiki.debian.org/NetworkConfiguration#Bringing_up_an_interface_without_an_IP_address
但是,這不起作用,且 bond0 未配置,因此沒有網路連線。
作業系統:Ubuntu 14.04.2 LTS
答案1
我認為這樣的事情應該有效:
auto lo
iface lo inet loopback
auto bond0
iface bond0 inet static
pre-up ifconfig bond0 up
pre-up ifenslave bond0 eth0 || /bin/true
pre-up ifenslave bond0 eth1 || /bin/true
down ifenslave -d bond0 eth0 || /bin/true
down ifenslave -d bond0 eth1 || /bin/true
auto bond0.50
iface bond0.50 inet static
address 192.168.248.241
netmask 255.255.255.0
network 192.168.248.0
答案2
我不知道最新 Debian 版本的網路設定檔的詳細信息,但您應該按照以下步驟實現您想要的:
- 使用下列命令刪除基本介面 (bond0) IP
"ip addr flush dev bond0"
或"ifconfig bond0 ip 0.0.0.0"
- 使用下列指令插入一條 iptables 規則,丟棄來自未標記介面 (bond0) 的任何流量
"iptables -I INPUT 1 -i bond0 -j DROP"
無論如何,將交換器配置為丟棄來自/來自用於綁定的特定網路連接埠的所有未標記流量可能更容易。