Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Sep 2009 06:14:02 +0100
From:      xorquewasp@googlemail.com
To:        freebsd-emulation@freebsd.org
Subject:   Problems with qemu networking on 7.2-RELEASE-amd64?
Message-ID:  <20090914051402.GB44046@logik.internal.network>

next in thread | raw e-mail | index | archive | help
Hello.

I'm having horrendous trouble getting qemu to do networking
on 7.2-RELEASE-amd64. I've not had any trouble on previous
versions of FreeBSD and qemu so this comes as a bit of a surprise.

The setup is a simple bridge between my main physical NIC (re0)
and a tap device (tap0). I use PF to filter on the bridge for
basic access control.

# ifconfig bridge0 create
# ifconfig tap0 create
# ifconfig bridge0 addm tap0
# ifconfig bridge0 addm re0

# chmod 660 /dev/tap0
# chown root:devel /dev/tap0

# sysctl net.link.tap.up_on_open=1
# sysctl net.link.tap.user_open=1

$ cat if-up
#!/bin/sh

info()
{
  echo "if-up: info: $1" 1>&2
}

info "bringing up $1"
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
exit 0

$ ifconfig bridge0
bridge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
  ether de:38:3c:f6:8a:a9
  id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
  maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200
  root id 00:00:00:00:00:00 priority 0 ifcost 0 port 0
  member: re0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
          ifmaxaddr 0 port 1 priority 128 path cost 200000
  member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
          ifmaxaddr 0 port 9 priority 128 path cost 2000000

$ ifconfig re0
re0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
  options=3898<VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
  ether 00:e0:4d:b3:5b:bd
  inet 10.1.3.1 netmask 0xffff0000 broadcast 10.1.255.255
  inet 10.1.3.2 netmask 0xffff0000 broadcast 10.1.255.255
  inet 10.1.3.3 netmask 0xffff0000 broadcast 10.1.255.255
  inet 10.1.3.4 netmask 0xffff0000 broadcast 10.1.255.255
  inet 10.1.3.5 netmask 0xffff0000 broadcast 10.1.255.255
  inet 10.1.3.6 netmask 0xffff0000 broadcast 10.1.255.255
  inet 10.1.3.7 netmask 0xffff0000 broadcast 10.1.255.255
  inet 10.1.3.8 netmask 0xffff0000 broadcast 10.1.255.255
  inet 10.1.3.9 netmask 0xffff0000 broadcast 10.1.255.255
  inet 10.1.3.10 netmask 0xffff0000 broadcast 10.1.255.255
  inet 10.1.3.11 netmask 0xffff0000 broadcast 10.1.255.255
  media: Ethernet autoselect (100baseTX <full-duplex>)
  status: active

$ qemu -snapshot -hda image -net nic -net tap,ifname=tap0,script=if-up

$ ifconfig tap0
tap0: flags=28943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST,PPROMISC> metric 0 mtu 1500
  ether 00:bd:bd:41:18:00
  inet 0.0.0.0 netmask 0xff000000 broadcast 0.255.255.255
  Opened by PID 21860

At this point, the guest in the qemu VM has the correct TCP/IP
settings:

  host: 10.1.3.12
  mask: 255.255.0.0
  dns:  10.2.1.7
  gate: 10.1.0.1

The ability for various guests to see the network interface is varied.

NetBSD 5.0.1 x86 sees no network interface at all (nothing in dmesg).

OpenBSD 4.5 x86 sees a network interface but at some point during boot, it'll
state something along the lines of "ne3: device timeout" and networking
doesn't work.

Windows XP x86 seems to be able to see a network interface and can
apparently send outgoing packets for DNS resolution but appears to
never receive any data in return.

NetBSD 5.0.1 SPARC can see an interface and can apparently send packets
and not receive. I've intermittently been able to connect in via SSH,
however.

Currently, as I write, the NetBSD SPARC guest can neither send nor
receive any data on the network interface (watching the bridge, tap
and pflog devices shows no connections being made).

Is anyone else having trouble?

xw

PS: Please CC as I'm not subscribed.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090914051402.GB44046>