MacOS – How to Mimic Location of Slave VPN for Primary VPN

macosNetworkvpn

I would like to mimic the location of my primary VPN by the second VPN ("slave").
My mobile internet and data comes from Finland because it is cheap. I need to connect to my school's VPN server in Sweden. My school allows only connections to their server from Sweden with password+username (no certificates).
They have a firewall which blocks connections coming from outside of Sweden.

  1. Internet is gained with a mobile-connection of Telia-Sonera of Finland.
  2. First VPN connection allows access to institutional materials … but it requires local IP is in Sweden. I give them my username+password but they have extra security with local IP.
  3. Second VPN ("Slave") is required to change local IP from Finland to Sweden, but current VPN providers give only ppp0, no dynamic IP and no split tunnelling.
    • (2-3) multiples because there are multiple institutions

I connect to NordVPN Swedish VPN server.
However, connecting now to the school VPN server is unsuccessful, and the connection is rejected.
NordVPN's answers about having multiple VPN connections at the same time, which I do not believe because I think they are talking about their NordVPN application and because their technical proficiency of the customer service has been low

Unfortunately, it is not possible to have multiple VPN connections
active on same computer at the same time.
– –
No, you can not change the subnet details assigned for you.
– –
NordVPN routes your entire internet traffic through VPN, thus the only option for two VPN connections is to set up one VPN connection on a virtual machine.
– –
No we do not support split tunneling.

but I am ready to change my VPN provider if it is needed for the task. I am not sure if you can make split tunnelling yourself.
Based on the thread FAQ on OpenVPN, it is possible to have multiple VPN connections active at the same time

Make sure each TUN/TAP adapter has a unique, non-overlapping subnet
using server, server-bridge, or ifconfig.

Unsuccessful attempts to gain access to split tunnelling

  1. VPN – Tor (NordVPN Tor Sweden). Daniel proposal. This does not work; uni connection is rejected.

System

  1. My NordVPN connection works with their NordVPN App found somewhere on NordVPN web server.
  2. My VPN connection to my school does not work with my NordVPN connection because of the firewall and problem having two VPN connections with the "mass market VPN GUI".

OS X Configuration

OS X System Preferences > Network > (+) > VPN > VPN Type PPTP to connection to school server.

  • Configuration: Default
  • Server address: lorem.sweden.sv % or Estonia, Latvia, Norway; just some country other than Finland
  • Account name: my user-ID
  • Encryption: Automatic (128 bit or 40 bit)

When connecting only to my university's VPN in Sweden, things work

enter image description here

If my local network is not in Sweden, connection is not accepted. I should take another VPN connection to Sweden with NordVPN.
However, I cannot keep two VPN connections active with two separate VPN programs: OSX VPN GUI + NordVPN "mass market VPN GUI".

My example ifconfig (do not worry if Swedish IP addresses are Estonia/Latvian/Norwegian/…/they are just different than Finland which is ok)

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=3<RXCSUM,TXCSUM>
    inet6 ::1 prefixlen 128 
    inet 127.0.0.1 netmask 0xff000000 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=1<PERFORMNUD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether b8:e8:56:07:a7:68 
    inet6 fe80::bae8:56ff:fe07:a768%en0 prefixlen 64 scopeid 0x4 
    inet 192.168.1.144 netmask 0xffffff00 broadcast 192.168.1.255
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: active
en1: flags=963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX> mtu 1500
    options=60<TSO4,TSO6>
    ether 32:00:1f:d8:20:00 
    media: autoselect <full-duplex>
    status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
    ether 0a:e8:56:07:a7:68 
    media: autoselect
    status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
    ether de:1b:d1:61:05:9e 
    inet6 fe80::dc1b:d1ff:fe61:59e%awdl0 prefixlen 64 scopeid 0x7 
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: active
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=63<RXCSUM,TXCSUM,TSO4,TSO6>
    ether ba:e8:56:70:12:00 
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x2
    member: en1 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 5 priority 0 path cost 0
    nd6 options=1<PERFORMNUD>
    media: <unknown type>
    status: inactive
ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1444
    inet6 fe80::bae8:56ff:fe07:a768%ppp0 prefixlen 64 scopeid 0x9 
    inet 10.250.250.88 --> 10.250.250.1 netmask 0xff000000 
    nd6 options=1<PERFORMNUD>

OS X El-Capitan Tunnelblick for both VPN connections?

Here is Tunnelblick's demo file config.ovpn without any changes; which you install by just drag-and-drop it to Tunnelblick's GUI menubar

##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server.     #
#                                            #
# This configuration can be used by multiple #
# clients, however each client should have   #
# its own cert and key files.                #
#                                            #
# On Windows, you might want to rename this  #
# file so it has a .ovpn extension           #
##############################################

# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client

# Use the same setting as you are using on
# the server.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap
dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel
# if you have more than one.  On XP SP2,
# you may need to disable the firewall
# for the TAP adapter.
;dev-node MyTap

# Are we connecting to a TCP or
# UDP server?  Use the same setting as
# on the server.
;proto tcp
proto udp

# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
remote my-server-1 1194
;remote my-server-2 1194

# Choose a random host from the remote
# list for load-balancing.  Otherwise
# try hosts in the order specified.
;remote-random

# Keep trying indefinitely to resolve the
# host name of the OpenVPN server.  Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
resolv-retry infinite

# Most clients don't need to bind to
# a specific local port number.
nobind

# Downgrade privileges after initialization (non-Windows only)
;user nobody
;group nobody

# Try to preserve some state across restarts.
persist-key
persist-tun

# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
# server, put the proxy server/IP and
# port number here.  See the man page
# if your proxy server requires
# authentication.
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]

# Wireless networks often produce a lot
# of duplicate packets.  Set this flag
# to silence duplicate packet warnings.
;mute-replay-warnings

# SSL/TLS parms.
# See the server config file for more
# description.  It's best to use
# a separate .crt/.key file pair
# for each client.  A single ca
# file can be used for all clients.
ca ca.crt
cert client.crt
key client.key

# Verify server certificate by checking
# that the certicate has the nsCertType
# field set to "server".  This is an
# important precaution to protect against
# a potential attack discussed here:
#  http://openvpn.net/howto.html#mitm
#
# To use this feature, you will need to generate
# your server certificates with the nsCertType
# field set to "server".  The build-key-server
# script in the easy-rsa folder will do this.
;ns-cert-type server

# If a tls-auth key is used on the server
# then every client must also have the key.
;tls-auth ta.key 1

# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
;cipher x

# Enable compression on the VPN link.
# Don't enable this unless it is also
# enabled in the server config file.
comp-lzo

# Set log file verbosity.
verb 3

# Silence repeating messages
;mute 20

Unix-way approach

Unix way approach is discussed here about the topic in How to Do Split Tunnelling with Slave ppp0 VPN + 2nd VPN?


How to Mimic Location of Slave VPN for Primary VPN?

Best Answer

After some extensive testing the only solution I got to work is a VM setup.

  1. Setup the NordVPN GUI client or Tunnelblick and connect to the Swedish VPN-server (preferably with an openvpn connection). Often VPN-providers use a NAT firewall - which means you are first connected to an internal network. You can get the network with ifconfig. In your above example that's a 10.0.0.0/8 network (10.250.250.88 --> 10.250.250.1 netmask 0xff000000). Check that all network traffic is sent to the VPN provider.
  2. Download and install a type-2 hypervisor like VirtualBox or Parallels Desktop
  3. Set up the NAT network of the hypervisor with different network settings than the internal network of the VPN provider, your own network and your school's network.

    Examples:

    Parallels:

    Parallels Shared newtwork

    VirtualBox:

    VirtualBox Shared newtwork

    Possible networks may be private networks in 172.16.0.0/12 (e.g. 172.18.8.0/24)

  4. Create a new VM hull and attach it to this NAT network.
  5. Install a familiar OS (e.g OS X 10.9-10.11) in this VM
  6. Set up a VPN connection in the VM to your school's VPN server in Sweden in the VPN in System Preferences -> Network, shut down the VM and quit the hypervisor.
  7. Connect to NordVPN in the non-virtualized OS
  8. Start the VM
  9. Connect to the school's VPN server in the virtualized OS

tested with a Parallels VM (OS X 10.11) and a private VPN server (Cisco IPSec) and an iMac (OS X 10.9) and VyprVPN (OpenVPN)