我有一台运行 centos 6.2 的主机,它有 2 个使用 libvirt 的 VM。我一切正常,但后来我停电了,现在主机有连接,但是当它们出现并且没有网络连接时,VM 无法获得 IP。我正在尝试使用桥接网络适配器进行连接。
ifconfig 看起来像这样:
em1 Link encap:Ethernet HWaddr 84:2B:2B:58:4C:AD
inet addr:192.168.1.38 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::862b:2bff:fe58:4cad/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:328369 errors:0 dropped:2 overruns:0 frame:0
TX packets:228167 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:38114989 (36.3 MiB) TX bytes:267087066 (254.7 MiB)
em2 Link encap:Ethernet HWaddr 84:2B:2B:58:4C:AE
inet6 addr: fe80::862b:2bff:fe58:4cae/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:227338 errors:0 dropped:1178 overruns:0 frame:0
TX packets:31 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:29134179 (27.7 MiB) TX bytes:2731 (2.6 KiB)
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:65536 Metric:1
RX packets:193026 errors:0 dropped:0 overruns:0 frame:0
TX packets:193026 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:262903768 (250.7 MiB) TX bytes:262903768 (250.7 MiB)
vif1.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29 errors:0 dropped:0 overruns:0 frame:0
TX packets:275 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:5774 (5.6 KiB) TX bytes:78680 (76.8 KiB)
vif2.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:158 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:3662 (3.5 KiB) TX bytes:41564 (40.5 KiB)
virbr0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:49 errors:0 dropped:0 overruns:0 frame:0
TX packets:74 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:9436 (9.2 KiB) TX bytes:11432 (11.1 KiB)
em1 是我的主要有线连接,virbr0 是桥接连接。
[root@localhost 网络脚本]# ip 路由
default via 192.168.1.1 dev em1 proto static
192.168.1.0/24 dev em1 proto kernel scope link src 192.168.1.38 metric 1
[root@localhost 网络脚本]# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.feffffffffff no vif1.0
vif2.0
当我尝试通过我的网桥 ping 时,它失败了:
ping -Ivirbr0 192.168.1.1
PING 192.168.1.1 (192.168.1.1) from 192.168.1.38 virbr0: 56(84) bytes of data.
From 192.168.1.38 icmp_seq=1 Destination Host Unreachable
当我重新启动网络时,我收到此错误:
service network restart
Shutting down interface virbr0: [FAILED]
Shutting down interface em1: Device state: 3 (disconnected)
[ OK ]
Shutting down interface em2: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface Wired_connection_1: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/61
state: activated
Connection activated
[ OK ]
Bringing up interface em1: Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/64
state: activated
Connection activated
[ OK ]
Bringing up interface virbr0:
Determining IP information for virbr0...PING 192.168.1.1 (192.168.1.1) from 192.168.1.38 virbr0: 56(84) bytes of data.
--- 192.168.1.1 ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3005ms
pipe 4
failed.
[FAILED]
以前使用这台服务器时,我遇到了这个问题 -带有虚拟机父级的 centos 服务器无法连接,但 vms 工作正常并且能够在帮助下修复它,但也许我所做的一些修复在重启后引起了问题。
有什么建议么?
看来您有 NetworkManager 管理您的连接。在 RHEL6 上,使用 libvirt 运行桥接连接时应禁用 NetworkManager。尝试禁用它并重新启动系统。
如果您不能在系统范围内禁用它,您可以编辑下面的网络接口文件
/etc/sysconfig/network-scripts/
并插入该行在物理和网桥接口中