- Client configuration can be done using the pptp-command command, which is a simple perl script
to start the Tunnel. An Interactive session will start. Follow the instructions to create.
- A Chap-secret, with local name set to mia,
Remote Name set to zidler (name of PoPToP server), a secret password mia123 (in our case).
- A tunnel, with tunnel name as test2 (say),
Server IP of zidler.ece.uic.edu, local name of mia
and remotename of zidler. No need to add any routes right now.
- pptp-command should create a file by the name test2
in /etc/ppp/peers/. A peek into this file, will result something like below:
[shashank@mia ~]# cat /etc/ppp/peers/test2
name mia
remotename zidler
ipparam test2
file /etc/ppp/options.pptp
- Note the last line in the above file, which denotes the options files with which pppd will be invoked.
I have placed the following options in /etc/ppp/options.pptp.
Click here
to find out why did i use these specific options?
---------------------------
[shashank@mia ~]# cat /etc/ppp/options.pptp
name mia
lock
dump
logfd 2
debug
#logfile /var/log/pptpd.log
noauth
#require-mschap-v2
require-mppe-128
#nomppe
#noccp
novj
novjccomp
nopcomp
noaccomp
nobsdcomp
nodeflate
ipparam 192.168.2.0
- After all this you can start using the tunnel, by using the start option in the interactive pptp-command
session. You should get the following log. Note the packet
exchanges. The output below has been slightly modified.
--SNIP--
1. sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x4c976cdf>]
2. rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <auth chap MS-v2> <magic 0x7b5dca0e>]
3. sent [LCP ConfAck id=0x1 <asyncmap 0x0> <auth chap MS-v2> <magic 0x7b5dca0e>]
4. rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x4c976cdf>]
5. rcvd [CHAP Challenge id=0x1 <7a3d05555bdac699d0dce5530da01387>, name = "zidler"]
6. sent [CHAP Response id=0x1 <af51bcc0894a92b4a6c98f895da26c410000000000000000...>, name = "mia"]
7. rcvd [CHAP Success id=0x1 "S=C0BB40C5E0BEFC0D69D9190F0140F18A8E1DBFBD M=Welcome to zidler.ece.uic.edu."]
8. Remote message: Welcome to zidler.ece.uic.edu.
9. CHAP authentication succeeded
10. sent [CCP ConfReq id=0x1 <mppe +H -M +S -L -D -C>]
11. rcvd [CCP ConfReq id=0x1 <mppe +H -M +S -L -D -C>]
12. sent [CCP ConfAck id=0x1 <mppe +H -M +S -L -D -C>]
13. rcvd [CCP ConfAck id=0x1 <mppe +H -M +S -L -D -C>]
14. MPPE 128-bit stateless compression enabled
15. sent [IPCP ConfReq id=0x1 <addr 0.0.0.0>]
16. rcvd [IPCP ConfReq id=0x1 <addr 192.168.254.230>]
17. sent [IPCP ConfAck id=0x1 <addr 192.168.254.230>]
18. rcvd [IPCP ConfNak id=0x1 <addr 192.168.254.231>]
19. sent [IPCP ConfReq id=0x2 <addr 192.168.254.231>]
20. rcvd [IPCP ConfAck id=0x2 <addr 192.168.254.231>]
21. local IP address 192.168.254.231
22. remote IP address 192.168.254.230
23. Tunnel zidler is active on ppp0. Local IP Address: 192.168.254.231
You may get a different output, but I will try to give some insight into the
different phases that ppp goes through. Lines 1-4 are the Link configuration phase. During this phase the two
sides exchange parameters that need to be applied to the link. If any side cannot accept a parameter,
it will outrightly reject it and the other side has to re-negotiate.
This is followed by Authentication Phase (Lines 5-9). Since we were using MS-Chap-v2 authentication,
it is the server(zidler) which starts the Chap authentication by sending a challenge (Line 5) followed by the
client response (Line 6) and finally the server acknowledgement of success (Line 7).
Lines 10-14 are the message exchanges for CCP (Compression Control Protocol), negotiating MPPE parameters.
For more information on this exchange,
click here.
Then comes the IP configuration stage (Lines 15-22), where both the sides negotiate IP addresses and
other related options.
- After the interface comes up, /etc/ppp/ip-up script is executed. This script is shown below. Note, how
I have added the route in /etc/ppp/ip-up.local script, called from /etc/ppp/ip-up and
also shown below
[shashank@mia ppp]# cat ip-up
#!/bin/bash
# This file should not be modified -- make local changes to
# /etc/ppp/ip-up.local instead
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
LOGDEVICE=$6
REALDEVICE=$1
[ -f /etc/sysconfig/network-scripts/ifcfg-${LOGDEVICE} ] && /etc/sysconfig/network-scripts/ifup-post ifcfg-${LOGDEVICE}
[ -x /etc/ppp/ip-up.local ] && /etc/ppp/ip-up.local "$@"
exit 0
----------------------------------------------------------------------------------------
[shashank@mia ppp]# cat ip-up.local
#!/bin/sh
# Sample of the ip-up script.
# This is called when the CIPE interface is opened.
# Arguments:
# $1 interface the ppp interface
# $2 terminal the terminal
# $3 speed Speed used on the interface
# $4 local IP address of our CIPE device
# $5 remote IP address of the remote CIPE device
# $6 arg argument supplied via "ipparam" option for pppd.
umask 022
PATH=/sbin:/bin:/usr/sbin:/usr/bin
# SK Add route to peer's network
route add -net $6 gw $5 netmask 255.255.255.0
now=`date "+%b %d %T"`
echo "$now UP $*" >> /var/log/pptpd.log
exit 0
- Similarly there is /etc/ppp/ip-down, which gets called whenever
the tunnel is stopped (or the interface is brought down). This script
also calls /etc/ppp/ip-down.local. Both of them are shown below.
[shashank@mia ppp]# cat ip-down
#!/bin/bash
# This file should not be modified -- make local changes to
# /etc/ppp/ip-down.local instead
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
LOGDEVICE=$6
REALDEVICE=$1
[ -x /etc/ppp/ip-down.local ] && /etc/ppp/ip-down.local "$@"
/etc/sysconfig/network-scripts/ifdown-post ifcfg-${LOGDEVICE}
exit 0
---------------------------------------------------------------
[shashank@mia ppp]# cat ip-down.local
#!/bin/sh
# Sample of the ip-up script.
# This is called when the CIPE interface is opened.
# Arguments:
# $1 interface the ppp interface
# $2 terminal the terminal
# $3 speed Speed used on the interface
# $4 local IP address of our CIPE device
# $5 remote IP address of the remote CIPE device
# $6 arg argument supplied via "ipparam" option for pppd.
umask 022
PATH=/sbin:/bin:/usr/sbin:/usr/bin
# SK Add route to peer's network
route del -net $6 gw $5 netmask 255.255.255.0
now=`date "+%b %d %T"`
echo "$now DOWN $*" >> /var/log/pptpd.log
/bin/cat /dev/null > /var/log/pptpd.log
exit 0