Sida 1 av 1

HowTo: Hur jag fick igång PPTP VPN

Postat: 20 mar 2007, 07:37
av dlundh
Jag följde (förgäves) flera guider för att installera en VPN-klient som skulle fixa en PPTP-koppling in till jobbet. Sedan hittade jag följande som fungerade direkt på Ubuntu 6.10:
$ sudo apt-get install pptp-linux

Now you will need to edit the options.pptp file

sudo vi /etc/ppp/options.pptp

and insert the below line:

lock noauth nobsdcomp nodeflate

Next you will need to modify chap-secrets

$ sudo vi /etc/ppp/chap-secrets

add this line:

$USERNAME PPTP $PASSWORD *

where: $USERNAME is your VPN username $PASSWORD is your VPN password

A completed chap-secrets on a default Dapper setup would look something similar to this:

  1. Secrets for authentication using CHAP
  2. client server secret IP addresses

myusername PPTP mypassword *

You will then need to create a tunnel configuration file:

$ sudo vi /etc/ppp/peers/$TUNNEL

where $TUNNEL is the name you wish to give this VPN connection. Now:

$ sudo vi /etc/ppp/peers/MyVPN

and add the following lines:

    * pty "pptp $SERVER --nolaunchpppd"
    * name $USERNAME
    * remotename PPTP
    * require-mppe-128
    * file /etc/ppp/options.pptp
    * ipparam $TUNNEL

where $SERVER is the IP address or hostname of the VPN gateway where $USERNAME and $TUNNEL are as defined earlier.

The resulting file will look something like this:

    * pty "pptp myvpnserver --nolaunchpppd"
    * name myusername
    * remotename PPTP
    * require-mppe-128
    * file /etc/ppp/options.pptp
    * ipparam MyVPN

The last step you'll need to take is to create a file in /etc/ppp/ip-up.d with the same name as your "peers" file that sets the route to the other network automatically for you:

$ sudo vi /etc/ppp/ip-up.d/MyVPN

which in this example for a class C network will look something like this:

  1. !/bin/sh

route add -net 192.168.1.0 netmask 255.255.255.0 dev ppp0

Finalise the process by making the file executable:

$ sudo chmod a+x /etc/ppp/ip-up.d/MyVPN

Provide all your settings are correct, you should be able to start the PPTP connection by running:

$ sudo pon MYVPN

Efter allt ovanstående kopplade maskinen upp sig på VPN-linan och jag kan samtidigt surfa vidare på internet utan problem.

För att starta och stoppa VPN-kopplingen har jag 2 script:
startvpn.sh innehåller bara:
sudo pon MYVPN

killvpn.sh innehåller bara:
sudo kill $(pgrep pptp)

Hoppas det här löser problemen med att få igång PPTP VPN.

SV: HowTo: Hur jag fick igång PPTP VPN

Postat: 20 mar 2007, 08:45
av mcNisse
Bra beskrivning :)

När jag mixtrade med pptp kopplingen till jobbet var jag tvungen att lägga till en gateway i /etc/ppp/if-pre-up mot pptp serverns ip.

Kod: Markera allt

if [ -n "$6" -a "$6" = "jobbet" ]
then
   route add -host ww.xx.yy.zz gw 192.168.1.1 dev eth0
fi
Sedan skiver man skript i /etc/ppp/if-down.d/jobbet som tar bort routingreglerna när kopplet ska ner.

Nerstängning av vpn kopplingen görs med fördel med:

Kod: Markera allt

sodo poff jobbet