Ubuntu Guest as Gateway

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
ctf2009
Posts: 1
Joined: 28. Mar 2020, 04:06

Ubuntu Guest as Gateway

Post by ctf2009 »

Hi, Im looking for some help with a particular issue I have.

It's important to note that I am able to make this work when not using a VM.

Essentially, I am using a 2012 Mac Mini with Virtualbox 6.1.4 (I have also tried to get this working with an older version I had - 5.216 on a Macbook Air)

Im running a VM inside Virtualbox (Ubuntu 18.04) and this has OpenVPN Client installed. It connects to ExpressVPN and I am able to set this up without any issues at all and this works fine.

What I want to do however is allow this VM to act as a Gateway so other devices on my home network can use this VM to route their traffic through.

I have set up the VM using a Bridged Adapter, using en0 Airport as the interface so the VM is allocated an IP address by my home router. I can SSH to it without any problems, I can ping it with no issues, I can do everything I could possible want to .... except get it to work as a Gateway.

I have ensured IPV4 forwarding is enabled on the guest and have the IPTables forwarding rules in place but still no luck.

During my investigation, I decided to run a live Ubuntu directly on the Mac (Write the iso to a USB, reboot the mac and boot into Ubuntu). I repeated exactly the same process and it works without any problems.

I have also had this working flawlessly for a long time on a RaspberryPi without any issues. In fact the VM I am trying to make work is intending to replace the RPi.

In the case of both scenarios where it works, it's on bare metal. So by reasoning it looks like my issue is either around Virtualbox or with OS X. I don't believe that what I am trying to do here is really complicated. I thought that by using a Bridged Adapter it would greatly simply this, allowing other hosts on the network to simply provide the IP address of the VM as the gateway (like they do for the working scenarios)

I am a dev, not a networking expert so whilst I am familiar with aspects, I am by no means a networking expert. So any guidance as to my next steps would be really appreciated.

Thanks
okiuss
Posts: 61
Joined: 7. Nov 2016, 14:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: OSX,LINUX,WINXXX
Location: Austria

Re: Ubuntu Guest as Gateway

Post by okiuss »

Hi,
i have pretty much the same configuration, as you and it works fine for a long time.
When you say, that ip forwarding is enabled, did you activate masquerading/nat for the vpn adapter in the VM ?

OK
Post Reply