HowTo: Hur jag fick igång PPTP VPN

Här kan du dela med dig av dina bästa tips och knep.
Kategoriregler
Här ligger de utförliga instruktionerna vi kan tänkas behöva. Leta här om du tex behöver installera nåt program eller sätta upp någon funktion. Starta inte trådar utan att ha ett svar.
Användarvisningsbild
dlundh
Inlägg: 116
Blev medlem: 28 feb 2007, 13:58
OS: Ubuntu
Utgåva: 16.04 Xenial Xerus LTS
Ort: Stockholm
Kontakt:

HowTo: Hur jag fick igång PPTP VPN

Inlägg 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.
Senast redigerad av 1 dlundh, redigerad totalt 20 gånger.
--
dlundh
Min IT-blogg
Användarvisningsbild
mcNisse
Inlägg: 5211
Blev medlem: 06 feb 2007, 20:51
OS: Debian
Utgåva: Vet inte/ingen utgåva passar

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

Inlägg 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
Senast redigerad av 1 mcNisse, redigerad totalt 20 gånger.
KDE 4.5 SC är ute i det fria!!! Tjoho

Stagnation is good for nobody - after all if you don't progress you end up with gnome
Skriv svar

Återgå till "Guider"