欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

linux中配置pptp服务器配置的方法

程序员文章站 2023-11-20 11:04:04
1、验证内核是否加载了mppe模块: modprobe ppp-compress-18 && echo mppe is ok 2、安装所需的软件包: yum -y i...

1、验证内核是否加载了mppe模块:

modprobe ppp-compress-18 && echo mppe is ok

2、安装所需的软件包:

yum -y install ppp
wget ftp://rpmfind.net/linux/epel/7/x86_64/p/pptpd-1.4.0-2.el7.x86_64.rpm
rpm -ivh pptpd-1.4.0-2.el7.x86_64.rpm

3、配置ppp和pptp的配置文件:

grep ^[^#] /etc/ppp/options.pptpd
vi /etc/ppp/options.pptpd

name pptpd
#refuse-pap
#refuse-chap
#refuse-mschap
require-mschap-v2
require-mppe-128
ms-dns 8.8.8.8
ms-dns 8.8.4.4
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd

vi /etc/ppp/chap-secrets

username  pptpd  passwd  *

vi /etc/pptpd.conf

option /etc/ppp/options.pptpd
logwtmp
localip 192.168.0.1
remoteip 192.168.0.207-217

4、打开内核的ip转发功能:

vi /etc/sysctl.conf

net.ipv4.ip_forward = 1

/sbin/sysctl -p

5、配置防火墙和nat转发

yum install iptables-services
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl enable iptables.service
systemctl start iptables.service

开启包转发:

iptables -t nat -a postrouting -s 192.168.0.0/24 -o eno16777736 -j masquerade
service iptables save
service iptables restart

开放端口和gre协议:

iptables -a input -p tcp -m state --state new,related,established -m tcp --dport 1723 -j accept
iptables -a input -p gre -m state --state new,related,established -j accept
iptables -t nat -a postrouting -s 192.168.0.0/24 -o eno16777736 -j masquerade

添加规则:

iptables -a input -p gre -j accept
iptables -a input -p tcp -m tcp --dport 1723 -j accept
iptables -a input -m state --state related,established -j accept
iptables -a forward -s 192.168.0.0/24 -o eno16777736 -j accept
iptables -a forward -d 192.168.0.0/24 -i eno16777736 -j accept
iptables -t nat -a postrouting -s 192.168.0.0/24 -o eno16777736 -j masquerade
service iptables save

启动和查看服务:

systemctl start pptpd
systemctl enable pptpd
systemctl status pptpd

6.查看pptpd服务进程和端口:

#ps -ef | grep pptpd
root   25100   1 0 14:19 ?    00:00:00 /usr/sbin/pptpd -f
root   25463 24275 0 14:52 pts/0  00:00:00 grep --color=auto pptpd
# netstat -nutap | grep pptpd
tcp    0   0 0.0.0.0:1723      0.0.0.0:*        listen   25100/pptpd 

以上就是小编为大家带来的linux中配置pptp服务器配置的方法全部内容了,希望大家多多支持~