vmware workstation 内的centos 启用qemu-kvm 内的虚拟机网路问题

Bruce_Wu 发布于 2012/12/27 16:05
阅读 1K+
收藏 0

我于windows 7 上透过vmware workstation 建立了一个虚拟机,并安装上了centos 6.3 并于此系统内安装了qemu-kvm 虚拟化...bridge 网路也设定了eth0 -->bridge --> br0 ,至此一切都正常

网路状态

br0       Link encap:Ethernet  HWaddr 00:0C:29:DD:3E:55  
          inet addr:192.168.1.51  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fedd:3e55/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:127427 errors:0 dropped:0 overruns:0 frame:0
          TX packets:38075 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:11539664 (11.0 MiB)  TX bytes:8035222 (7.6 MiB)


eth0      Link encap:Ethernet  HWaddr 00:0C:29:DD:3E:55  
          inet6 addr: fe80::20c:29ff:fedd:3e55/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:248156 errors:0 dropped:0 overruns:0 frame:0
          TX packets:39980 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:66655984 (63.5 MiB)  TX bytes:8166083 (7.7 MiB)


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:9950 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9950 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1398588 (1.3 MiB)  TX bytes:1398588 (1.3 MiB)


virbr0    Link encap:Ethernet  HWaddr 52:54:00:B3:50:C8  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:92 errors:0 dropped:0 overruns:0 frame:0
          TX packets:82 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:16261 (15.8 KiB)  TX bytes:19117 (18.6 KiB)
	
  
  
  

  

  
  


而我透过 qemu-kvm 安装启用 虚拟机

/usr/libexec/qemu-kvm -hda /vm_disks/fedora17.disk.xm \
 -net nic,vlan=0,macaddr=00:16:3e:27🇨🇫3d \ 
 -net tap,vlan=0,script=/etc/kvm/qemu-ifup-br0 \
 -usb -boot c -m 1024 -vnc :20 -name fedora17 \
 -usbdevice tablet -uuid a2b0eb0b-40f5-2fec-524f-6f994d1648d0 \
 -smp 2 -monitor unix:/var/run/kvm/monitors/fedora17,server,nowait \
 -pidfile /var/run/kvm/monitors/fedora17 -daemonize &
.....etc


该fedora 虚拟机正常安装完成开启后,网路部份有异常

此时 kvm 主机的网路状态:

br0       Link encap:Ethernet  HWaddr 00:0C:29:DD:3E:55  
          inet addr:192.168.1.51  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fedd:3e55/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:207273 errors:0 dropped:0 overruns:0 frame:0
          TX packets:45695 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:17650488 (16.8 MiB)  TX bytes:9097262 (8.6 MiB)

eth0      Link encap:Ethernet  HWaddr 00:0C:29:DD:3E:55  
          inet6 addr: fe80::20c:29ff:fedd:3e55/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:413418 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47850 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:120670597 (115.0 MiB)  TX bytes:9248299 (8.8 MiB)

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:19856 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19856 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:2773032 (2.6 MiB)  TX bytes:2773032 (2.6 MiB)

tap0      Link encap:Ethernet  HWaddr FA:27:E2:C4:F5:27  
          inet6 addr: fe80::f827:e2ff:fec4:f527/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:242 errors:0 dropped:0 overruns:0 frame:0
          TX packets:132961 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:23409 (22.8 KiB)  TX bytes:11099926 (10.5 MiB)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:B3:50:C8  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:92 errors:0 dropped:0 overruns:0 frame:0
          TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:16261 (15.8 KiB)  TX bytes:20267 (19.7 KiB)


设定网路的部份设定DHCP 取得IP 位置,可以取得IP 位置(DHCP SERVER 位于网路Gateway 中192.168.1.254)

fedora 虚拟机的网路状态:


eth0      Link encap:Ethernet  HWaddr 00:16:3e:27🇨🇫3d  
          inet addr:192.168.1.54  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::222:4dff:fe4f:b369/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2686 errors:0 dropped:1 overruns:0 frame:0
          TX packets:589 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:403995 (394.5 Kb)  TX bytes:73691 (71.9 Kb)
          Interrupt:20 Memory:fa200000-fa220000 

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:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:985 (985.0 b)  TX bytes:985 (985.0 b)


从宿主机
1.ping 192.168.1.254 (可以通) [网通]
2.ping 192.168.1.54 (可以通)
3.ping 8.8.8.8 (可以通)
4.ping 192.168.1.15 (可以通) [windows 7 本机实体机]

从虚拟机
1.ping 192.168.1.254 timeout 不通 [网通]
2.ping 192.168.1.51 可以通
3.ping 8.8.8.8 timeout (不通)
4.ping 192.168.1.15 timeout (不通) [windows 7 本机实体机]

这问题很奇怪,可以透过DHCP 取得ip,但是网路却不通
如果改成将虚拟机改成nat 模式则可以透过宿主机连接出去,一切正常

不晓得这问题会是出在哪里呢?是否与两层 bridge 有关系呢?
vmware bridge 一次, centos 又bridge 一次..这里论应该也无关系,如果有关系虚拟机也无法透过dchp 取得IP 位置..有或许是本公司的路由有过滤呢?

不明白?请指教了.


加载中
返回顶部
顶部