Ubuntu – How to whitelist / blacklist certain urls not to use VPN connection

19.10network-managernetworkingopenvpnvpn

Sidenote: I turns out that our OpenVPN server is indeed setup for split tunneling, but our clients are pushing their own gateways:

redirect-gateway def1 bypass-dhcp bypass-dns

This was done as a workaround to access some internal services that are otherwise unreachable from the outside world. A more proper question would be: What is a proper way to access vpn-internal services without pushing a gateway that would route the entire traffic through the VPN, though I think this is rather a different question on its own.


I'm in homeoffice and while I have set up a stable VPN connection through the Network Manager, its speed is very limited. I have a 1 GBit connection at home, while the VPN connection at the moment only offers 10 MBit.

While certain services have to go through VPN connection, most of the traffic could bypass it just fine as all the VPN would do is to only slow things down. (I'm looking esp. at public data-intensive services like downloading images from the official docker hub or npm registry. Yet just for the sake of setting it up, let's take a service like fast.com.)

How can I whitelist certain websites to make use of the VPN connection or blacklist other sites not to use the VPN connection?

Best Answer

Discuss it with the people who set up VPN for you.

This is commonly known as split routing, where the VPN tunnel will be used for resources that is inside the corporate network, whilst default gateway will be used for the rest. This is usually easier than filtering by service. Commonly, the corporation will have some kind of internal plan over the network that makes it easy to provide split routing.

You should check if it's permitted in your organization. Not all organizations allows split routing, because they for instance want to do data loss prevention on your traffic.