While running some test scenarios on my local development I encountered a bug with the bridged network interface on Virtual Box when using the wireless TP-LINK WN823N USB stick

Overview

One of my VMs has two network interfaces:

  1. Bridge interface to my en0:Ethernet
  2. Host only adapter which contains the static IP used to access the VM remotely

Since I have a problem with my wireless network card when I'm on the go I need to plug in an wireless USB stick to have internet connection, now if I have the VM running I need to change the interface to bridge the host intergace from en0:Ethernet to en5:USB WLAN

Problem

Theoratically I should be able to switch the bridged host interface and the VM should automaticaly get a new IP from the newly connected network. However, while running a test scenario to make sure that I wouldn't be left without internet access when being on the go, I found to my surprise that I had lost internet connectivity when bridging the en5:USB WLAN interface.

Initially I thought I needed to restart the interface on the VM to get the new settings from the DHCP server.

$: ifdown eth0 && ifup eht0
$: ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:3e:cb:64  
inet addr:10.0.0.253  
Bcast:10.0.0.255  
Mask:255.255.255.0  
inet6 addr: fd2b:f7e9:da9b:0:4c0e:b708:8908:c769/64 Scope:Global  
inet6 addr: fd2b:f7e9:da9b:0:a00:27ff:fe3e:cb64/64 Scope:Global  
inet6 addr: fe80::a00:27ff:fe3e:cb64/64 Scope:Link  
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1  
RX packets:839 errors:0 dropped:1 overruns:0 frame:0  
TX packets:504 errors:0 dropped:0 overruns:0 carrier:0  
collisions:0 txqueuelen:1000  
RX bytes:75805 (75.8 KB)  TX bytes:54480 (54.4 KB)  

The bridged interface was up and configured and I could ping the host IP address. However, the gateway was unreachable.
I first thought the default gateway wasn't configured, but after checking I confirmed all the routes were OK.

$: ip route
default via 10.0.0.1 dev eth0  
10.0.0.0/24 dev eth0  proto kernel  scope link  src 10.0.0.253  

So even though the interface was up and the default gateway was set I still couldn't ping it.

Update

Since I had the mac wireless card fixed I don't need to use the USB stick anymore so I'm not facing this issue directly.
I might still give it a try with the latest version of VirtuaBox to see if the problem is still present.
If anybody has any ideas on what could be the problem or how to go about debugging please leave a comment below.