1. 程式人生 > >Centos安裝PPTPD

Centos安裝PPTPD

internet 網絡安全 release 服務器 ip地址

PPTP(Point to Point Tunneling Protocol),即點對點隧道協議。該協議是在PPP協議的基礎上開發的一種新的增強型安全協議,支持多協議虛擬專用網(VPN),可以通過密碼驗證協議(PAP)、可擴展認證協議(EAP)等方法增強安全性。可以使遠程用戶通過撥入ISP、通過直接連接Internet或其他網絡安全地訪問企業網


實驗環境:

系統版本:CentOS release 6.5 (Final)

網卡IP地址:eth0=192.168.1.106 eth1=10.0.0.1

內網地址:192.168.1.106

外網地址:10.0.0.1

一、PPTP的安裝與配置

1、檢查服務器是否支持PPTP服務

[[email protected] ~]# modprobe ppp-compress-18 && echo ok

ok

以上命令執行出來顯示是“OK”的話,繼續往下進行!

[[email protected] ~]# cat /dev/net/tun

cat: /dev/net/tun: 文件描述符處於錯誤狀態

以上命令執行出來顯示報錯的話,繼續往下進行!


以上兩條命令執行都通過,才能安裝PPTP。


2、安裝PPTP

[[email protected] ~]# yum install ppp \\輸出的內容太多,我就不復制出來了

[[email protected]

/* */ ~]# rpm -i http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm

[[email protected] ~]# yum -y install pptpd

3、更改配置文件

找到“locapip”和“remoteip”這兩個配置項,更改為你期望的IP段值。localip表示服務器的IP,remoteip表示分配給客戶端的IP地址,可以設置為區間。這裏我們使用pptp默認的配置:

localip 192.168.1.106

remoteip 192.168.1.20-200

編輯/etc/ppp/options.pptpd文件,添加DNS,一般只需要更改ms-dns就可以

ms-dns 8.8.8.8

ms-dns 8.8.4.4

二、PPTP的賬號、密碼配置

1、添加賬號

需要編輯/etc/ppp/chap-secrets文件

[[email protected] ~]# vim /etc/ppp/chap-secrets

# Secrets for authentication using CHAP

# client server secret IP addresses

machenxi * machenxi *


client //用戶賬號,需要用雙引號包含

server //代表自動識別當前服務器主機名,也可以手動配置

secret //用戶密碼,需要用雙引號包含

IP address //代表自動分配可用的IP地址,可根據需要指定IP地址


除了上面編輯文件,還可以用命令來創建用

[[email protected] ~]# vpnuser add jackware jackware

[[email protected] ~]# cat /etc/ppp/chap-secrets \\多了一個jackware的賬號

# Secrets for authentication using CHAP

# client server secret IP addresses

machenxi * machenxi *

jackware * jackware *

[[email protected] ~]# vpnuser del jackware

[[email protected] ~]# cat /etc/ppp/chap-secrets \\jackware的賬號刪除掉了

# Secrets for authentication using CHAP

# client server secret IP addresses

machenxi * machenxi *


PPTPD配置ok,重啟服務

[[email protected] ~]# service pptpd restart

Shutting down pptpd: [確定]

Starting pptpd: [確定]

Warning: a pptpd restart does not terminate existing

connections, so new connections may be assigned the same IP

address and cause unexpected results. Use restart-kill to

destroy existing connections during a restart.

接下來到Windows機器上面做下驗證吧。


這個時候ifconfig看一看網卡信息,是不是多出了一個ppp0的接口

[[email protected] ppp]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:0C:29:B5:3C:1C

inet addr:192.168.1.106 Bcast:192.168.1.255 Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:feb5:3c1c/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:8242 errors:0 dropped:0 overruns:0 frame:0

TX packets:5920 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:8299985 (7.9 MiB) TX bytes:650125 (634.8 KiB)


eth1 Link encap:Ethernet HWaddr 00:0C:29:B5:3C:26

inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0

inet6 addr: fe80::20c:29ff:feb5:3c26/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:28 errors:0 dropped:0 overruns:0 frame:0

TX packets:23 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:6832 (6.6 KiB) TX bytes:3198 (3.1 KiB)


ppp0 Link encap:Point-to-Point Protocol

inet addr:192.168.1.106 P-t-P:192.168.1.20 Mask:255.255.255.255

UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1396 Metric:1

RX packets:81 errors:0 dropped:0 overruns:0 frame:0

TX packets:29 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:3

RX bytes:7108 (6.9 KiB) TX bytes:4874 (4.7 KiB)


本文出自 “天黑請閉眼” 博客,請務必保留此出處http://machenxi.blog.51cto.com/9840008/1922577

Centos安裝PPTPD