0

My server has to connect to a VPN by using PPTP.

I purchased a VPS, and it comes with VNC. In order to access to a foreign website I used the Ubuntu GUI to created a VPN connection to a foreign server.

I am wondering how could I access my server via FTP then?

7
  • Welcome to AskUbuntu! What do you mean by "access"? FTP is a file transfer protocol, not a remote shell (like SSH). May 26, 2016 at 20:11
  • I want to download some files from the server, but my server connected to a VPN, I am not able to connect my server by using my ftp software.
    – Paul L
    May 28, 2016 at 19:05
  • I still don't get why the VPN "has to" connect to a VPN, especially why it has to route all traffic to the VPN and not only some traffic. Could you update your question with an explanation of the network topology? A diagram with the involved nodes might be desirable. May 28, 2016 at 19:20
  • I am really new to Linux, just couple weeks. In order to access to a foreign website I used ubuntu GUI to created a VPN connection to a foreign server. That's all I am doing. I don't know how to route traffic at all. Thank you for your help and time.
    – Paul L
    May 28, 2016 at 19:38
  • Wait, your server has a GUI? And moreover: how do you interact with such a GUI? It means you are already connecting to the server. This is relevant information, please add it to your question. May 29, 2016 at 12:55

1 Answer 1

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .