PDA

View Full Version : How can VM access Internet through wireless


tsangcn
2007-10-31, 04:49 AM CDT
I have wireless network running in Fedora 7 x64. I have created a virtual machine with qemu-kvm. How can I configure the network so that the virtual machine can access internet through the wireless in ths host?

Thanks
C. N. Tsang

stevea
2007-10-31, 07:14 AM CDT
Actually I was a little surprised to see that a guest under qemu-kvm was able to access the host w/ no extra options!


qemu-kvm -boot d -cdrom ../depot/puppy-2.17-nolzma-seamonkey-fulldrivers.iso
Kicks off puppylinux from a boootable cd image, and it uses the user-mode sockets so the guest system
can dhcp an address like 10.0.2.16, but all the traffic is generated with your hosts IP address.

It only works for IP protocol (you cannot ping, but you can ssh or web-browse or ...).


virt-manager has a far more elaborate scheme, libvirtd creates a bridge, and a dnsmasq to serve & forward dns to the guests. Each guest gets a virtual lan interface which is attache to the bridge. The libvirtd also sets up ip forwarding and also iptables to traffic is recieved and sent for the bridge lan (192.168.122.x).

tsangcn
2007-11-02, 02:00 AM CDT
A bridge interface virbr0 is already created by Fedora installer and is assigned IP address 192.168.122.1. Actually, no extra configuration is needed. All I need is to pass the parameters -net nic,macaddrss=00:01:02:03:04:05,vlan=0 -net user,vlan=0 to qemu-kvm. The vm is assigned IP address 10.0.2.15, with default gateway 10.0.2.2 and DHCP server 10.0.2.2 and DNS server 10.0.2.3. Actualy it can just access Internet with web browser. Yes, it cannot ping.

Thanks
C. N.