GNU\Debian搭建PPTP Server

1、获取软件源更新

sudo apt-get update

2、安装pptp包

sudo apt-get install pptpd

3、修改pptp配置文件

sudo vim /etc/pptpd.conf

取消注释并修改服务端ip和客户端ip池

localip 192.168.0.254
remoteip 192.168.0.1-252,192.168.0.253


修改DNS

sudo vim /etc/ppp/options

在最下方添加

ms-dns 208.67.222.222
ms-dns 208.67.220.220


编辑sysctl文件

sudo vim /etc/sysctl.conf

取消net.ipv4.ip_forward的注释

net.ipv4.ip_forward=1

保存sysctl

sysctl -p

重启PPTP Server

sudo /etc/init.d/pptpd restart

4、管理PPTP用户

sudo vim /etc/ppp/chap-secrets

格式为:"Username"  pptpd  passwd "*"

例如:

"test"  pptpd  123456  "*"

5、设置转发

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j SNAT --to-source 0.0.0.0

192.168.0.0/24  ==>为客户端地址池网段

eth0  ==>为网卡名称

0.0.0.0  ==>为当前IP地址

动态地址请执行下方语句:

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


6、保存转发

iptables-save > /etc/iptables.pptp

7、设置pptp自起

chkconfig pptpd on
chkconfig iptables on

8、设置转发自起

sudo vim /etc/network/if-up.d/iptables

内容为

#!/bin/sh

iptables-restore < /etc/iptables.pptp

设置执行权限

sudo chmod 755 /etc/network/if-up.d/iptables

读取=4,写入=2,执行=1

9、重启系统

reboot

或执行

iptables-restore /etc/iptables.pptp



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宇佐见丶泓彦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值