Script that creates connection to PPTP VPN on linux
pptp-linux package must be installed on your machine. Install it with the command:
sudo apt install pptp-linux
- Download the script on your linux machine.
- Give execution permission to the file.
chmod +x linux_vpn_connector.sh
- Run the script with the required arguments
sudo ./linux_vpn_connector.sh -n <Connection_Name> -s <VPN_Host> -u <Username> -p <Password>
- After script ran successfully, you can connect to the VPN using the command:
sudo pon <Connection_Name>
- To test the connection, you can ping an IP on the VPN:
ping <IP_Address> -I ppp0
- To route specific traffic through VPN, use the command:
ip route add <IP_Mask> dev ppp0
e.g ip route add 192.168.10.0/24 dev ppp0 routes all traffic to IPs 192.168.10.* through the VPN.
Replace values in <> without the symbols.
e.g:
sudo ./linux_vpn_connector.sh -n testVPN -s 12.34.56.78 -u user -p secretPass!
ping 192.168.0.12