I used the Ubuntu GUI to created a VPN connection to a foreign server
This is the wrong way of doing it. A VPS should be managed through SSH and configured properly. Network Manager is not suitable for this because it does not allow for split tunneling. It's an all or nothing approach.
How to fix the VPN
How could I access my server via FTP then?
Disable the VPN in Network Manager. Instead, set up a VPN by routing only traffic to the website and its subdomains. I do it on my VPS as well.
- Pick up the OpenVPN configuration file provided by your provider and copy its contents to
/etc/openvpn/openvpn.conf
Add this directive to the bottom of the file:
# No automatic routes
route-noexec
Save the file and issue sudo service openvpn restart
This will make sure that the VPN is picked up by Systemd and its service located at:
/lib/systemd/system/openvpn.service
Now you should see the tun0
interface with ifconfig
. The VPN is active but no traffic is going through it for now. The last step is making sure you add routes to the domains you need.
Found the IP of the website with dig
:
dig +short example.com
Add a route (there are also other approaches, but this one is simple for a few hosts):
ip route add [insert IP here] dev ppp0
Repeat these steps for the www.
subdomain and other domains you may need to route through the VPN
The routes should be updated once in a while, because the website might change IP address. You can write a Bash script and run it periodically using cron
to avoid doing it manually.
Alternative approach
If you are trying to access a geo-restricted video website, e.g. Hulu, you might consider using a SmartDNS service. That will take care of split tunneling for you. You will just need to update the DNS settings on the server.
However, this only works if the SmartDNS provider of your choice supports that particular website.
Connect to the server
You can now connect to your server using its IP address.