Create a Split Tunnel in OpenVPN
To create a split tunnel in OpenVPN client and route specific websites and services outside of the VPN you have to edit your OpenVPN configuration file. In this example we will route Google.com outside of the VPN connection. Please follow these steps:
- Fetch a new configuration profile or open your existing OpenVPN configuration file (.ovpn) using a text editor.
- Locate the line starting with “redirect-gateway” and comment it out by adding a “#” at the beginning of the line. This line is responsible for redirecting all traffic through the VPNUK connection.
- Add the following lines to the configuration file:
route-nopull route google.com 255.255.255.255 net_gateway
The “route-nopull” line prevents OpenVPN from automatically adding routes to the routing table. The “route google.com” line specifies that traffic to Google.com should be routed through your default gateway instead of the VPNUK connection.
- Save the configuration file.
- Restart the OpenVPN to apply the changes.
With these changes, when you connect to the VPN, all traffic except for Google.com will be routed through the VPNUK connection. Traffic to Google.com will be sent directly through your regular internet connection outside of the VPN.