The ability to use your wireless adapter with Virtualbox bridge mode is a problem that at least a few geeks on the web are asking, yet no one seems to have a convincing answer as to how to configure it.
The solution is in fact fairly simple, and also quite obvious too, once you understand the problem. However I’m still going to make you read an entire article to get the solution. Don’t worry, you will actually get some good insight into the troubleshooting process by reading it, so your time is well spent be reading the whole article
So the background is I’ve been setting up a penetration testing lab using Virtualbox. One of the virtual machines I have created is the firewall/router pfsense. In order for this to be able to connect other devices to the outside world, it needs to connect to my internet router.
Since I don’t have a wired connection to the router, nor do I want to be stuck in the same room as the router, I needed to be able to connect a bridged connection via my wifi.
However, when I tried this, I couldn’t get connectivity to happen. At first I was stumped by this. What was going on, And how could I fix it? First step, as always, a Google search. Unfortunately this didn’t work. As usually, clueless script kiddies on forums with no real idea but an inflated sense of self worth. No luck there.
OK, so where to next? Well why not find out if the bridged adapter was in fact sending out DHCP requests? Time to download an app called Wireshark. What this does for those don’t know is it capture every single network packet sent by your computer. Packet capture tools are invaluable when it comes to troubleshooting network problems. It allows you to check who is do what. Which device is sending, which is receiving, which is responding.
I implement a packet capture using wireshark and I find out that sure enough pfsense is sending out DHCP requests. Problem is, the internet router isn’t responding. Why is that I wonder? Well the obvious answer is that you need a password to connect to my wifi.
So the next question is, how can I get the bridged network to send the password to the internet router? Well I never did find a way. However, I did find a workaround. It helps to have a very indepth understanding of network architecture at times.
The bridged network adapter has its own MAC address (the hardware address of the card), although physically the bridged adapter is on the same card. The thing about network adapters is that they are not limited to a single IP address.
Also, a thing I wasn’t aware of is that the wifi authentication is in fact tied to the MAC address of the network card.
So once I figured this out, the solution at the outset I said it was fairly simple. Set the bridge network address to the mac address of the wireless adapter, then assign the Pfsense interface an ip address. And hey presto.. it works. Not a bad little bit of troubleshooting if I do say so myself.
For those who are newbies to IT, this image may help. This is the result of the ifconfig command in linux. The MAC address is highlighted. The same command can be used in Windows, although it is called ipconfig, and to see the MAC address, you have to use the command ipconfig /all.
As I have said, you take the highlighted address and put in in the virtual machine settings. Which are found under settings, which you can see in the next image. It’s a simple cut and paste, and you’re done.