我在 centOS 7 服务器上运行 KVM,它一直运行良好,但偶尔虚拟机的网络连接似乎会断开,直到主服务器重新启动后才能访问虚拟机。我有 2 个网络连接运行在服务器上。1 是主板上的主以太网,而另一个是辅助卡以太网连接。我使用这些说明将第二个连接配置为用于桥接网络
http://www.server-world.info/en/note?os=CentOS_7&p=kvm&f=1
任何想法或建议都将受到赞赏。
更新:
网络接口
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000
link/ether d4:ae:52:d3:46:5a brd ff:ff:ff:ff:ff:ff
3: p4p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP mode DEFAULT qlen 1000
link/ether 68:05:ca:1b:39:0a brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 68:05:ca:1b:39:0a brd ff:ff:ff:ff:ff:ff
5: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT
link/ether 52:54:00:73:66:ae brd ff:ff:ff:ff:ff:ff
6: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN mode DEFAULT qlen 500
link/ether 52:54:00:73:66:ae brd ff:ff:ff:ff:ff:ff
7: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UNKNOWN mode DEFAULT qlen 500
link/ether fe:54:00:8c:52:72 brd ff:ff:ff:ff:ff:ff
8: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UNKNOWN mode DEFAULT qlen 500
link/ether fe:54:00:09:d3:6b brd ff:ff:ff:ff:ff:ff
9: vnet2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UNKNOWN mode DEFAULT qlen 500
link/ether fe:54:00:48:f6:01 brd ff:ff:ff:ff:ff:ff
10: vnet3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UNKNOWN mode DEFAULT qlen 500
link/ether fe:54:00:4f:32:b9 brd ff:ff:ff:ff:ff:ff
17: vnet4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UNKNOWN mode DEFAULT qlen 500
link/ether fe:54:00:a8:8e:bf brd ff:ff:ff:ff:ff:ff
/etc/sysconfig/network-scripts/ifcfg-br0 如下所示
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
/em1 看起来像
HWADDR="D4:AE:52:D3:46:5A"
TYPE="Ethernet"
BOOTPROTO="dhcp"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="em1"
UUID="75be4f11-11ad-4ce2-a0d3-1601dfd2a7a6"
ONBOOT="yes"
辅助以太网卡 p4p1
HWADDR=68:05:CA:1B:39:0A
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=p4p1
UUID=2c82ff3a-04c5-4531-940b-48533a2edbf5
ONBOOT=yes
BRIDGE=br0
答案1
您可能遇到了 MAC 地址问题。网桥将始终采用其上任何设备的最高 MAC 地址,而虚拟机上的网卡具有较低的 MAC 地址。因此,每当虚拟机开启或离线时,网桥 MAC 地址都会发生变化,从而导致网络流量暂停。如果 eth0 的 MAC 地址是导致问题的原因,则解决方法是为您的虚拟机使用现有的 NATed virbr0,因为它不会与 eth0 桥接。但这有点违反直觉……
你的 /etc/network/interfaces 是什么样的?
如果该 MAC 地址不是您的问题,则该问题可能是 KVM 中的一个非常古老的错误;您可以在下面找到有关它的更多详细信息:
https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/997978