Sunday, May 27, 2007

VPN in Ubuntu

After my previous attempt at creating a VPN in Ubuntu I reverted all my work because I was rather unhappy with the results. After digging a bit more I found out I could actually use pptpconfig, as long as I didn't actually clicked the "Start" button. Here's the trick:

Start by installing pptpconfig. Add the following to your /etc/apt/sources.list file:

# James Cameron's PPTP GUI packaging
deb http://quozl.netrek.org/pptp/pptpconfig ./

Then install the app:

sudo apt-get update
sudo apt-get install pptpconfig

Now run it (sudo pptpconfig) and configure your VPN. In the "Routing" options, select "Client to LAN". Lets assume you called your new configuration MyVPN.

You can close pptpconfig. Go over to /etc/ppp/ip-up.d/ and create a new file called vpnroute (sudo gedit vpnroute). Assuming that the network you want to connect to uses IPs like 192.168.0.*, add this to the file:
#!/bin/sh
if [ "${PPP_IPPARAM}" = "MyVPN" ]; then
route add -net 192.168.0.0 netmask 255.255.255.0 dev ppp0
fi
Don't forget to make it executable, or it won't work:

chmod a+x vpnroute

And that's it. To start your VPN run:

sudo pon MyVPN

To stop it run:

sudo poff MyVPN

6 comments:

Anonymous said...

Excellent!

I had problem about network manager applet. All guides are telling me to click on VPN choice in applet's menu. But I don't have any! And I haven't figured out how to fix it.
Using this guide I got my VPN running in 3 minutes.

Thanks again!
zelezni

Anonymous said...

Same here. No VPN option in network applet despite having installed all network-manager plugins/packages. With this guide I got the VPN up in a few minutes.

Anonymous said...

For those who have "no VPN option in network manager" problem:
http://ubuntology.com/2007/10/26/ubuntu-710-gutsy-networkmanager-pptp-vpn/

There is no solution for me - having static IP though ... I keep searching.

Unknown said...

Apparently in Hardy Heron you still can't use network manager to create a VPN if your wireless network is manually configured, since that option isn't appearing when I right click the network manager.

I also can't seem to install pptpclient as it depends on other packages that are not installable. Am I stuck?

alex smith said...

In order to view Hulu shows outside of USA, all you need is a vpn (Virtual Private Network) service. With VPN, your computer will be connected and assigned a new USA IP address. Therefore with the new IP address, it is possible to view all Hulu shows or access any services that are limited for USA residents. Hotspot Shield is a free VPN service software. Hotspot Shield helps secure your computer, your anonymity and your online communications when using wi-fi.

Jianzhou said...

Thanks for the article.
pptp is only 128bit secure..

I went try out openvpn which give 2048 bit encryption level.

Much safer.

Watching hulu & bbc iplayer over vpn providers like www.smallvpn.com is a breeze now.

my 2 cent.