October 30, 2008
pptp on Linux the manual way
A few years ago I wrote a guide for myself describing how to get on the institute's vpn via ppttconfig on Linux.I never really understood what was so hard about it for other people until now... where pptpconfig has gone from all my Linux distributions.
I tried kvpnc and networkmanager and both failed. Either they are broken - I believe network manager is in general - or they just don't give access to the parameters I need to change.
So I did it manually and here it is for everyone to see.
/etc/ppp/chap-secrets
mycoolusername vpnatwork mysecretpassword *
/etc/ppp/peers/vpnatwork (edited from the kvpnc generated file)
# name of tunnel, used to select lines in secrets files
remotename vpnatwork
# name of tunnel, used to name /var/run pid file
linkname vpnatwork
# name of tunnel, passed to ip-up scripts
ipparam vpnatwork
# data stream for pppd to use
# xxx.xxx.xxx.xxx should be replaced by vpn gateway IP
pty "/usr/sbin/pptp --debug --loglevel 2 xxx.xxx.xxx.xxx --nolaunchpppd"
# domain and username, used to select lines in secrets files
name "mycoolusername"
# use MPPE encryption
require-mppe
# we do not require the peer to authenticate itself
noauth
# enable debug
debug
kdebug 1
# we want to see what happen
nodetach
# Dont use BSD compression
nobsdcomp
# Dont use deflate method
nodeflate
# dont set defaultroute
nodefaultroute
file /etc/ppp/options.pptp
You might want to remove the debug entries.
/etc/ppp/options.pptp
# Lock the port
lock
# Authentication
# We don't need the tunnel server to authenticate itself
noauth
# We won't do EAP, CHAP, or MSCHAP, but we will accept MSCHAP-V2
refuse-eap
refuse-chap
refuse-pap
refuse-mschap
require-mppe
# Compression
# Turn off compression protocols we know won't be used
nobsdcomp
nodeflate
As is seen in this file we use mschapv2 and that is what I cannot configure from kvpnc or networkmanager.
I don't know if it is necessary to have the nobsdcom and nodeflate in both files.
Kernel modules
Some kernel modules are needed: The ppp_mppe module and perhaps also the ip_gre module. I read somewhere that I should load the ppp_mppe module with the ppp-compress-18 alias. No idea if it makes a difference. I might get around to testing it later. So:
modprobe ip_gre
modprobe ppp-compress-18
Firewall issues
You need to allow outgoing connections to tcp port 1723 and you need to allow the GRE protocol: IP protocol 47. Also you need to allow established-related or whatever keep state option you have in your firewall.
If you run natted through an iptables firewall you also need to load the module ip_nat_pptp on the firewall. Took me a while to figure that one out!
Starting the connection
This is the simple part:
# pppd call vpnatwork
Now either it work happily or you get funny error messages like a repeated
sent [LCP ConfReq id=0x1 <mru 1440> <asyncmap 0x0> <magic 0x370c5c0> <pcomp> <accomp>]. this is not an error in itself but you are only supposed to get it once, not repeatedly until it times out, which I had until I loaded the ip_nat_pptp module on the firewall, but I also had it from home when i did not have the reqiure-mppe in the options.pptp file. Lots of possibilities for errors. But this runs for me
- From home wireless on my eee ubuntu
- From eduroam wireless at work (same PC)
- From my own wired network at home (when I got the fw right) (same PC)
- From my wired network at work on stationary PC with debian etch
The funny thing is that I didn't have the firewall issue with a Windows laptop :/ Perhaps Windows has started using a more secure protocol by default and we Linux users just haven't figured that out yet. Or perhaps it connected via eduroam and I didn't notice.
Posted 4 years, 11 months ago on October 30, 2008
The trackback url for this post is http://people.binf.ku.dk/~hanne/blog/bblog/trackback.php/64/
The trackback url for this post is http://people.binf.ku.dk/~hanne/blog/bblog/trackback.php/64/
Comments have now been turned off for this post