pptpd 服務發現與配置:

1. 安裝pptpd 服務

yum -y install pptpd #會自動安裝ppp模塊

2. 啓動pptpd 服務

#service pptpd status/start/stop/restart or

服務自啓動

# systemctl status pptpd.service

#chkconfig pptpd on or systemctl enable pptpd.service

3. 配置文件,修改後需要重啓服務

默認 服務  監聽端口 0.0.0.0:1723

# vi /etc/pptpd.conf
打開配置文件後,在最下面找到
#localip 192.168.0.1
#remoteip 192.168.0.234-238,192.168.0.245
將註釋去掉,並改成你自己想要設置的IP段
localip就是指定你服務器的內網IP地址,其實即便網卡沒有配置成這個地址也無所謂
remoteip就是用戶連接到你的服務器後,服務器爲用戶分配的ip地址範圍,注意格式。
localip 10.163.220.120
remoteip 10.163.220.121-245  ##分配的掩碼是多少?我看是32位的

配置options.pptpd文件
# vi /etc/ppp/options.pptpd
打開後,找到下面字段,去掉註釋,並修改成你想要爲用戶分配的dns服務器,一般國內用114.114.114.114即可
ms-dns 114.114.114.114

## 配置用戶名和密碼

/etc/ppp/chap-secrets
輸入以下內容
# Secrets for authentication using CHAP
# client   server secret    IPaddresses
myusername pptpd mypassword *

user1 * passwd1 *

 

####下面的iptables很關鍵,

 

 

 

[root@flexscape ~]# iptables -A POSTROUTING -s 14.14.14.150/32 -d 14.14.14.219/32 -j SNAT --to-source 172.16.162.215 -t nat  
[root@flexscape ~]# iptables -D POSTROUTING -s 14.14.14.150/32 -d 14.14.14.219/32 -j SNAT --to-source 172.16.162.215 -t nat 
[root@flexscape ~]# iptables -A POSTROUTING -s 14.14.14.150/32 -d 14.14.14.219/32 -j SNAT --to-source 14.14.14.215 -t nat                       
[root@flexscape ~]# iptables -A POSTROUTING -s 14.14.14.150/32 -d 14.14.14.144/32 -j SNAT --to-source 14.14.14.215 -t nat   
[root@flexscape ~]# iptables -A POSTROUTING -s 14.14.14.150/32 -d 14.14.14.145/32 -j SNAT --to-source 14.14.14.215 -t nat 
[root@flexscape ~]# iptables -A POSTROUTING -s 14.14.14.150/32 -d 14.14.14.146/32 -j SNAT --to-source 14.14.14.215 -t nat 
[root@flexscape ~]# iptables -A POSTROUTING -s 14.14.14.150/32 -d 0.0.0.0/0 -j SNAT --to-source 172.16.162.215 -t nat

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章