在使用 eth0 和 eth0:1 的同時使用網橋 br0

在使用 eth0 和 eth0:1 的同時使用網橋 br0

我的情況:

我有一台運行 Ubuntu 16.04 的伺服器。

該伺服器有 2 個 IP 位址。

現在我想安裝 Brige 來為 VM (KVM) 提供網路存取權限,這樣我就不必為該連接埠轉送編寫無休止的 IP tabels 規則。

有什麼辦法嗎?

如果我進入一個橋,然後輸入“brctl show”,它不會顯示我重新建立的 br0。

答案1

將網橋的 ethX 設備設定為手動,/etc/network/interfaces並為 ethX 設備指派網橋連接埠。例如:

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet dhcp
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0
    bridge_maxwait 5

現在您可以br0在 KVM 或 virsh 中使用該設備。

sudo brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.5254003fa659       no              eth0

https://wiki.debian.org/BridgeNetworkConnections有關橋接設備的更多詳細資訊。

像往常一樣,您可以在任何裝置上新增多個 IP 位址,例如:

auto br0:1
iface br0:1 inet static
    address 192.168.1.2

相關內容