LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-29-2009, 04:22 AM   #1
Farrukh Fida
Member
 
Registered: Jun 2006
Location: Dubai
Distribution: Cent OS
Posts: 34

Rep: Reputation: 15
PPTP VPN client


Hello,

I need to connect my Linux machine to PPTP VPN server(windows 2003 based).
So I need to setup PPTP-client which I've download from http://www.cyberciti.biz/tips/howto-...tp-client.html
according to it I've configured following

vi /etc/ppp/chap-secrets

# Secrets for authentication using CHAP
# client server secret IP addresses

username pptp password *


vi /etc/ppp/peers/mycreated-file

pty "pptp myVPNserverIP --nolaunchpppd"
name username
remotename pptp
require-mppe-128
file /etc/ppp/options.pptp
ipparam mycreated-file
persist



vi /etc/ppp/options.pptp

lock noauth nodeflate nobsdcomp

but when I called
pppd call my-connection-name

it shows following error.

Using interface ppp0
Dec 29 11:59:36 pppd[5718]: Connect: ppp0 <--> /dev/pts/4
Dec 29 11:59:36 pppd[5718]: Modem hangup
Dec 29 11:59:36 pppd[5718]: Connection terminated.
Dec 29 11:59:36 pppd[5718]: Exit.

I'm using following configuration for windows client and it is successfully connected.
Click image for larger version

Name:	1.jpg
Views:	73
Size:	80.3 KB
ID:	2357
 
Old 12-29-2009, 08:25 AM   #2
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
This might be a better documentation for you: http://pptpclient.sourceforge.net/

They have a very good troubleshooting section.

Last edited by eco; 12-29-2009 at 08:27 AM. Reason: more info
 
Old 12-29-2009, 10:20 AM   #3
Farrukh Fida
Member
 
Registered: Jun 2006
Location: Dubai
Distribution: Cent OS
Posts: 34

Original Poster
Rep: Reputation: 15
Thanks for reply.
I've also installed PPTP client in webmin. And I can create vpn connection
But I don't know what options should I choose in webmin which is same as Microsoft's typical(recommended setting).

Click image for larger version

Name:	security.JPG
Views:	76
Size:	29.5 KB
ID:	2359


How I set same option (as in above picture)in webmin?

Please help
 
Old 01-01-2010, 09:15 AM   #4
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
Sorry for the slow reply, I have no internet at home thanks to Belgium's useless providers.

Here is a copy paste of my Wiki notes. I had these settings working for A Linux server and windows and unix clients.

Hope this helps.

===START===

Pptp
From Ed's wiki
Jump to: navigation, search
Contents
[hide]

* 1 Intro
* 2 Kernel Setup
* 3 Install programs
* 4 Server
o 4.1 Specs
o 4.2 Firewall rules
* 5 Client
o 5.1 Linux config
+ 5.1.1 Routing
+ 5.1.2 debug
o 5.2 Wintendo Config
* 6 source

[edit] Intro

We are lucky 'cause it seems the kernel just integrated PPTP and we won't have to patch nor wait for a patch to upgrade the kernel.

I'd like to thank the developers for their great effort.

All of the following information is taken directly from the Homepage of PPTPClient.
[edit] Kernel Setup

* Install a kernel 2.6.15 or above. Taht way you won't have to patch it with MPPE and pppd won't have to have the flag enabled either.

Code: Install kernel sources

# emerge -av sys-kernel/gentoo-sources

Time to make sure you kernel supports PPPTP Template:Box Kernel

Then you can add the following modules to /etc/modules.autoload.d/kernel-2.6

ppp_mppe
arc4

[edit] Install programs

* Install pppd and pptpd

PPPd comes with MPPE now so there is no need for the mppe-mppc flag any more. To make sure, you can always try the following.
Code: Check support for MPPE support

# strings `which pppd`|grep -i mppe|wc --lines

Code: Install PPP and PPTP

# emerge -av net-dialup/ppp net-dialup/pptpd


[edit] Server
[edit] Specs

Kernel 2.6.16-gentoo-r9 with pptpd-1.2.3-r1 and ppp-2.4.2-r15

* configure the kernel as done bellow

Then you can add the following modules to /etc/modules.autoload.d/kernel-2.6

ppp_mppe
arc4

edit /etc/pptpd.conf
File: /etc/pptpd.conf

option /etc/ppp/options.pptpd
logwtmp
localip 192.168.200.254
remoteip 192.168.200.1-3


Secure /etc/ppp
Code: Secure the directory ppp

chmod 700 /etc/ppp


Setup /etc/ppp/options.pptpd
File: /etc/ppp/options.pptpd

name bkupvpn
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
lock
nobsdcomp
nologfd


Setup /etc/ppp/chap-secrets
File: /etc/ppp/chap-secrets

# PPTP
ecosta01 bkupvpn ecosta 192.168.200.1
sandro01 bkupvpn sandro 192.168.200.2
tsaka01 bkupvpn tsaka 192.168.200.3


Start the service
Code: Start PPTP

# /etc/init.d/pptpd start


[edit] Firewall rules

If you have iptables running, we'll need to add statements for that.
Code: Firewall rules

iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -A FORWARD -i eth1 -o ppp0 -s 192.168.123.0/24 -m state --state NEW -j ACCEPT


[edit] Client
[edit] Linux config

Setup the file which will hold the password
File: /etc/ppp/chap-secrets

ecosta01 bkupvpn ecosta *


Now setup the file with all the details you will need to connect
File: /etc/ppp/peers/vpn

pty "pptp mytux --nolaunchpppd"
name ecosta01
remotename bkupvpn
require-mppe-128
file /etc/ppp/options.pptp
ipparam vpn


Code: connect to the VPN Server, then disconnect

# pon mytux
# poff mytux


[edit] Routing

We need to add a route for things to work properly.
Code: create a route for the new ip range

# route add -net 192.168.200.0/24 dev ppp0


Add this to ip-up also.
Code: automate route command on connection

# echo 'route add -net 192.168.200.0/24 dev ppp0' >> /etc/ppp/ip-up


[edit] debug

If you can't ping the other side, you can start pppd with logging to see what's going on.
Code:

pppd call my_peer logfd 2 nodetach debug dump


[edit] Wintendo Config

Go to your Windows client (XP Pro in my case) and open "Network Connections."

* Start the "New Connection Wizard." Choose "connect to the network at my workplace" ->
* Choose "Virtual Private Network connection" ->
* Enter a name for your connection ->
* Enter the hostname of the VPN server ->
* Click finish.

* Go to the properties of this new connection. Click on the "Networking" tab ->
* Double click on "Internet Protocol (TCP/IP)" ->
* Click on "Advanced..." ->
* Untick "Use default gateway on remote network."

This will prevent all your Internet traffic from running through the VPN server (not necessary to do this, but I do). Now for the real moment of truth. Trying to connect...
[edit] source

* PPTPClient
* Gentoo Forum
* PHP Architecture

===END===
 
1 members found this post helpful.
Old 01-17-2010, 02:53 AM   #5
Farrukh Fida
Member
 
Registered: Jun 2006
Location: Dubai
Distribution: Cent OS
Posts: 34

Original Poster
Rep: Reputation: 15
Hi thanks for the help.

I've successfully connected to my PPTP server (windows 2003)using Linux.
Now problem is my VPN connection disconnect after some time, I read on some where that I should put 'persist' in /etc/ppp/options.pptp

lock
noauth
nobsdcomp
nodeflate
require-mppe
refuse-eap
mtu 1000
mru 1000
lcp-echo-failure 10
lcp-echo-interval 10
persist

So I put persist. Now it is connected successfully and each and everything working fine until disconnect, once it is disconnect it shows PPTP is connected but nothing is working. I check ifconfig but it doesn't shows any PPP interface.

I try to disconnect PPTP tunnel but no success except I comment persist option.

Is there any way it redials once disconnected.

Thank you.
 
Old 01-17-2010, 09:32 AM   #6
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
Unhappy

++ same problem here...
i use this ugly hack(i know...) on my router:
Code:
#!/bin/sh
if [ -x "/proc/`cat /var/run/ppp0.pid`" ]; then
	#bad check. also need to check is it really pppd. will be added later. i think it's good for now.
	exit
fi

#additional iface check
ifc=`tail -n 1 /proc/net/dev | grep ppp0 | wc -l`
if [ $ifc = 1 ]; then
	#interface seem to be up still though connection PID doesn't exist.
	exit
fi

echo "PPTP Connection Daemon Failed. Restating pppd..."
pon vpn1
that shell script is added to crontab, runs every 1 minute. i got my hands full by now, so i'm still not came up to make a daemon on perl or python, that will be testing connection and reconnect once dropped... :/
because, actlually, that script needs to load shell, grep, wc and tail, which takes time and results in performance decreasing: so a better way it to have it all in RAM with static memory usage. Maybe I will write that on C someday

Last edited by Web31337; 01-17-2010 at 09:34 AM.
 
Old 01-28-2010, 03:02 AM   #7
Farrukh Fida
Member
 
Registered: Jun 2006
Location: Dubai
Distribution: Cent OS
Posts: 34

Original Poster
Rep: Reputation: 15
Hi,

I write following script.

#!/bin/bash

TEST=$(ifconfig | grep "ppp")

if [ -z "$TEST" ]
then
pptp xxx.xxx.xxx.37 call testVPN_original
fi

echo $TEST
SUB=${TEST:0:3}

YY="ppp"

echo $YY
echo $SUB
if [ $SUB == $YY ];
then
ping -c 2 192.168.0.2
route add default gw 192.168.0.2
fi

This script I run after 2mins. 1st it checks that ifconfig has something like ppp if it has ppp means VPN is connected.so it just ping to other end(keep alive). If ifconfig not has ppp it dials PPTP using "pptp xxx.xxx.xxx.37 call testVPN_original"

I've tested that whenever VPN is down, it takes hardly 6 min to back online each and every thing.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Linux Configure point to point tunneling PPTP VPN client for Microsoft PPTP vpn server LXer Syndicated Linux News 0 06-13-2007 09:46 AM
vpn pptp client sameer666 Solaris / OpenSolaris 2 09-15-2006 05:44 AM
How to install vpn - client (pptp) for Linux. vadimkovalev Linux - Networking 1 09-30-2005 02:42 AM
Problem with installation of a VPN - PPTP client l2g Linux - Networking 1 12-24-2004 02:37 AM
use of pptp client to access vpn krish87 Linux - Networking 0 08-20-2004 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration