Configure VPN for Ansys licence server
Background
As a fluid research student sometimes working from home, using Ansys software can sometimes be a frustration. My university provides an Ansys licence server, which is only accessible via the university IP address, which means one cannot use it outside the university’s local network unless tunnelling through a VPN. However, using VPN can cause pain on a home network, especially when you are downloading various items at the same time, as the bandwidth is much more restricted.
A good idea struck, can we use VPN only on specific IP addresses rather than passing all traffic through? This is proved possible and will be explained as follow on a PC running Windows Server 2022.
Process
We need to setup and configure Split Tunneling for this. It allows internet traffic accessing certain IP addresses to pass through the VPN while the rest goes through the default network.
- Enable Split Tunneling in VPN settings
- Network & Internet Settings > Change adapter options > right click your VPN and select Properties > Networking > IPv4 > Properties… > Advanced > and deselect Use default gateway on remote network (you can also additionally disable it for IPv6)
- After this setting, no traffic will go through the VPN until further settings (see below)
- Network & Internet Settings > Change adapter options > right click your VPN and select Properties > Networking > IPv4 > Properties… > Advanced > and deselect Use default gateway on remote network (you can also additionally disable it for IPv6)
- Configure Split Tunnelling in Terminal
- Run Terminal (or PowerShell) as administrator
- Execute
Add-VpnConnectionRoute -ConnectionName "<NAME OF VPN>" -DestinationPrefix "<IP ADDRESSES+MASK>" -PassThru
<NAME OF VPN>
is the name of your VPN connection<IP ADDRESSES+MASK>
is IP address and mask for the address you wish to pass through VPN, which in our case is the Ansys licence server.
For example, if I want the range 131.1.0.0-131.1.255.255, then use131.1.0.0/16
where/16
is shorthand for mask - To make my life even easier, I configure the VPN to automatically turn on when I open Ansys Workbench, by
Add-VpnConnectionTriggerApplication -ConnectionName "
<NAME OF VPN>
" -ApplicationID "C:\Program Files\ANSYS Inc\v201\Framework\bin\Win64\runwb2.exe" -PassThru
- Enjoy!
Further reading
- Commands for configurations:
https://docs.microsoft.com/en-us/powershell/module/vpnclient/?view=windowsserver2022-ps - Original articles I discover this method:
http://woshub.com/add-routes-after-connect-vpn-windows/
https://howgohome.wordpress.com/2010/12/08/vpn/ (in Chinese)