Establish Private VPN on VPS

Contents
[隐藏]

1.Preparation

1.1.VPS

1.1.1.What is VPS?

The defination of VPS is quoted from wikipedia.

virtual private server (VPS) is a virtual machine sold as a service by an Internet hosting service.

A VPS runs its own copy of an operating system (OS), and customers may have superuser-level access to that operating system instance, so they can install almost any software that runs on that OS. For many purposes they are functionally equivalent to a dedicated physical server, and being software-defined, are able to be much more easily created and configured. They are priced much lower than an equivalent physical server. However, as they share the underlying physical hardware with other VPSs, performance may be lower, depending on the workload of any other executing virtual machines.

1.1.2.Purchase VPS

There are many VPS supportors on the website, the one that I used is bandwagonhost.

First, register on the bandwagonhost website, and then click order KVM or OpenVZ button on the homepage to order VPS. Choose the product you want to buy, and click Order KVM button. I recommend you to order KVM rather than OVZ. For me, I chose the first product (10G VPS: 10GB SSD, 512MB RAM and 500GB bandwidth) and ordered KVM. After that, choose Billing Cycle and Location (I recommend US – Los Angeles DC2 QNET (USCA_2) and  US – Los Angeles DC4 MCOM (USCA_4) which are faster.)  and click Add to Cart button, and then click Checkout button to purchase. PayPal, Alipay and Credit Card is supported on this website, choose one of those you like to purchase.

After purchasing, go back to homepage and click Client Area button on the up-right corner of the homepage. Then, click Services->My Services button and the VPS you just ordered appears on the page. Click KiwiVM Control Panel button to go to KiwiVM Control Panel. There are some very import information on Main Controls tab of KiwiVM Control Panel, such as

  • IP address
  • SSH Port
  • Disk usage
  • Bandwidth Usage
  • Operating system

The last import thing we need to do is to get root password which is used to connect VPS through Xshell SSH connection (Xshell will be talked later in this passage). There are two kinds of way to approach.

  1. Use Root pasword modification on KiwiVM Control Panel.
  2. Use Install new OS on KiwiVM Control Panel.
    Choose a new Operating System you would like to install, and check the checkbox and click Reload. After that, a prompt information including a new root password and new SSH port will come up on the screen. Copy and save this important information (It’s very important, especially the root password. There is no way to find it out if you lost it except generate a new root password or install new OS to get a new root password).

Congratulation! The preparation for VPS complete!

2.Xshell

2.1.What is Xshell?

The properties of Xshell is quoted from official website.

Xshell is a powerful terminal emulator that supports SSH, SFTP, TELNET, RLOGIN and SERIAL. It delivers industry leading performance and feature sets that are not available in its free alternatives. Features that enterprise users will find useful include a tabbed environment, dynamic port forwarding, custom key mapping, user defined buttons, VB scripting, and UNICODE terminal for displaying 2 byte characters and international language support.

2.2.Download

Generally, Xshell should be purchase, but a free license (Home and School use) is offered by official, click this link to go to free license page and download.

2.3.Install & Usage

Install & Usage is talked about on this page.

3.Connect VPS through Xshell SSH connection

3.1.Prepare IP address and SSH port

Get IP address and SSH port on KiwiVM Control Panel.

3.2.Creating a session

You can create Telnet, Rlogin and SSH protocol sessions.

  1. On the File menu, click New.
    RESULT: New Session Properties dialog box opens.
  2. In the Name box, enter the name for the session. (Anything you want to type as a name.)
  3. In the Protocol list, choose a protocol to use when connecting to the remote server. (Here we choose SSH)
  4. In the Host box, enter the hostname or IP address of the remote server. (Here we enter IP address of VPS we prepared before.)
  5. In the Port Number box, type or select the port number used by the remote server. (Here we enter SSH port number we prepared before.)
  6. Click on the Authentication in the category menu.
  7. In the User Name box, enter the name of your account on the server.  (Here we enter root.)
    Note: Prompt dialog box will open during authentication process if the user name is not specified.
  8. Click OK.

A new session has been created and you are ready to connect to the remote host. To connect to the remote host, read the Connecting to the remote host section below.

3.3.Connecting to the remote host

Once you have created a Telnet, Rlogin or SSH session, you can connect to the remote host. If there is no session created, see Creating a session first.

  1. On the File menu, click Open.
  2. In the session list, select the session you want to connect to. And click Connect.
    The SSH User Authentication dialog box shows up.
  3. For the password authentication, enter your password in the Password box, and click OK.For the public key authentication, select a user key from the list and type in the passphrase in the Passphrase box and click OK.
    Note: If there is no user key available, see Public Key User Authentication.For the keyboard-interactive (Generic Message Exchange) authentication, click OK and then follow the generic authentication steps.Note: You can skip the authentication steps by saving the password and/or public key information in the Authenticationcategory of the Properties dialog box.

4.Shadowsocks

4.1.Remote VPS Installation and Usage

The following configuration information can be accessed in ss github website.

4.1.1.Install

The first step in official set is to run apt-get install python-pip command, but error occurs like this:

To solve this problem, run apt-get update, after that, run apt-get install python-pip.

Debian / Ubuntu:

CentOS:

Then run pip install shadowsocks command.

4.1.2.Usage

First, to confirm vim is installed on your environment. If not, run apt-get install vim command.

vim /etc/shadowsocks.json

For single user

For multi-user

Explanation of the fields:

Name Explanation
server the address your server listens
server_port server port
local_address the address your local listens
local_port local port
password password used for encryption
timeout in seconds
method default: “aes-256-cfb”, see Encryption
fast_open use TCP_FASTOPEN, true / false
workers number of workers, available on Unix/Linux

The next step is to tart ssserver, use ssserver -c /etc/shadowsocks.json -d start command.

If ssserver already start, error will occur when running the above command, and the error is

So, use ssserver -c /etc/shadowsocks.json -d stop command to stop the ssserver and use ssserver -c /etc/shadowsocks.json -d start command to start the ssserver. If ssserver starts successfully, you will get the following information

Congratulations! Shadowsocks is installed and configured completely until now.

4.2.Windows Shadowsocks client

4.2.1.Download

Click here to download Shadowsocks for Windows.

4.2.2.Usage

The usage of Windows Shadowsocks client is here.

4.3.Android Shadowsocks client

Click here to install Android Shadowsocks client. You may not open this link, and you can download here or search 影梭.

4.4.IOS Shadowsocks client

Click here to install IOS Shadowsocks client.

分享到:

3 thoughts on “Establish Private VPN on VPS

发表评论