Need Help Running DriverStation on VirtualBox on MacOS

Programming mentor here. I have a Mac and one of the frustrations I have is relying on student or team Windows laptops to run the Drivers Station code. I really don’t want to buy a second windows laptop and lug around two laptops to team meetings and events (may they both restart soon). So this week I invested some effort into setting up a a Windows 10 VirtualBox instance on my mac. I got all the software installed and running.

However, my challenge now is getting a network connection from the virtualbox running windows to the Roborio. I need to either route traffic to our 10.29.30.0/24 network (we’re team 2930 the Sonic Squirrels) through my Mac OR add a second network connection in Windows that routes 10.29.30.0/24 traffic to the Roborio and everything else out to my Mac. So far I haven’t gotten either to work. I did manage to get routing set up on the Mac. I could ping the roborio and hosts on the internet.

I have limited experience with VirtualBox, but from my reading it seems like the only network setting that has a chance of working is the “bridged” mode. (see https://www.virtualbox.org/manual/ch06.html#networkingmodes) I didn’t find any technical details of how this works, except some statement about how VirtualBox injects it’s outbound traffic into the host machine’s (my Mac’s) TCP stack using the host machines MAC address, but with the VirtualBox’s IP address. It seems like this bypasses the routing tables on my Macbook so I have not been able to redirect 10.29.30.0/24 traffic to the correct interface. Instead it just get’s dumped onto the default network interface.

Note: maybe Host-only networking mode might work? It all depends on how VirtualBox interfaces interact with the routing tables.

The other approach I tried was to use the USB cable direct connect to the Roborio and assign that USB device to the Windows VirtualBox. The USB connection (it behaves as a ethernet adapter) shows up on Windows, yet VSCode and the Driver station can’t find it. Looking at the Windows Device Manager, it shows the device as having a config error preventing it from being configured.

One silver lining is figuring out that I can manipulate the routing table on my Mac so that I can simultaneously connect to the Internet AND the roborio via a USB or ethernet connection. All I had to do was delete the “default” route that was sending all traffic to the robot’s network. This is super useful when you’re trying to google error messages and push code to the robot without having to constantly switching between wifi networks. Next I’m going to try this using an external USB Wifi adapter and join two wifi’s at once (the Internet and the robot).

My next desperate act will be to set up a raspberry pi as a router that is connected to the wifi and the robot. Maybe I can route 10.29.30.0/24 traffic through my mac to an external router?

And before you suggest dual booting my Mac, I’d rather not have to shutdown MacOS every time I want to run the driver station, Ior the other hassles of reinstalling the OS, lose my 50 open tabs, close email, etc.

Surely I’m not the only one?

I’ve used Bridge mode on both VirtualBox and Parallels without needing to configure anything else on Mac or Windows. I just set Bridge mode and select the network interface that the robot is connected to.

Edit: This is the configuration I use when giving presentations. I swipe back and forward between keynote and the driver station.

2 Likes

One more thing that I thought was worthy of its own reply:

I didn’t find any technical details of how this works, except some statement about how VirtualBox injects it’s outbound traffic into the host machine’s (my Mac’s) TCP stack using the host machines MAC address

This is kinda how it works but not really. It goes one layer deeper. The virtual machine generates its own MAC address that is not the host machine’s. To any other device on the network, it looks like an independent device.

Hmm. Clearly I need to “try harder.” Thanks for the feedback, this will save me from trying progressively more desperate setups.

@AustinShalit Any chance you can post a screen grab of the pertinent VirtualBox settings you use? How are you connecting to the robot? Wifi, ethernet, USB?

Any chance you can post a screen grab of the pertinent VirtualBox settings you use? How are you connecting to the robot? Wifi, ethernet, USB?

I can’t because I switched away from (read: uninstalled) VirtualBox and moved to Parallels. I’ve used all of the connection methods with both though.

Check your PMs.

1 Like

Thanks to @AustinShalit I got it working. He shared his network setup and I needed to set the network interface “Promiscuous Mode” setting to “Allow All.” VirtualBox defaults to “Allow VMs” which is more secure, but only allows traffic between VMs and the host machine and not from the outside world. The setting is hidden under the “Advanced” options for the network interface in the VirtualBox settings.

1 Like