6

I have to use Juniper VPN to connect to my company's VPN. Unfortunately my company doesn't allow connections directly from Ubuntu. So I have a minimal Windows 7 VM in VirtualBox and run Juniper from there where I can successfully connect to my company's corporate network.

The idea is to use my linux to work and use virtualbox only to route all traffic through the vpn. (Using the VPN on linux is not an option)

The problem is that I don't know how to route all traffic through the vpn on the guest. (HTTP, SSH, ...). I tried at port-forwarding but I don't know if it's the answer, maybe I should use virtualbox as admin to listen to < 1024 ports but it seems virtualbox is not listening to that.

2 Answers 2

6

I made it work today!

Setup is not that hard actually. I run Ubuntu 17.04 and have a Windows 7 VM.

Windows VM network setup:

adapter 1: host only (give a static ip: 192.168.56.11)
adapter 2: bridged   (got a DHCP ip from my router: 192.168.0.106)

Ubuntu setup:

wlp5s0: DHCP ip from router 192.168.0.105
vboxnet0: 192.168.56.1

I have a CheckPoint VPN connection on Windows VM.

enter image description here

Ethernet 2 = Host only
Ethernet 3 = Bridged
Ethernet 4 = VPN. This is the one you will need to share with Ethernet 2 (hostony)
  • Right-click 'Properties'
  • Sharing tab
  • Share with 'Host-only' network

Then on my Ubuntu box: (192.168.222.50 is just a host on the corporate net)

sudo route add 192.168.222.50 via 192.168.56.11

Or route an entire range

sudo route add 192.168.222.0/24 via 192.168.56.11

Also, don't forget to add your corporate DNS server to the /etc/resolv.conf!

2
  • 3
    After sharing VPN with Host-only, I have to set IP from 192.168.137.1 back to 192.168.56.11, and use ip route instead of route.
    – guest
    Jun 4, 2018 at 7:38
  • 1
    This worked for me :) If you're also following these instructions and it isn't working, remember setting the static IP of the host network in your Windows VM BEFORE sharing it with the VPN network. For some reason sharing the network will mess up your host interface IP. Also, I had to disable the Firewall. Of course, this isn't a good practice, but just test it to see if this is what is blocking you out.
    – AFP_555
    Jul 7, 2020 at 4:13
2

on the Windows 7 VM, ICS (Internet Connection Sharing) will probably work:

   ICS and VPN connections

   If you create a virtual private network (VPN) connection on your host 
   computer to a corporate network and then enable ICS on that 
   connection, all Internet traffic is routed to the corporate network 
   and all of the computers on your home network can access the 
   corporate network. If you don't enable ICS on the VPN connection, 
   other computers won't have access to the Internet or corporate 
   network while the VPN connection is active on the host computer.

With your setup (and in the above paragraph's context), the Windows 7 VM would be the host. On the Ubuntu system (which would be considered a "host" in a VM context), something like this could work:

Disable networking

sudo /etc/init.d/networking stop

Give the client a static IP address

sudo ip addr add 192.168.0.100/24 dev eth0

This IP address can be anything within the gateway's private IP range.

Configure routing

sudo ip route add default via 192.168.0.1

See https://help.ubuntu.com/community/Internet/ConnectionSharing for more info.

In the above scenario, Ubuntu would be the ICS client, Windows 7 the ICS server (or "gateway").

Also, are you sure that connecting to the VPN on Linux isn't an option? http://kb.juniper.net/InfoCenter/index?page=content&id=KB25230 seems to suggest that Juniper does have a Linux VPN client. And even if your company is using some kind of different proprietary software to get people connected to the VPN, chances are that software will run in Wine. Also https://serverfault.com/questions/363061/how-to-connect-to-a-juniper-vpn-from-linux might be relevant to this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .