Networking

無法訪問 KVM 主機(網路橋)

  • October 28, 2014

自從我重新啟動執行 CentOS 7 的 KVM 主機後,我遇到了一個奇怪的問題。

我有一個執行良好的網橋,我可以訪問我的 KVM 主機和來賓,但是自從重新啟動後,我無法訪問主機。我可以 ping 它,並從虛擬機訪問它,但不能從我的物理網路訪問它,這意味著我無法從我的機器上使用 virt-manager 通過 ssh 訪問它。關閉防火牆沒有幫助。

以下是我的一些配置:

/etc/sysconfig/network-scripts/ifcg-enp2s0:

HWADDR="xx:xx:xx:xx:xx:xx"
TYPE="ethernet"
BOOTPROTO="none"
NAME="enp2s0"
ONBOOT="yes"
NM_CONTROLLED="no"
BRIDGE="br0"

/etc/sysconfig/network/ifcg-br0:

DEVICE="br0"
BOOTPROTO="static"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="bridge"
IPADDR=192.168.4.10
STP=on
NETMASK=255.255.255.0
DELAY="0"

/etc/sysconfig/網路:

GATEWAY=192.168.4.1
GATEWAYDEV="br0"

brctl 顯示:

br0     8000.90e6ba2e63fd   yes     enp2s0
                                   vnet0
                                   vnet1
virbr0  8000.000000000000   yes 

如果配置:

br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
   inet 192.168.4.10  netmask 255.255.255.0  broadcast 192.168.4.255
   inet6 fe80::92e6:baff:fe2e:63fd  prefixlen 64  scopeid 0x20<link>
   ether 90:e6:ba:2e:63:fd  txqueuelen 0  (Ethernet)
   RX packets 508  bytes 97333 (95.0 KiB)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 519  bytes 38241 (37.3 KiB)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
   inet6 fe80::92e6:baff:fe2e:63fd  prefixlen 64  scopeid 0x20<link>
   ether 90:e6:ba:2e:63:fd  txqueuelen 1000  (Ethernet)
   RX packets 1165  bytes 476382 (465.2 KiB)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 1393  bytes 131697 (128.6 KiB)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp3s5: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
   ether 00:26:5a:f0:3c:29  txqueuelen 1000  (Ethernet)
   RX packets 0  bytes 0 (0.0 B)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 0  bytes 0 (0.0 B)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
   inet 127.0.0.1  netmask 255.0.0.0
   inet6 ::1  prefixlen 128  scopeid 0x10<host>
   loop  txqueuelen 0  (Boucle locale)
   RX packets 6  bytes 352 (352.0 B)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 6  bytes 352 (352.0 B)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
   inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
   ether 6a:11:26:70:d7:3b  txqueuelen 0  (Ethernet)
   RX packets 0  bytes 0 (0.0 B)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 1  bytes 90 (90.0 B)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
   inet6 fe80::fc54:ff:fe4d:946c  prefixlen 64  scopeid 0x20<link>
   ether fe:54:00:4d:94:6c  txqueuelen 500  (Ethernet)
   RX packets 58  bytes 7174 (7.0 KiB)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 134  bytes 15618 (15.2 KiB)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
   inet6 fe80::fc54:ff:fe56:7ed4  prefixlen 64  scopeid 0x20<link>
   ether fe:54:00:56:7e:d4  txqueuelen 500  (Ethernet)
   RX packets 774  bytes 83968 (82.0 KiB)
   RX errors 0  dropped 0  overruns 0  frame 0
   TX packets 867  bytes 397448 (388.1 KiB)
   TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

謝謝你的幫助,我真的迷路了。

正如@dyasny 建議的那樣,這是一個 IP 衝突,所以問題解決了!

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