Loading... 环境:Ubuntu Server 14.04 位于Amazon EC2 网卡:eth0 软件:pptpd 步骤: 1、 安装pptpd <pre>sudo aptitude install pptpd</pre> 2、 设置虚拟ip,编辑 /etc/pptpd.conf <pre> localip 172.25.1.1 remoteip 172.25.1.10-20 </pre> 3、 设置dns,编辑 /etc/ppp/pptpd-options <pre> ms-dns 8.8.8.8 ms-dns 4.2.2.2 </pre> 4、 添加用户,编辑 /etc/ppp/chap-secrets #帐号 服务器 密码 IP地址 <pre>user pptpd mm1234 *</pre> 5、 重启pptpd <pre>service pptpd restart</pre> 以上我们完成了vpn服务配置,但不能连接到外网,接下来继续做nat转换设置 7、编辑 /etc/sysctl.conf <pre>net.ipv4.ip_forward=1 //这行的注释去掉</pre> #使得配置立即生效 <pre>sysctl –p</pre> 8、向iptables添加NAT规则 <pre>iptables -t nat -A POSTROUTING -s 172.25.1.0/24 -o eth0 -j MASQUERADE</pre> 9、保存iptables配置到文件 <pre>iptables-save > /etc/iptables-rules</pre> 10、新建 /etc/network/if-pre-up.d/iptables,添加内容 <pre> #!/bin/sh iptables-restore > /etc/iptables-rules </pre> #给予文件执行权限 <pre>chmod 0755 /etc/network/if-pre-up.d/iptables</pre> Last modification:October 6, 2023 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 如果觉得我的文章对你有用,请随意赞赏
6 comments
/etc/network/if-pre-up.d/iptables应该为
iptables-restore < /etc/iptables-rules 吧
不是,这是是开机自动加载的!
现在 还能用吗
可以的,需要有外币的信用卡!
这个洞洞就能进去吗?
可以看看墙外的世界!