I'm comfortable configuring my network from command line. There was one thing though that I had always done using Network Manager applet; setting up pptp. I googled for it and quickly found this which explains how I can use pptp from the command line.
First you create a file in /etc/ppp/peers. Name the file whatever you want, like myvpn. Put this inside that file:
Fix the host name and the user name accordingly. Then add a line like this to /etc/ppp/chap-secrets:remotename myvpn linkname myvpn ipparam myvpn pty "pptp <host> --nolaunchpppd " name <username> usepeerdns require-mppe refuse-eap noauth # adopt defaults from the pptp-linux package file /etc/ppp/options.pptp
<username> myvpn <password> *
Again obviously you need to put your own username and password plus the correct connection name.
I have also created two scripts in /etc/ppp/ip-up.d/ and /etc/ppp/ip-down.d/ to set up the default gateway properly. These scripts are tailored for my own system and you might need to adapt them. the one in ip-up.d/ removes the current default gateway and adds a new one. The other one reverses this.
/etc/ppp/ip-up.d/myvpn:
/etc/ppp/ip-down.d/myvpn:#!/bin/bash if [[ $PPP_LOCAL = 192.168.2.* ]]; then route del default gw 192.168.1.1 route add default gw 192.168.2.100 fi
Don't forget to make the scripts executable. Also notice that ip-up.d/ and ip-down.d/ are only available in Debian and its derivatives (to learn more about the arguments passed to them and the available environment variables, see the Debian /etc/ppp/ip-up and /etc/ppp/ip-down scripts). Other distros use slightly different paths.#!/bin/bash if [[ $PPP_LOCAL = 192.168.2.* ]]; then route add default gw 192.168.1.1 route del default gw 192.168.2.100 fi
No comments:
Post a Comment