EC2 Ubuntu14.04安装pptp ***

环境:Ubuntu Server 14.04 位于Amazon EC2
网卡:eth0
软件:pptpd
步骤:
1、 安装pptpd

sudo aptitude install pptpd

2、 设置虚拟ip,编辑 /etc/pptpd.conf

localip 172.25.1.1

remoteip 172.25.1.10-20

3、 设置dns,编辑 /etc/ppp/pptpd-options

ms-dns 8.8.8.8

ms-dns 4.2.2.2

4、 添加用户,编辑 /etc/ppp/chap-secrets

#帐号   服务器    密码     IP地址

user   pptpd    mm1234  *

5、 重启pptpd

service pptpd restart

以上我们完成了***服务配置,但不能连接到外网,接下来继续做nat转换设置

7、编辑 /etc/sysctl.conf

net.ipv4.ip_forward=1 //这行的注释去掉

#使得配置立即生效

sysctl –p

8、向iptables添加NAT规则

iptables -t nat -A POSTROUTING -s 172.25.1.0/24 -o eth0 -j MASQUERADE

9、保存iptables配置到文件

iptables-save > /etc/iptables-rules

10、新建 /etc/network/if-pre-up.d/iptables,添加内容

#!/bin/sh

iptables-restore > /etc/iptables-rules

#给予文件执行权限

chmod 0755 /etc/network/if-pre-up.d/iptables


猜你喜欢

转载自blog.51cto.com/15015155/2554679