To use PPTP, you need to do the following:
First, install the
ppp packages. Then, create a file in
/etc/ppp/peers/. The file name is irrelevant, but this name will be used to switch on the PPTP tunnel, so name it something meaningful. The file (the "peer file") should contain this:
pty "/usr/sbin/pptp <server_ip_address> --nolaunchpppd"
server_ip_address and the
your_login_name with the appropriate values. The
identifier will be used for supplying a password (see below). The
ipparam_id is used by the scripts in
/etc/ppp/ip-up.d/. It is needed if you want to do something with the tunnel interface (adding routes, maybe -- see below).
You need to supply your password. The password is stored in a plaintext file (which sucks, be sure to chown the file to 0600). The file is
/etc/ppp/chap-secrets, anbd it should contain a line like this:
your_login_name identifier <your_password> *
The first two parameters is from the peer file.
If you want to do something when the PPTP tunnel starts and/or stops, you need to add scripts to the
/etc/ppp/ip-up.d/ and the
/etc/ppp/ip-down.d/ directories. Every script in these directories will be run upon (de)activating a ppp tunnel. The following global variables exported for the scripts (there are others, but these are the most useful):
PPPD_PID: The PID of the pppd process
PPP_IFACE: The interface in question
PPP_IPPARAM: The ipparam_id, which is given in the peer file
PPP_LOCAL: The local IP address assigned to the ppp interface
PPP_REMOTE: The remote IP address assigned to the ppp interface
After all this, you can use the
pon <peer file>
to start the PPTP tunnel, and the
poff <peer file>
to stop it.