What can cloud technology do? Speaking of what we need for half a day, today we are playing with the implementation of building PPTP services through Amazon AWS EC2 to scientifically access the internet. I have previously introduced the AIM (Autodesk Infrastructure Modeler). There are many cool AIM case videos on youtube, video tutorials, and so on. I would like to introduce them to you very much, unfortunately, most children's shoes cannot be accessed. Will it be better to learn to surf the Internet scientifically? From now on, I don't have to worry so much about the useful information of our users. :)
First, you need to use the Amazon AWS service. Of course, you need to apply for an account. Now, Amazon has one year of free service. Do it if you have less gossip.
Create an EC2 instance
Log on to the AWS console, switch to the EC2 service, and start an EC2 example. Using Apac Tokyo in China may be faster.
You can use the Wizard to create an instance:
Select a linux system. The asterisks are free for new users for one year.
Here you can select the number of instances and instance type. It is enough for me to select a micro instance:
Follow the default settings:
In this case, press default:
Here we will give the instance a name for easy identification:
Select Key Pair. If you have previously produced the guokey pair, you can use it. If you have not yet generated it, you can now generate one, download it to your local device, and save it to a safe place. It should be a pem file. This pem file should be saved, which is equivalent to your password. If you lose it, it will cause serious consequences.
Set the firewall. For PPTP, the default port is 1723. You need to add a TCP 1723 Port:
This is the summary page. If there is no problem, you can press Launch to start the instance.
Now the instance has started. You can connect to the EC2 instance in a few minutes.
For convenience, you can also set an EIP to point to your instance. However, if you stop your instance, you must unbind the EIP; otherwise, there will be punitive charges !! Remember!
Use of SSH logon tool in Windows
For windows users, connecting to a remote linux instance of EC2 requires some tools. There are many tools that can be used with putty. The following is how to use PuTTY:
Connecting from a Windows Machine
To connect to your Linux/UNIX instance from a Windows machine, you use an SSH client. The following instructions assume that you're using PuTTY, a free SSH client for Windows machines.
Getting PuTTY
To download and install PuTTY
Note
Other tools in the PuTTY suite are PuTTYgen, a key generation program, and pscp, a secure copy command line tool. the different PuTTY tools are separate applications. you can install them separately or install the entire suite with a simple Windows installer. the following instructions assume you 've installed the entire suite and can access all the components from the Windows Start menu.
Converting Your Private Key
PuTTY does not natively support the private key format generated by Amazon EC2. Fortunately, PuTTY has a tool called PuTTYgen, which can convert keys to the required PuTTY format.
To convert your private key
Start PuTTYgen (e.g., from the Start menu, click All Programs> PuTTY> PuTTYgen ).
Click Load and browse to the location of the private key file that you want to convert (e.g .,GSG_Keypair.pem
). By default, PuTTYgen displays only files with extension.ppk
; You'll need to change that to display files of all types in order to see your.pem
Key file. The private key file must end with a newline character or PuTTYgen cannot load it correctly.
Select your.pem
Key file and click Open.
PuTTYgen displays the following message.
When you click OK, PuTTYgen displays a dialog box with information about the key you loaded, such as the public key and the fingerprint. the keys that Amazon EC2 generates are 1024-bit SSH-2 RSA keys.
Click Save private key to save the key in PuTTY's format.
PuTTYgen asks if you want to save the key without a passphrase.
Click Yes.
Note
A passphrase on a private key is an extra layer of protection, so even if your private key is discovered, it will not be usable without the passphrase. the downside to using a passphrase is that it makes automation harder because human intervention is needed to log on to an instance, or copy files to an instance. for this exercise, we're not using a passphrase.
Name the key with the same name you used for the key pair (e.g., GSG_Keypair). PuTTY automatically adds.ppk
File extension.
Your private key is now in the correct format for use with PuTTY. You can now connect to your instance using PuTTY's SSH client.
Connecting Using PuTTY SSH
You'll connect by starting a PuTTY SSH session.
To use SSH to connect
Start PuTTY (e.g., from the Start menu, click All Programs> PuTTY ).
A dialog box opens with a Category menu on the left side. On the right side, the basic options for your PuTTY session are displayed.
In the Host Name field, enter the public DNS name of your instance (which you shoshould have recorded earlier). You can optionally prefix the DNS nameec2-user@
To automatically log in as ec2-user when the session opens.
In the Category menu, under Connection, clickSSH, And then Auth.
The options controlling SSH authentication are displayed.
Click Browse and navigate to the PuTTY private key file you generated in the preceding section.
Click Open.
An SSH session window opens and PuTTY displays a security alert asking if you trust the host you're re ing.
Click Yes.
In the SSH session window, log in as ec2-user if you didn't as part of starting the SSH session.
Tip
The AMI we launched in this exercise requires you to log in to your instance as ec2-user. Some AMIs let you log in as root.
Note
If you specified a passphrase when you converted your private key to PuTTY's format, you must provide that passphrase when you log in to the instance.
You're now logged in as ec2-user and can work with the instance like you wocould any normal server. If you need to run a command as root, you must prefix the commandsudo
. For example:
sudo /bin/cat /etc/image-id
Normally you 'd continue using the instance. However, for the purposes of this guide, we're re going to show you how to terminate the instance immediately. Click the following button.
Building PPTP services
Now, use Putty to log on to my EC2 service. After the connection is successful, the user name will be prompted, login as: Enter the ec2-user, and then enter the password to enter the system, because your password already exists in the ppk file as mentioned above.
After logging on to the system, run the following command to install the PPTP service:
Sudo yum-y install rpm-build gcc make
Sudo wget https://gist.github.com/raw/666241/e8f3030a9e7066b8deb0a3d9ec761360e2d94227/pptpd.sh
Sudo sh pptpd. sh
After the installation is complete, you will be prompted for a default vpn user and his password. To add other users, edit the/etc/ppp/chap-secrets file. The format is: User Name + space + pptpd + space + password + space + *, where * indicates that you can log on from any IP address.
Test Service
After the service is running properly, you should be able to connect to mongopiun and start scientific Internet access. Windows, iphone/iPad, and Android phones are all ready for use. Haha!
The following is the connection method below win7. Sorry, I am using an English system. If it is Chinese, I should look for something better :) I don't know what the specific Chinese saying is, I will simply translate the text on the interface. You can refer to the picture to find it.
First, go to the control panel, network, and sharing center:
Then create a new network connection:
Connect to the work location:
Use my internet connection:
The following is my test server address:
My test username and password:
Connection successful. You can watch youtube, Wahaha !! Youtube, facebook, twitter, and google.com have been around for so long. What should I do first ??
At the same time, the test passed on the iPhone and Android systems !! This is great for iPhone. You don't have to work hard to jailbreak, And you can access the Internet without any difference !!
Oh, if you are too lazy to get it by yourself, leave a short message for me. I'll give you a password to use first, haha !!