Networking
centos libvert vm網路無法獲取IP地址
我有一台執行 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 network-scripts $$# 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 network-scripts $$# brctl 顯示
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/
並插入該行NM_CONTROLLED=no
在物理和網橋介面中