Setting up PPTP VPN connection

make pptpvpn file:
#!/bin/bash
function routeadd {
route add -host 61.xxx.xxx.xxx dev ppp0
route add -host 62.xxx.xxx.xxx dev ppp0
route add -host 63.xxx.xxx.xxx dev ppp0
}
function makepptp {
echo pty \"pptp VPN.SERVER.COM --nolaunchpppd\" >> /etc/ppp/peers/pptpvpn;
echo remotename PPTP >> /etc/ppp/peers/pptpvpn;
echo require-mppe-128 >> /etc/ppp/peers/pptpvpn;
echo file /etc/ppp/options.pptp >> /etc/ppp/peers/pptpvpn;
echo ipparam pptpvpn >> /etc/ppp/peers/pptpvpn;
pppd call pptpvpn &
}
if [ -a /etc/ppp/chap-secrets ];
then
rm /etc/ppp/chap-secrets
echo $1 PPTP $2 '*' >> /etc/ppp/chap-secrets;
else
echo $1 PPTP $2 '*' >> /etc/ppp/chap-secrets;
fi

if [ -e /etc/ppp/peers/pptpvpn ];
then
rm /etc/ppp/peers/pptpvpn;
echo name $1 >> /etc/ppp/peers/pptpvpn;
makepptp;
sleep 8;
routeadd;
else
echo name $1 >> /etc/ppp/peers/pptpvpn;
makepptp;
sleep 8;
routeadd;
fi

Where,
pty \"pptp VPN.SERVER.COM --nolaunchpppd\"
Specifies that the command script is to be used to communicate rather than a specific terminal device. In this case we are using pptp client to establishes the client side of a Virtual Private Network (VPN) using the Point-to-Point Tunneling Protocol (PPTP).
VPN.SERVER.COM is host name (or IP address) for the VPN server
This will tell which hosts are on the other side of tunnel. (host name or IP address)
route add -host 63.xxx.xxx.xxx dev ppp0
Close and save the file.
chmod +x pptpvpn
sudo ./pptpvpn username password
If everything is went correctly you should be online and ppp0 should be up. Remote server will assign IP address and other routing information
Disconnect PPTP server vpn connection
Simply kill pppd service, enter:
killall pppd
it will work on any distribution, its just a matter ofpptp package you will have to install..

--Taken from: Sabayon wiki

0 comments:

Post a Comment

| More

Twitter Updates