It has been many times that I searched for a command line pptp client howto (as sometimes the GUI apps doesn`t work very well) to send to some "new to ubuntu" friends but always found some sites explaining the whole procedure making it more complicated with the extra scripts need to be created for routing the correct ip addresses through the tunnels.
That`s why today I took the decision to write a simple bash script to make it as easy as possible to create your tunnel using only one command and then run it using pon and poff.
I`m pasting my job here hoping to be helpful for others too.
Of course I`m taking no responsibility if this script blows up your computer or anything similar
I don`t think that it will do though as I have tested it on my PC and some more friends without problems.
Run the following to install pptp and pptpsetup:
The sed command replaces a buggy string in the pptpsetup with the correct one.
sudo apt-get install pptp-linux
sudo sed -i 's/= "\$DOMAIN\\\\"/\= "$DOMAIN\\\\\\\\"/g' /usr/sbin/pptpsetup
Then download the attached script (cyberpptp.sh) and put it under your /bin/ directory. After that, make it executable using:
Then run the script as follows for each of your tunnel:
chmod +x /bin/cyberpptp.sh
<TUNNEL> is just and identification name of your tunnel.
sudo cyberpptp --add <TUNNEL> <SERVER> <USERNAME> <PASSWORD> <IPs_TO_ROUTE_THROUGH_THE_TUNNEL>
<SERVER> is the host name or IP address of the pptp server.
<DOMAIN> is the domain name of the company you are connected. (This is optional but you are strongly encouraged to use it, as if you do have similar usernames in different domains, you will not be able to connect to them without this option being set for each of them.)
<USERNAME> the username of the pptp user to connect (put it in quotes)
<PASSWORD> the password of the pptp user (put it in quotes again)
<IPs_TO_ROUTE_THROUGH_THE_TUNNEL> the iprange of the remote network that it will be routed through the tunnel
An example of the above command follows:
Run the tunnel using
sudo cyberpptp.sh --add testtunnel 184.108.40.206 'myuser' 'myP@ssw0rd' 192.168.0.0/24
And disconnect the tunnel using
You can use
to check the status of the connection after running the pon command.
Use the cyberpptp.sh script with --delete option, if you want to totally delete the tunnel.
cyberpptp.sh --delete <TUNNEL>