Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question is Not about how to set up VPN on an Ubuntu server.

Edited: I think what I'm looking for is the way to set up a PPTP VPN client on my Ubuntu server by command line.

I have an Ubuntu server running and connected to the internet. I also have a VPN service (PPTP) running on another Linux machine. Now all I want to do is configure this Ubuntu server so that all the internet traffic it generates goes through the VPN.

How can I achieve this?

share|improve this question

Hi You can try this below link

you need to install pptpd

share|improve this answer
In my question I made it very clear (the first line) I am not asking how to set up a VPN server on Ubuntu. – Di Wu Oct 18 '12 at 6:30

Change the default route on your server to point to the machine which has the PPTP client running. In /etc/network/interfaces, change the gateway line to point to the PPTP client machine, then restart the machine (or just restart the interface, if you're feeling frisky. or just change the default route manually with the route command, if you're feeling extra frisky).

You'll also need to make certain that the machine with the PPTP tunnel up is willing to act as a gateway for traffic - this last can be done precisely with iptables, or it can be done more simply with sysctl. To do it the simple way - enable acting as a gateway for any traffic it knows a route for - uncomment the net.ipv4.forward line in /etc/sysctl.conf, and reread it:

sudo sed -i s/\#net\.ipv4\.ip_forward/net\.ipv4\.ip_forward/ /etc/sysctl.conf
sudo sysctl -p

Hope this helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.