[SATLUG] kvm networking

Bruce Dubbs bruce.dubbs at gmail.com
Mon Jan 23 17:04:31 CST 2012

I'm looking for help but this is pretty long.  Please trim any replies.

I am exploring kvm.  It is interesting technology, but I'm having a 
little problem figuring out how to set up networking.  I have been able 
to bring up a virtual system and install Fedora 16 on it.  I can then 
start that instance with:

qemu -hda vdisk.img -m 1G -net nic -net user

This provides network connectivity from the virtual system to the 

What I would like to do is get connectivity from the host to the client 
for an ssh connection.  The client has an ip address of and 
a gateway of

The host, on the other hand has no knowledge of any 10.x.x.x address.

Some documentation I've seen talks about using iptables/routing:

   sysctl -w net.ipv4.ip_forward=1
   route add -host <ip-of-client> dev <tap-device>

   route add -host <ip-of-host> dev <network-interface>
   route add default gw <ip-of-host>

I've tried this.  I have the following on the host:

#ls -l /dev/kv* /dev/net/*
crw-rw---- 1 root kvm  10, 232 Jan 23 13:37 /dev/kvm
crw-rw-rw- 1 root root 10, 200 Jan 23 13:37 /dev/net/tun

I have:

#cat /proc/sys/net/ipv4/ip_forward

#ls /proc/sys/net/ipv4/conf
all  default  eth0  lo  sit0  tap0  tunl0

#ifconfig tap0
tap0      Link encap:Ethernet  HWaddr 02:E2:D5:41:36:A3
           UP BROADCAST MULTICAST  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:500
           RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

#route -n
Kernel IP routing table
Destination     Gateway      Genmask         Flags Metric Ref Use Iface         UG    0      0   0   eth0 UH    0      0   0   tap0   U     0      0   0   eth0

And the following on the client: UH    0      0   0   tap0

However, there is is no direct connectivity between the host and client. 
  I suspect that it is due to the qemu options -net nic -net user, but I 
can't seem to figure out what to set.

Has anyone worked with this and figured it out?

   -- Bruce

More information about the SATLUG mailing list