我這裡有兩台伺服器,一台是 Qemu VM 主機,另一台是某種儲存盒。
它們是 hetzner 機器,我透過 vSwitch 連接它們。
Server1 vSwitch 介面:
3: local@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 10:7b:44:b1:5b:7d brd ff:ff:ff:ff:ff:ff
inet 192.168.100.1/24 brd 192.168.100.255 scope global local
valid_lft forever preferred_lft forever
Server1(虛擬機器主機)ip 路由:
default via <redacted-public-ip> dev eth0 proto static metric 100
<redacted-public-ip> dev eth0 proto static scope link metric 100
192.168.10.0/24 dev virbr0 proto kernel scope link src 192.168.10.254 metric 425 <-- virbr0 network
192.168.10.253 via 192.168.100.2 dev local <-- srv02 IP to fit in virbr0 net space
Server2 vSwitch介面:
3: local@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1400 qdisc noqueue state UP group default qlen 1000
link/ether 08:60:6e:44:d6:2a brd ff:ff:ff:ff:ff:ff
inet 192.168.100.2/24 brd 192.168.100.255 scope global local
valid_lft forever preferred_lft forever
inet 192.168.10.253/24 brd 192.168.10.255 scope global local
valid_lft forever preferred_lft forever
Server2 ip 路由:
default via <redacted-public-ip> dev eth0 proto static metric 100
<redacted-public-ip> dev eth0 proto static scope link metric 100
192.168.10.0/24 dev local proto kernel scope link src 192.168.10.253 <-- to access virbr0 via vSwitch
我猜我的路由設定正確 - 因為在防火牆服務關閉的情況下一切正常。
但是,如果我打開它,問題就會開始。
這些是 Server1 上的防火牆區域(當我停用防火牆時,一切正常)
libvirt (active)
target: ACCEPT
icmp-block-inversion: no
interfaces: virbr0
sources:
services: dhcp dhcpv6 dns ssh tftp
ports:
protocols: icmp ipv6-icmp
forward: no
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
rule priority="32767" reject
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0 local
sources:
services: cockpit dhcpv6-client ssh
ports:
protocols:
forward: no
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
我嘗試同時打開其中每一個的偽裝,但沒有成功。我正在透過從 Server2 到 virbr0 上的虛擬機之一的簡單 ping 來「測試」這一點
我在這裡缺少什麼明顯的東西嗎?
謝謝大家。
答案1
我已經在 QEMU 主機上使用以下兩條規則成功解決了這個問題
firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -o local -i virbr0 -j ACCEPT
firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -o virbr0 -i local -j ACCEPT