[Resolved] Bridged networking with FreeBSD 11.1 / VirtualBox 5.2.12

Discussions related to using VirtualBox on other (unsupported) hosts like FreeBSD.
Post Reply
HubTou
Posts: 93
Joined: 24. Nov 2009, 11:01
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: FreeBSD, OpenSolaris, and several Linuxes

[Resolved] Bridged networking with FreeBSD 11.1 / VirtualBox 5.2.12

Post by HubTou »

Hello,

I have issues setting up bridged networking on a FreeBSD host with a FreeBSD guest, at my usual dedicated hosting provider.
So far I haven't succeeded communicating with the guest, though I can see what it displays with VNC.

The host setup is as follows:
- FreeBSD 11.1
- VirtualBox 5.2.12_1 (no x11)
- network card: igb0
- ip : x.x.27.43
- gw: x.x.27.1
- all the configuration described at https://www.freebsd.org/doc/en_US.ISO88 ... albox.html
- vm set up with --nictype1 virtio --nic1 bridged --bridgeadapter1 igb0 --macaddress1 yyyyyyyyyyyyyy
- I use the network card directly (igb0) and the virtual MAC address that the hosting provider is telling me to use

The guest setup is as follows:
- FreeBSD 11.1
- network card: vtnet0
- ip : x.x.37.63 (an "IP failover address" pointing to my host server)
- gw: 62.210.0.1 (a completely different gateway that the provider tells me to use with VMs)

What am I missing?
Do I need to put some routing info to direct the IP traffic to my VM failover IP / virtual MAC addresses?
Do I need to use a bridge+tap device like I did a few years back?

Best regards,
Last edited by HubTou on 20. Jun 2018, 23:29, edited 1 time in total.
HubTou
Posts: 93
Joined: 24. Nov 2009, 11:01
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: FreeBSD, OpenSolaris, and several Linuxes

Re: Bridged networking with FreeBSD 11.1 / VirtualBox 5.2.12

Post by HubTou »

Following the instructions at https://www.geeklan.co.uk/?p=2109 I tried the following config, but I'm still not able to communicate with or outside the guest:
  • In the host:
    • in /boot/loader.conf:

      Code: Select all

      vboxdrv_load="YES"
      if_bridge_load="YES"
      if_tap_load="YES"
      
    • in /etc/sysctl.conf:

      Code: Select all

      net.link.tap.up_on_open=1
      net.link.tap.user_open=1
      
    • in /etc/rc.conf:

      Code: Select all

      hostname="sd-133804.dedibox.fr"
      ifconfig_igb0="inet 195.154.27.43 netmask 0xffffff00"
      defaultrouter="195.154.27.1"
      
      cloned_interfaces="bridge0 tap0"
      ifconfig_tap0="ether 00:50:56:01:69:98"
      ifconfig_bridge0="addm igb0 addm tap0 up"
      
      vboxnet_enable="YES"
      
    • in the guest creation script:

      Code: Select all

      VBoxManage createvm --name MY_VM --ostype FreeBSD_64 --register
      VBoxManage modifyvm MY_VM --nictype1 virtio --nic1 bridged --bridgeadapter1 tap0 --macaddress1 005056016998
      
    • ifconfig command result:

      Code: Select all

      igb0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
              options=2400b9<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,VLAN_HWTSO,RXCSUM_IPV6>
              ether 18:66:da:99:c4:8f
              hwaddr 18:66:da:99:c4:8f
              inet 195.154.27.43 netmask 0xffffff00 broadcast 195.154.27.255
              nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
              media: Ethernet autoselect (1000baseT <full-duplex>)
              status: active
      bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
              ether 02:ae:57:84:1d:00
              nd6 options=9<PERFORMNUD,IFDISABLED>
              groups: bridge
              id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
              maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
              root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
              member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                      ifmaxaddr 0 port 7 priority 128 path cost 2000000
              member: igb0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                      ifmaxaddr 0 port 3 priority 128 path cost 2000000
      tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
              options=80000<LINKSTATE>
              ether 00:50:56:01:69:98
              hwaddr 00:bd:91:fc:f6:00
              nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
              media: Ethernet autoselect
              status: active
              groups: tap
              Opened by PID 7413
      
  • In the guest:
    • in /etc/rc.conf:

      Code: Select all

      hostname="MY_FQDN"
      ifconfig_vtnet0="inet 195.154.37.63 netmask 255.255.255.255"
      static_routes="gateway default"
      route_gateway="-host 195.154.27.1 -interface vtnet0"
      route_default="default 195.154.27.1"
      
Do you have other ideas?
HubTou
Posts: 93
Joined: 24. Nov 2009, 11:01
Primary OS: FreeBSD
VBox Version: OSE other
Guest OSses: FreeBSD, OpenSolaris, and several Linuxes

Re: Bridged networking with FreeBSD 11.1 / VirtualBox 5.2.12

Post by HubTou »

I finally succeeded.

My error was to try to set the virtual MAC address in the host network config, rather than letting VirtualBox define it.

Without the following line, everything works fine:

Code: Select all

ifconfig_tap0="ether 00:50:56:01:69:98"
Best regards,
socratis
Site Moderator
Posts: 27330
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: [Resolved] Bridged networking with FreeBSD 11.1 / VirtualBox 5.2.12

Post by socratis »

Thanks for the feedback, I hope that someone finds it helpful. And thank you for marking the topic as [Resolved]... ;)
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply