# /usr/sbin/brctl addbr br0# /usr/sbin/brctl addif br0 eth0# /sbin/ifconfig br0 192.168.3.30 netmask 255.255.255.0 broadcast 192.168.3.255 up# qemu-kvm -hda <disk-image1> -m 2048 -vga std -vnc :3 -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=/etc/qemu-ifup# qemu-kvm -hda <disk-image2> -m 2048 -vga std -vnc :4 -net nic,ifname=tap1,script=/etc/qemu-ifup# cat /etc/qemu-ifup#!/bin/shsudo /sbin/ifconfig 0.0.0.0 promisc upsudo /usr/sbin/brctl addif br0
配置主要有效.奇怪的是,我经常出现网络“暂停”.我与虚拟机的大多数交互都是通过ssh或Web浏览器进行的.通常情况下,特别是在空闲时间之后,我会在会话中输入内容或访问网页,但不会发生任何事情.最终,在10-15秒后,正常活动将恢复而不会出错.从死亡时间开始的ssh击键匆匆通过. Web请求似乎丢失了,但快速“重新加载页面”可以毫不拖延地获得结果.整个虚拟机继续运行,正如我通过观察到控制台的VNC会话所看到的那样.两位客人都是这样独立的.有时两者都会同时被冻结,但有时候一个人会正常工作而另一个人会被冻结.冻结时,主机或客人端的dmesg没有错误.
任何想法,解决方案,原因或进一步诊断?
(补充资料,7/27)
这是主机上’ifconfig -a’的输出:
hope 5$sudo ifconfig -abr0 link encap:Ethernet HWaddr 4A:F0:CA:32:F5:88 inet addr:192.168.3.30 Bcast:192.168.3.255 Mask:255.255.255.0 inet6 addr: fe80::7271:bcff:fea2:f4c4/64 Scope:link UP broADCAST RUNNING MulTICAST MTU:1500 Metric:1 RX packets:140947463 errors:0 dropped:0 overruns:0 frame:0 TX packets:66981660 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:0 RX bytes:192776331275 (183845.8 Mb) TX bytes:9469675717 (9030.9 Mb)br0:1 link encap:Ethernet HWaddr 4A:F0:CA:32:F5:88 inet addr:192.168.3.31 Bcast:192.168.3.255 Mask:255.255.255.0 UP broADCAST RUNNING MulTICAST MTU:1500 Metric:1br0:2 link encap:Ethernet HWaddr 4A:F0:CA:32:F5:88 inet addr:192.168.3.32 Bcast:192.168.3.255 Mask:255.255.255.0 UP broADCAST RUNNING MulTICAST MTU:1500 Metric:1eth0 link encap:Ethernet HWaddr 70:71:BC:A2:F4:C4 inet6 addr: fe80::7271:bcff:fea2:f4c4/64 Scope:link UP broADCAST RUNNING MulTICAST MTU:1500 Metric:1 RX packets:141848164 errors:0 dropped:0 overruns:0 frame:0 TX packets:68852413 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:1000 RX bytes:195831275369 (186759.2 Mb) TX bytes:9559920997 (9117.0 Mb) Interrupt:20 Memory:d0300000-d0320000 lo link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:27197534 errors:0 dropped:0 overruns:0 frame:0 TX packets:27197534 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:0 RX bytes:127242745992 (121348.1 Mb) TX bytes:127242745992 (121348.1 Mb)sit0 link encap:Unspec HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)tap0 link encap:Ethernet HWaddr 4A:F0:CA:32:F5:88 inet6 addr: fe80::48f0:caff:fe32:f588/64 Scope:link UP broADCAST RUNNING PROMISC MulTICAST MTU:1500 Metric:1 RX packets:397512 errors:0 dropped:0 overruns:0 frame:0 TX packets:668318 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:500 RX bytes:38045826 (36.2 Mb) TX bytes:750358170 (715.5 Mb)tap1 link encap:Ethernet HWaddr 56:92:5E:DE:93:67 inet6 addr: fe80::5492:5eff:fede:9367/64 Scope:link UP broADCAST RUNNING PROMISC MulTICAST MTU:1500 Metric:1 RX packets:25635 errors:0 dropped:0 overruns:0 frame:0 TX packets:88846 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:500 RX bytes:1999805 (1.9 Mb) TX bytes:17071986 (16.2 Mb)
主机上’brctl show’的输出:
hope 6$sudo brctl showbrIDge name brIDge ID STP enabled interfacesbr0 8000.4af0ca32f588 no eth0 tap0 tap1
来自一个guest虚拟机的’ifconfig -a’的输出:
guest1# ifconfig -aeth0 link encap:Ethernet HWaddr 52:54:00:12:34:56 inet addr:192.168.3.35 Bcast:192.168.3.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fe12:3456/64 Scope:link UP broADCAST RUNNING MulTICAST MTU:1500 Metric:1 RX packets:323061 errors:0 dropped:0 overruns:0 frame:0 TX packets:210150 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:1000 RX bytes:298541685 (284.7 MiB) TX bytes:25958962 (24.7 MiB) Interrupt:11 Base address:0x4000 lo link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:2305 errors:0 dropped:0 overruns:0 frame:0 TX packets:2305 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:0 RX bytes:481780 (470.4 KiB) TX bytes:481780 (470.4 KiB)sit0 link encap:IPv6-in-IPv4 NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
和另一位客人一样:
guest2# ifconfig -aeth0 link encap:Ethernet HWaddr 52:54:00:12:34:56 inet addr:192.168.3.36 Bcast:192.168.3.255 Mask:255.255.255.0 inet6 addr: fe80::5054:ff:fe12:3456/64 Scope:link UP broADCAST RUNNING MulTICAST MTU:1500 Metric:1 RX packets:62641 errors:0 dropped:0 overruns:0 frame:0 TX packets:25718 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:1000 RX bytes:10789140 (10.2 MiB) TX bytes:2012261 (1.9 MiB) Interrupt:11 Base address:0x4000 lo link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:182 errors:0 dropped:0 overruns:0 frame:0 TX packets:182 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:0 RX bytes:25798 (25.1 KiB) TX bytes:25798 (25.1 KiB)sit0 link encap:IPv6-in-IPv4 NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrIEr:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)解决方法 我终于找到了正确答案.
简短回答:MAC地址冲突.
答案很长:对于每个虚拟机,qemu都会创建一个虚拟网卡.它为此虚拟NIC分配MAC地址.默认情况下,它为每个NIC分配一个固定地址(52:54:00:12:34:56).如果您在同一主机上启动多个guest虚拟机,则它们都会获得相同的固定地址.您甚至可以在原始问题的ifconfig输出中看到这一点.当然,如果您将guest虚拟机连接在一起,这是一个问题,因为它与在同一网络上具有相同MAC地址的两台物理机相同. ARP做到最好,并在它们之间来回翻转,但是超时很长,给我的结果我看到了.
因此,解决方案是为每个guest虚拟机的-net参数添加“macaddr = …”标志,以使每个guest虚拟机具有唯一的MAC地址.例:
# qemu-kvm -hda <disk-image1> -m 2048 -vga std -vnc :3 -net nic,macaddr=52:54:00:00:00:03 -net tap,macaddr=52:54:00:00:00:04 -net tap,script=/etc/qemu-ifup
在我看来,qemu的默认行为应该更加明智,但我认为每个访客每次启动时都获得相同的MAC地址是相当重要的,无论他们的启动顺序如何.也许作者无法想到一种确保这一点的方法.
无论如何,如果您在同一网络(虚拟或其他)上运行多个guest虚拟机,请确保明确且唯一地设置MAC地址.否则,你会遇到同样的问题.
总结以上是内存溢出为你收集整理的linux – kvm来宾计算机上的随机临时网络冻结全部内容,希望文章能够帮你解决linux – kvm来宾计算机上的随机临时网络冻结所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)