小岑博客

  • 首页
  • VMware
  • 实验室
  • 培训&认证
  • 关于我
  • 分类目录
    • Citrix
    • Linux
    • Windows
    • 互联网
    • 存储
    • 虚拟化
    • 超融合
  1. 首页
  2. Linux
  3. 正文

EC2 Ubuntu14.04安装pptp vpn

2014年12月28日 6842点热度 0人点赞 6条评论

环境: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

以上我们完成了vpn服务配置,但不能连接到外网,接下来继续做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
本作品采用 知识共享署名-非商业性使用 4.0 国际许可协议 进行许可
标签: PPTP ubuntu 14.04
最后更新:2014年12月28日

小岑

我是小岑,欢迎来到我的博客,青年人,爱捣鼓些东西,对世界充满着好奇,热爱旅游。 这里随便写写,记录些文字,大抵和技术相关。 VMware vExpert | VCIX | VCAP | VCP

点赞
< 上一篇
下一篇 >

文章评论

  • 威客百科

    这个洞洞就能进去吗?

    2014年12月30日
    回复
    • tony

      @威客百科 可以看看墙外的世界!

      2014年12月30日
      回复
  • 威客

    现在 还能用吗

    2015年1月5日
    回复
    • tony

      @威客 可以的,需要有外币的信用卡!

      2015年1月5日
      回复
  • jackstraw

    /etc/network/if-pre-up.d/iptables应该为
    iptables-restore < /etc/iptables-rules 吧

    2015年5月18日
    回复
    • tony

      @jackstraw 不是,这是是开机自动加载的!

      2015年5月19日
      回复
  • razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
    取消回复

    小岑

    我是小岑,欢迎来到我的博客,青年人,爱捣鼓些东西,对世界充满着好奇,热爱旅游。 这里随便写写,记录些文字,大抵和技术相关。 VMware vExpert | VCIX | VCAP | VCP


    COPYRIGHT © 2022 crazycen.com. ALL RIGHTS RESERVED.

    Theme Kratos Made By Seaton Jiang

    鄂ICP备16016796号-1