KVM TAP Problem


#1

I am a fairly new KVM user trying to setup bridged networking for my KVM Guests. I have compiled support for KVM, TAP/TUN, 802.1q, and 802.1d. The bridge comes up during boot and is able to get an IP addr via DHCP without a problem. I create the tap interface manually:

tunctl -u root -t tap1
and add it to the bridge without a problem. However after starting up the guest VM:

kvm -cdrom cdimage.iso -usb -m 2G -net nic -net tap,ifname=tap1 &

ifconfig tap1 shows that tap1 is dropping packets. Upon futher inspection using the -net dump option the frames appear to be malformed (according to tcpdump).

Any ideas will be greatly appreciated. I have tested this problem against the lastest 30-r4 vanilla kernel without much luck as well. At this point I am convinced its an oversight on my part.

Thx!
Justin

My setup:
Linux CNOLAB-Attacker 2.6.28-hardened-r9 #33 SMP Tue Aug 11 14:14:39 EDT 2009 x86_64 Intel® Xeon® CPU E5520 @ 2.27GHz GenuineIntel GNU/Linux

br1 Link encap:Ethernet HWaddr 00:21:9b:8e:80:55
inet addr:10.2.3.128 Bcast:10.2.3.255 Mask:255.255.255.0
inet6 addr: fe80::221:9bff:fe8e:8055/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:66 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:24976 (24.3 KiB) TX bytes:2415 (2.3 KiB)

tap1 Link encap:Ethernet HWaddr a6:14:3a:af:b6:df
inet6 addr: fe80::a414:3aff:feaf:b6df/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:31 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:61 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:10788 (10.5 KiB) TX bytes:5516 (5.3 KiB)

bridge name bridge id STP enabled interfaces
br1 8000.00219b8e8055 no eth1
tap1
TCPDUMP OUTPUT:
14:47:55.935510 ff:ff:ff:ff:ff:ff > 00:00:00:00:00:00, ethertype Unknown (0x5254), length 348:
0x0000: 0012 3456 0800 4510 0148 0000 0000 8011 …4V…E…H…
0x0010: 3996 0000 0000 ffff ffff 0044 0043 0134 9…D.C.4
0x0020: 1725 0101 0600 7aaf 0f11 0000 0000 0000 .%…z…
0x0030: 0000 0000 0000 0000 0000 0000 0000 5254 …RT
0x0040: 0012 3456 0000 0000 0000 0000 0000 0000 …4V…
0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x00c0: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x00e0: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x00f0: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x0100: 0000 0000 0000 0000 0000 0000 0000 6382 …c.
0x0110: 5363 3501 010c 0262 7437 0b01 1c02 030f Sc5…bt7…
0x0120: 0677 0c2c 2f1a ff00 0000 0000 0000 0000 .w.,/…
0x0130: 0000 0000 0000 0000 0000 0000 0000 0000 …
0x0140: 0000 0000 0000 0000 0000 0000 0000 …


#2

Dear jwilder,

I did use bridge on KVM88 without troubles I used the net parameters above, but I didn’t have success with model=e1000 as I’ve just posted here.

-net nic,macaddr=51:52:53:54:55:56,model=rtl8139 -net tap,name=tap0,ifname=tap0,script=no,downscript=no

I didn’t used tunclt, as KVM automatically creates the tap device for me!

instead, after running kvm (qemu-system…) I run:

*brctl addbr br0
brctl addif br0 eth0
brctl addif br0 tap
*

It works like a charm!

I hope have helped.

Gabriel.