# Non-NAT VirtualBox networking options broken



## jnr (Oct 10, 2009)

Hi all, I'm trying to get bridged networking working in VirtualBox 3 from Ports on 8.0-RC1 amd64. I saw this similar thread, but I have the vboxnetflt kernel module (the other thread's solution) loaded to no effect.


```
[root@Emi#virtualbox]kldstat
Id Refs Address            Size     Name
 1   40 0xffffffff80100000 d20428   kernel
 2    1 0xffffffff80e21000 18f8f8   zfs.ko
 3    2 0xffffffff80fb1000 3808     opensolaris.ko
 4    1 0xffffffff80fb5000 23e78    snd_hda.ko
 5    2 0xffffffff80fd9000 75628    sound.ko
 6    1 0xffffffff8104f000 5278     atapicam.ko
 7    3 0xffffffff81055000 41e88    vboxdrv.ko
 8    2 0xffffffff81097000 6968     vboxnetflt.ko
 9    2 0xffffffff8109e000 14d28    netgraph.ko
10    1 0xffffffff810b3000 2658     vboxnetadp.ko
11    2 0xffffffff81223000 1c554    linux.ko
12    1 0xffffffff81240000 a8ca     fuse.ko
13    1 0xffffffff8124b000 3a03     linprocfs.ko
```

I'm also a member of the vboxusers group and have /proc mounted. VirtualBox detects my NIC re0 and shows it as available in the GUI, but when I select it for bridged networking and start a VM I get the following:


```
Failed to start the virtual machine Windows 7 Pro x64.
Failed to open/create the internal network 'HostInterfaceNetworking-re0' (VERR_SUPDRV_COMPONENT_NOT_FOUND).
Failed to attach the network LUN (VERR_SUPDRV_COMPONENT_NOT_FOUND).
Unknown error creating VM (VERR_SUPDRV_COMPONENT_NOT_FOUND).


Result Code: 
NS_ERROR_FAILURE (0x80004005)
Component: 
Console
Interface: 
IConsole {0a51994b-cbc6-4686-94eb-d4e4023280e2}
```

I tried running VBox as root and got the same result.

Having double-checked pkg-message I'm afraid I must be missing something very obvious. Any pointers in the right direction would be greatly appreciated.


----------



## terminus (Oct 12, 2009)

I have exacly the same issue with virtualbox 3.0.51.r22902_2 installed on FreeBSD 9-CURRENT@26092009 AMD64


----------



## jnr (Oct 13, 2009)

I just noticed the following in my dmesg output even though kldstat says the module is loaded:


```
module_register_init: MOD_LOAD (ng_vboxnetflt, 0xffffffff8109f580, 0xffffffff810992e0) error 22
```


----------



## jnr (Oct 13, 2009)

The modile_register_init error is still present after a deinstall, clean, and install of virtualbox. Here's my complete dmesg output in case it holds any clues for anyone:

http://pastebin.com/f510e3d31 (Offsite because of 10000 character limit)


----------



## terminus (Oct 19, 2009)

Recently they updated article about VirtualBox in wiki with:


> Bridged Networking
> load the modules vboxnetflt and vboxnetadp (in that order)
> select Bridged Adapter in the Network tab
> select your physical adapter to bridge to



This solution works for me. I'm starting this two modules with simple script that is placed in /usr/local/etc/rc.d/vboxbridgeup.sh

```
#!/bin/sh
kldload /boot/modules/vboxnetflt.ko
sleep 1
kldload /boot/modules/vboxnetadp.ko
```


----------



## jnr (Oct 19, 2009)

That works beautifully. Thanks!


----------



## LesJen (Dec 18, 2009)

I've just had the same error and fixed it. But I can't get networking to work. Static address is set but no connection. DHCP can't get an address.
Any suggestions?
Thanks


----------



## salam4ik (Dec 21, 2009)

*LesJen*, try to restart VirtualBox after set settings for vboxnet0 interface and DHCP server.


----------



## LesJen (Dec 21, 2009)

I've tried the solution suggested by Termius with a script in /etc/rc.d/
I get this when I start my machine.


```
WARNING: Ignoring old-style startup script /etc/rc.d/vboxbridgeup.sh
```

I'm on Freebsd 8.0-RELEASE-p1.


----------



## LesJen (Dec 21, 2009)

salam4ik said:
			
		

> *LesJen*, try to restart VirtualBox after set settings for vboxnet0 interface and DHCP server.



I changed the network card 1 to Intel. Then it started working 
Thanks


----------



## dougb@ (Dec 22, 2009)

*Please don't recommend old-style rc.d scripts*



			
				terminus said:
			
		

> vboxbridgeup.sh
> 
> ```
> #!/bin/sh
> ...



Please don't recommend the use of old-style rc.d scripts. They are currently not recognized in recent versions of FreeBSD, and soon will not be useful in any supported FreeBSD branch. 

You can find the information on how to create a new-style rc.d script here: http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/rc-scripts.html. You'll want to use the load_kld method which is provided by /etc/rc.subr. 

Also, you *should* be able to simply load the modules in /boot/loader.conf. If that doesn't work then that's an issue that should be reported to the freebsd-emulation@FreeBSD.org mailing list. 


hope this helps,

Doug


----------



## _martin (Feb 17, 2011)

I see this thread is little bit older and actually marked solved, but this solution does not work for me. 

I have the following setup:

```
vbox:(~)$ uname -rsm
FreeBSD 8.1-STABLE amd64
vbox:(~)$

vbox:(~)$ pkg_info |grep virtualbox
virtualbox-ose-3.2.12 A general-purpose full virtualizer for x86 hardware
virtualbox-ose-kmod-3.2.12_1 VirtualBox kernel module for FreeBSD
vbox:(~)$

vbox:(~)$ VBoxManage showvminfo vbbsd01 | grep ^NIC\ 1
NIC 1:           MAC: 080027D6D7D6, Attachment: Bridged Interface 'em0', Cable connected: on, 
   Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0
vbox:(~)$

vbox:(~)$ kldstat |grep vb
 5    2 0xffffffff81222000 258e     vboxnetflt.ko
 6    2 0xffffffff81225000 24a24    vboxdrv.ko
 9    1 0xffffffff81255000 cac      vboxnetadp.ko
vbox:(~)$
```

Where em0 is my egress interface, 192.0.2.200 is my VM's IP address and 192.0.2.1 is my GW (not really, just using them here instead of my public IPs).

Problem is when I start the VM and configure networking I see no traffic, can't ping GW, nothing. I triple checked the network configuration. When I use this network settings in jail, everything works just fine. 

I did use a tcpdump to check the traffic on a host while trying to reach the world from VM: 

`#  tcpdump -ni em0 -f arp`

```
21:16:01.380949 ARP, Request who-has 192.0.2.200 tell 192.0.2.1, length 46
21:16:01.381051 ARP, Reply 192.0.2.200 is-at 08:00:27:d6:d7:d6, length 28
```

Which is the MAC configured on NIC 1. There is no such MAC address assigned to any interface nor is seen with arp -an command on a host. 
Oddly enough, I can ping this IP address from a host. 

Question is: does anybody else use bridged networking like I have without a problem? I suspect maybe there is a problem on a switch side (CISCO ARP anti-poisoning feature maybe?) - I will contact my ISP to verify.


----------



## _martin (Feb 21, 2011)

Finally I had some time to set this in my LAB to check what's going on.

As all was working ok in the LAB, I have contacted my ISP to verify settings on their side. It is as I have previously suspected - security settings on a switch side (port security).
Settings provided in my first thread are good - all is working OK now (no tap interface needed).

There is one more /security/ issue now. As I will be using bridged egress interface, same traffic will be seen on all virtual interfaces bridged to this NIC. I see there is a VDE project which might solve this issue, though I'm now familiar with it (yet) and I'm not sure about the performance degradation using this method. 

I know, older thread .. maybe someday someone will google through this thread and might find this useful.


----------

