我愛你,你是自由的。
Your key must not be publicly viewable for SSH to work. Use this command if needed:
chmod 400 xxxx.pem
Connect to your instance using its Elastic IP:
127.0.0.1
Example:
ssh -i xxxx.pem ubuntu@127.0.0.1
Please note that in most cases the username above will be correct, however please ensure that you read your AMI usage instructions to ensure that the AMI owner has not changed the default AMI username.
If you need any assistance connecting to your instance, please see our connection documentation.
設置root密碼
sudo passwd
安装pptpd
sudo apt-get install pptpd
修改/etc/ppp/pptpd-options文件, 在最下面添加以下2行
localip 192.168.9.1
remoteip 192.168.9.11-30
之後修改/etc/ppp/options.pptpd文件, 加上Google的DNS
ms-dns 8.8.8.8
ms-dns 8.8.4.4
接下来修改/etc/ppp/chap-secrets文件, 配置自己VPN的用户名/密码, 格式如下:
<username> pptpd <passwd> *
例如
name pptpd passwd *
修改/etc/sysctl.conf文件, 添加以下内容
net.ipv4.ip_forward=1
執行
sudo /sbin/sysctl -p
重新加载配置
啟用iptables的NAT configuration
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
為了保證每次EC2實例重啟後NAT configuration能啟動, 還要修改/etc/rc.local文件, 在exit 0這行上面加上
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
最後重啟pptpd服務
sudo /etc/init.d/pptpd restart
注意AWS免費賬戶每月只有15GB免費流量,用超了要從信用卡扣費