1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Virtualbox bridging with vlans

Discussion in 'Networking' started by mjb, Jun 14, 2011.

  1. mjb

    mjb New Member

    Messages:
    13
    Thanks Received:
    0
    Hi. I've got an odd situation here on 8.2-STABLE with virtualbox-ose-4.0.4 and a guest built from the same /usr/obj. Upgraded to VirtualBox 4.0.8 (including rebuilding/reloading the kmod) with no change.

    Host rc.conf:
    Code:
    vlans_bge0="100"
    ifconfig_bge0="inet 10.0.0.1/24"
    ifconfig_bge0_100="inet 192.168.0.1/24"
    ifconfig_bge0_101=...
    ...


    Everything works fine on the host. Bridge a VirtualBox guest though, and everything goes wrong. Bridged to bge0.100, the guest sends tagged packets (correct) but receives nothing (tcpdump -ni em0 on the guest shows nothing despite it being a noisy network) The host interface does go PROMISC as expected while the guest's running.

    Bridge the guest to bge0 and tcpdump -eni em0 on the guest shows vlan100 traffic natively (incorrect - it should be .1q encapsulated now) but no other vlans. Outgoing traffic from the guest is not tagged (correct)

    Even stranger is when I create a vlan interface on the guest, packets sent through that also come out untagged (should be double-tagged?), and there's no packets received on the guest's subinterface.

    Previously with VLANs out of the equation, Virtualbox worked perfectly.

    Any ideas?
     
  2. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,523
    Thanks Received:
    2,351
    Your VLAN interfaces aren't set up correctly. Contrary to what you might think ifconfig_bge0_100 doesn't refer to VLAN100.
     
  3. mjb

    mjb New Member

    Messages:
    13
    Thanks Received:
    0
    I used to use cloned_interfaces and
    Code:
    ifconfig_vlan100="vlandev bge0 vlan 100 192.168.2.1/24"
    but I recently re-read the rc.conf man page.

    Is the man page wrong about this new syntax? It appears to work fine for me - the host can interact with all the vlans perfectly.
     
  4. overmind

    overmind Member

    Messages:
    332
    Thanks Received:
    29
    If you try something at layer2 in VirtualBox and you are sure the setup is correct, then try your settings on a real machine and not in VirtualBox. I had lots of problems trying to simulate a bridge of two virtual box FreeBSD guests (on an Apple OSX Host). The configuration worked ok in real settings. I don't know if this happens for all VirtualBox hosts, mine was OSX.
     
  5. mjb

    mjb New Member

    Messages:
    13
    Thanks Received:
    0
    Looking into how VirtualBox does its bridging - via netgraph - it became apparent something on the FreeBSD-side was wrong. Netgraph uses a period for its path separator and was choking on the new-style interface naming.

    This was discussed a few months ago on the freebsd-net mailing list, but nothing seems to have made it to -STABLE: http://www.mail-archive.com/freebsd-net@freebsd.org/msg35895.html

    Reverting to an old-style configuration where I'm calling the vlan interfaces "vlan100" and so on appears to fix everything as far as bridging vlans to guests is concerned. Bridging (in VirtualBox) the parent NIC is still broken in the same strange way - something is untagging vlan100 frames before sending just them to the guest. Perhaps something in if_vlan or if_bge land is interfering with netgraph's access to the NIC?

    This would appear to mean it's impossible to use a trunked configuration in a guest on FreeBSD, at least where the host is using vlans on a bge nic... :/