Use VPN method for connection in Ubuntu command line

Source: Internet
Author: User

The code is as follows:


Route add default Dev ppp0
Route add-net 192.168.2.0 netmask 255.255.255.0 ppp0

1 Install VPN Client first
The code is as follows:


Sudoapt-getinstall Pptp-linux


2 command line allocated number to connect the VPN server


The code is as follows:
sudo pptpsetup--create testvpn--server 123.45.67.88--username kk--password fku--encrypt--start


After the –create is created the connection name, can be any name;
–server is followed by the IP of the VPN server;
–username is the user name
–password is a password, you can not have this parameter in this, the command will be automatically asked later. This will keep your account safe.
–encrypt means encryption is required, the encryption method is not specified, and the command reads the encryption in the configuration file
–start is the connection after the creation of the connection, if you do not want to connect, do not write

3 later to connect VPN or disconnect VPN
The code is as follows:


Pon Testvpn <--VPN connection name </p> <p>poff <--Disconnect VPN

4 All traffic to go VPN channel
The code is as follows:


# put the following two lines into the/etc/ppp/ip-up or direct command line input, delete the default gateway and the VPN server as the default gateway, that is, change the routing strategy, so the transmission flow through the VPN line to go. </p> <p> #route Add default GW 192.168.0.1</p> <p> #route del default GW the original gateway//original default gateway address is available via route command to get

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.