cf40 Virtualbox bridging with vlans - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Server & Networking > Networking

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

Reply
 
Thread Tools Display Modes
  #1  
Old June 14th, 2011, 12:51
mjb mjb is offline
Junior Member
 
Join Date: Oct 2009
Location: Stoke, UK
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Virtualbox bridging with vlans

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?

Last edited by DutchDaemon; June 20th, 2011 at 16:03. Reason: Proper formatting: http://forums.freebsd.org/showthread.php?t=8816
Reply With Quote
  #2  
Old June 14th, 2011, 12:54
SirDice's Avatar
SirDice SirDice is offline
Moderator
 
Join Date: Nov 2008
Location: Rotterdam, Netherlands
Posts: 13,852
Thanks: 48
Thanked 2,061 Times in 1,890 Posts
Default

Your VLAN interfaces aren't set up correctly. Contrary to what you might think ifconfig_bge0_100 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.
Reply With Quote
  #3  
Old June 14th, 2011, 13:06
mjb mjb is offline
Junior Member
 
Join Date: Oct 2009
Location: Stoke, UK
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

Quote:
Originally Posted by man 5 rc.conf
Code:
                 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.

Last edited by DutchDaemon; June 14th, 2011 at 13:36. Reason: Proper formatting: http://forums.freebsd.org/showthread.php?t=8816
Reply With Quote
  #4  
Old June 18th, 2011, 22:33
overmind overmind is offline
Member
 
Join Date: Nov 2008
Posts: 273
Thanks: 57
Thanked 20 Times in 14 Posts
Default

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.

Last edited by DutchDaemon; June 19th, 2011 at 01:33.
Reply With Quote
  #5  
Old June 20th, 2011, 13:50
mjb mjb is offline
Junior Member
 
Join Date: Oct 2009
Location: Stoke, UK
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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-.../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... :/

Last edited by DutchDaemon; June 20th, 2011 at 16:02.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solved] vlans over lagg vbelousov Networking 48 December 15th, 2010 01:12
[Solved] Bridging Problems UnixUser Networking 2 July 3rd, 2010 18:05
Pfsync + bridging stardot Networking 0 June 28th, 2010 20:54
FreeBSD 8 if_bridge does not pass 802.1q vlans tea Networking 6 March 11th, 2010 12:09
Filter on vlans with PF bloodhound Firewalls 2 March 19th, 2009 10:50


All times are GMT +1. The time now is 22:57.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0