Creating VPN Connection on Linux (Ubuntu) using command line (PPTP Client for windows VPN Server)
Last time we see how to create vpn connection on Ubuntu using GUI. Now we create connection by manually editing required file and by executing commands
To successfully configure PPTP VPN Client we need:-
- /etc/ppp/peers/myvpn (Suppose we have given name to tunnel or connection as myvpn for our identity purpose)
- /etc/ppp/chap-secrets
- Server name or ip address of vpn server.
- User name and password to connect vpn server.
- Most important pptp-linux package
Step to create VPN connection:-
- Install Package
- Create tunnel file . for Eg. I have creating myvpn as a connection or tunnel name.
- Povide authentication information in chap-secrets file
- Dial connection
- Add route
Install Package:-
# apt-get install pptp-linux
Create tunnel file:-
Open the terminal and Create new file and type following details in tunnel file please replace your tunnel file name, user name and server detail high lighted with Red color.
# vi /etc/ppp/peers/myvpn
remotename myvpn
linkname myvpn
ipparam myvpn
pty "pptp vpn.mycompany.com --nolaunchpppd"
name myvpnuser
usepeerdns
require-mppe
refuse-eap
noauth
file /etc/ppp/options.pptp
Provide Authentication details:-
Please change accordingly syntax is “username” “connation name” “User Password” “*” in following file.
# vi /etc/ppp/chap-secrets
myvpnuser myvpn User@password *
Dial Connection:-
Now dial connection with following command in terminal
# pon myvpn nodetach
Add default Route:-
(every time you need to add this route after vpn connected or you need to crate script for that)
Now open other tab in terminal or other terminal type following command
# route add default ppp0
Check default route added successfully by typing following command
# route
And make sure that following route are show in result
Destination Gateway Genmask Flags Metric Ref Use Iface
default * 0.0.0.0 U 0 0 0 ppp0
Now you are successfully connected to Windows VPN Server.
to disconnect connection simply press Ctrl+C in first terminal




