Because my wireless network adapter does not support bridging, it is really difficult to get the guest VM to connect to the open internet and have an IP address in the same network as the host. I am using Ubuntu 10.10, and the KVM version does not support vde, so it becomes even more difficult. How can I fix that?

@stribika's idea is great, but I would prefer to let my VMs connect to the same network as my host. e.g. my host network is, and I want my VM's network to be the same.


You should be able to use the user-mode networking stack. Start qemu like this:

qemu-system-x86_64 \
    -smp 1 -m 1024 \
    -net user,net=,host=,hostfwd=tcp: \
    -net nic \
    -cdrom systemrescuecd-x86-2.0.1.iso -boot d

The important options:

  • -net nic: Show a virtual network card for the guest
  • -net user: Make the qemu process on the host communicate over the real network just like any other process would
  • net= The subnet on the virtual network
  • host= The host IP address on the virtual network
  • hostfwd=tcp: The qemu process on the host listens for TCP connections from localhost on port 2222 and forwards them to the virtual network to (so you can ssh to your new virtual machine)

On the guest run

ifconfig eth0 up
ip route add default via dev eth0

Test SSH from host to guest

ssh -p 2222

and from guest to host


Test the internet reachability from the guest

wget google.com

The host process works like a NAT router. Only TCP and UDP traffic will work. In particular ping only works between the guest and the host you can't ping google.com (my usual network testing method). The advantage of this approach is that you don't even need root privileges.

  • hostfwd=tcp: 2222 -, "2222" or "22"?
    – David S.
    Feb 25 '11 at 2:06
  • another question. can i modify the hostfwd while the vm is running?
    – David S.
    Feb 25 '11 at 2:08
  • @davidshen84: Port 2222 on the host (so it can run its own sshd on 22) sent to port 22 on the guest.
    – stribika
    Feb 25 '11 at 5:43
  • @davidshen84: You can't modify it but you can use it multiple times to forward other services.
    – stribika
    Feb 25 '11 at 5:46

Catch-22: The host can't ssh to the guest when the entire purpose of connecting to the Internet is to install openssh-server on the guest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.