Networking between host and guest

I’m trying to get networking working between the host os and a guest os so that I can do some kernel mod development and if the kernel crashes on the guest os, at least it won’t be my entire machine.

Here’s where I run my stuff from.

$ l
total 729252
-rw-r--r-- 1 me me    262144 Apr  3 18:44 gentoo-i386.img
-rw-r--r-- 1 me me   4079040 Apr 12 21:56 kernel-2.6.31-gentoo-r6
-rw-r--r-- 1 me me 741791744 Apr  3 19:34 livecd-amd64-installer-2008.0.iso
-rwxrwxr-x 1 me me       283 May 14 21:27 start-kvm.sh

./start-kvm.sh looks like

$ cat ./start-kvm.sh
#!/bin/bash
#kvm -hda ./gentoo-i386.img -cdrom ./livecd-amd64-installer-2008.0.iso -boot d

kvm -net nic, macaddr=00:1a:4d:59:ef:04 -net tap, ifname=qtap0, script=no, downscript=no -hda ./gentoo-i386.img -cdrom ./livecd-amd64-installer-2008.0.iso -boot d -m 512

#qemu-system-x86_64 -hda ./gentoo-i386.img -cdrom ./livecd-amd64-installer-2008.0.iso -boot d -m 512 

Here’s ifconfig from the host OS …

$ ifconfig
br0       Link encap:Ethernet  HWaddr 7e:75:7e:b0:bd:14  
          inet addr:192.168.1.20  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::f09c:aeff:fe1b:f342/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:10433 (10.1 KiB)

eth0      Link encap:Ethernet  HWaddr 00:1a:4d:59:ef:04  
          inet addr:192.168.1.11  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21a:4dff:fe59:ef04/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6871298 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4423297 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1414717071 (1.3 GiB)  TX bytes:363443109 (346.6 MiB)
          Interrupt:28 Base address:0xe000 

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:27 errors:0 dropped:0 overruns:0 frame:0
          TX packets:27 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1810 (1.7 KiB)  TX bytes:1810 (1.7 KiB)

qtap0     Link encap:Ethernet  HWaddr 7e:75:7e:b0:bd:14  
          inet6 addr: fe80::7c75:7eff:feb0:bd14/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:27 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

And here’s ifconfig from my guest os after booting it.

# ifconfig
eth0	Link encap:Ethernet  HWaddr 00:1A:4D:59:EF:04
	inet addr:169.254.167.179  Bcast:169.254.255.255 Mask:255.255.0.0
	UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1
	RX packets:0 errors:0 dropped:0 overruns:0 frame:0
	TX packets:76 errors:0 dropped:0 overruns:0 carrier:0
	collisions:0 txqueuelen:1000
	RX bytes:0 (0.0 b)   TX bytes:17532 (17.1 Kb)
	Interrupt:11 Base address:0x6000
lo
	... (left out for brevity)

Any help much appreciated.