Virtualbox bridging with vlans

Network related discussions (including general TCP/IP stuff, routing, etc).

Virtualbox bridging with vlans

Postby mjb » 14 Jun 2011, 11:51

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 [FILE]/usr/obj[/FILE]. Upgraded to VirtualBox 4.0.8 (including rebuilding/reloading the [FILE]kmod[/FILE]) with no change.

Host [FILE]rc.conf[/FILE]:
Code: Select all
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 [FILE]bge0.100[/FILE], the guest sends tagged packets (correct) but receives nothing ([FILE]tcpdump -ni em0[/FILE] 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 [FILE]bge0[/FILE] and [FILE]tcpdump -eni em0[/FILE] on the guest shows [FILE]vlan100[/FILE] traffic natively (incorrect - it should be [FILE].1q[/FILE] 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?
mjb
Junior Member
 
Posts: 13
Joined: 22 Oct 2009, 10:09
Location: Stoke, UK

Postby SirDice » 14 Jun 2011, 11:54

Your VLAN interfaces aren't set up correctly. Contrary to what you might think [file]ifconfig_bge0_100[/file] doesn't refer to VLAN100.
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16196
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby mjb » 14 Jun 2011, 12:06

I used to use [FILE]cloned_interfaces[/FILE] and
Code: Select all
ifconfig_vlan100="vlandev bge0 vlan 100 192.168.2.1/24"
but I recently re-read the [FILE]rc.conf[/FILE] man page.

" wrote:
Code: Select all
                 To create a vlan device named em0.101 on em0 with the vlan
                 tag 101 and the optional the IPv4 address 192.0.2.1/24:

                 vlans_em0="101"
                 ifconfig_em0_101="inet 192.0.2.1/24"



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.
mjb
Junior Member
 
Posts: 13
Joined: 22 Oct 2009, 10:09
Location: Stoke, UK

Postby overmind » 18 Jun 2011, 21:33

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.
overmind
Member
 
Posts: 318
Joined: 18 Nov 2008, 12:29

Postby mjb » 20 Jun 2011, 12:50

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 "[file]vlan100[/file]" 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 [file]vlan100[/file] frames before sending just them to the guest. Perhaps something in [file]if_vlan[/file] or [file]if_bge[/file] 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 [FILE]bge[/FILE] nic... :/
mjb
Junior Member
 
Posts: 13
Joined: 22 Oct 2009, 10:09
Location: Stoke, UK


Return to Networking

Who is online

Users browsing this forum: No registered users and 0 guests