On Mon, 28 Sep 2009 15:21:17 CDT Adam Vande More <amvandem...@gmail.com>  wrote:
> Am I doing something wrong here?
> 
> kldload if_tap if_bridge
> sysctl net.link.tap.user_open=1
> ifconfig tap0 create
> ifconfig bridge create
> ifconfig bridge0 addm tap0 addm em0
> 
> it# dhclient tap0
> DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 6
> DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 6
> DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 13
> DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 18
> DHCPDISCOVER on tap0 to 255.255.255.255 port 67 interval 18
> No DHCPOFFERS received.
> No working leases in persistent database - sleeping.
> 
> Although dhclient em0 works as expected.

This is behaving as it should.  Here is why.

Normal behavior of the tap device:
* What you send on if tap0 can be read on /dev/tap0. [if == interface]
* What you write on /dev/tap0 can be received on if tap0.

Your bridge setup:

bridge0
   |---- em0 -- physical network
   |---- tap0--/dev/tap0-virtual machine


For this setup the behavior is modified as follows:

* What you write to /dev/tap0 can be received on if tap0 + it
  will be sent out to the phys. net over em0 (but you can't
  receive this packets on if em0).

* What you send on if tap0 can be read on /dev/tap0 + it will
  be sent out to the phys. net over em0 (but you can't
  receive this packets on if em0).

* What you receive from a phys. device can be read on em0 +
  it will be sent out on tap0 (so you can read it from
  /dev/tap0) but you can't receive this packet on if tap0.

So you can see that DHCPDISCOVER pkt sent on tap0 will be
seen by the dhcp server on a physical net but you can't
receive the response on if tap0.

Now typically an emulator like qemu will connect its emulated
VM's interface (say re0) to /dev/tap0.  If the VM does
dhclient re0, it will get its ip address from the dhcp server
on the phys net.

If you want dhclient tap0 to work, run a dhcp server on the
VM!

_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to