GZICP.com   
 
    返回首页
    联系我们
 
 
     

简单的用PoPToP(pptpd)

www.gzicp.com   2004年4月21日 13:48:35
 

官方地址: http://www.freeswan.org/

1. 内核的编译 

这一步我一直没弄的很明白,但简单的说,基本上如果你的机器已经被配置成一个NAT或者NAPT,那你什么也不需要做了。  否则的话照着配NAT的方法做一下吧,我想应该有用。 

2. pppd的安装 

pppd是必须的软件,pptpd在接收到一个连接之后其实会启动一个pppd,象这样: 
代码: 

23373 ?        S      0:00 /usr/local/sbin/pptpd 
28060 ?        S      0:00  \_ pptpd [218.2.232.89]                                                                          
28061 ?        S      0:00      \_ /usr/sbin/pppd local file /etc/ppp/options.pptpd 115200 192.168.20.234:192.168.20.244 
 


我试了好些个rpm,不是dependency问题,就是装好了不能用。最后还是决定干脆弄个tgz,自己编译安装。我拿的是ppp 2.4.1,在这里可以下载到。 
ftp://ftp.samba.org/pub/ppp/ppp-2.4.1.tar.gz 

安装步骤都差不多啦,完了之后要到/etc/ppp折腾几个文件,一个是options,有的文章建议不要用这个名字,说是会有问题,反正我是建了一个options.pptpd,里面的内容是这样的: 
代码: 

## CHANGE TO SUIT YOUR SYSTEM 
lock 

## turn pppd syslog debugging on 
debug 

## change ’pptpd’ to whatever you specify as your server name in chap-secrets 
name pptpd 

proxyarp 
bsdcomp 0 

# This option applies if you use ppp with chapms-strip-domain patch 
#chapms-strip-domain 
auth 
#ipcp-accept-local 
#ipcp-accept-remote 
#lcp-echo-failure 3 
#lcp-echo-interval 5 
#deflate 0 

# These options apply if you use ppp with mppe patch 
# NB! You should also apply the ChapMS-V2 patch 
require-chap 
#pap 
#chap 
#chapms 
#chapms-v2 
#mppe-128 
#mppe-stateless 
#mppe-40 

# These options will tell ppp to pass on these to your clients 
# To use ms-dns or ms-dns in options.pptpd it must exist in /etc/resolv.conf 
#ms-wins your.server.here 
ms-dns 202.119.32.6 
 

有几处是我折腾得比较费事的,说说 
1. name字指定的名字好象在下面说的chap-secrets要用到 
2. 指定验证的方式的地方到处都找不到帮助,配来配去只好用一个require-chap了事,这样配出来就是只能使用chap验证方式了。  哪位高人要是知道怎么弄也跟咱们说说,  
3. ms-dns指定了之后你的client在被分配IP address的时候就也有一个dns server ip. 
4. 其他我基本上是拷贝别人的,我什么都没改,也满好用的。 

还有一个就是chap-secrets(如果你使用CHAP或者MS-CHAP之类的验证模式的话), 
我的文件是这样的: 
代码: 

Secrets for authentication using CHAP 
# client        server  secret                  IP addresses 
username    pptpd   "password"               * 
#* * &/etc/samba/smbpasswd * 
 


就是用户名,服务名(前面在options.pptpd里面用name关键字指定的),密码,允许哪些地址连。 
密码很好玩,这里是"password",不过到client那里配置vpn的时候密码要去掉那对引号,就输password就好了 

3. pptpd拉。。。  

我在这里找的:http://sourceforge.net/project/showfiles.php?group_id=44827&release_id=138437 

看到1.1.4后面带个b2就没下,觉得是beta版(  ),拿的1.1.3的,也是configure, make, make install。 

好象还有什么2.*.*的版本,搞不懂怎么这么多系列。  

然后就是去/etc下面看看pptpd.conf,没有的话就去拷贝一个吧,基本都不要改的。 

代码: 

################################################################################ 

# Sample PoPToP configuration file 

# for PoPToP version 1.1.3 

################################################################################ 

# TAG: speed 

#       Specifies the speed for the PPP daemon to talk at. 

#speed 115200 

# TAG: option 

#       Specifies the location of the PPP options file. 
#       By default PPP looks in ’/etc/ppp/options’ 

option /etc/ppp/options.pptpd 

# TAG: stimeout 

#       Specifies timeout (in seconds) on starting ctrl connection 

# stimeout 10 

# TAG: debug 

#       Turns on (more) debugging to syslog 

debug 

# TAG: localip 
# TAG: remoteip 

#       Specifies the local and remote IP address ranges. 

#       You can specify single IP addresses seperated by commas or you can 
#       specify ranges, or both. For example: 

#               192.168.0.234,192.168.0.245-249,192.168.0.254 

#       IMPORTANT RESTRICTIONS: 

#       1. No spaces are permitted between commas or within addresses. 

#       2. If you give more IP addresses than MAX_CONNECTIONS, it will 
#          start at the beginning of the list and go until it gets 
#          MAX_CONNECTIONS IPs. Others will be ignored. 

#       3. No shortcuts in ranges! ie. 234-8 does not mean 234 to 238, 
#          you must type 234-238 if you mean this. 

#       4. If you give a single localIP, that’s ok - all local IPs will 
#          be set to the given one. You MUST still give at least one remote 
#          IP for each simultaneous client. 

#localip 172.16.46.100 
#remoteip 172.16.46.234-238 
# or 
localip 192.168.20.234-235 
remoteip 192.168.20.244-245 


就是一个option改改,指向前面配置的/etc/ppp/options.pptpd,然后就是localip和remoteip改改,remote ip就是分给client的啦。 

4. 启动 
然后就用/usr/local/sbin/pptpd启动pptpd吧,不过pptpctrl好象不能用,一起就是segment fault,  反正有一个能用就行了。 

5. 配置client 

2k下创建一个vpn,键入ip地址,"安全措施"里面选择"高级",点"设置",选上chap,其他全部不选,然后"数据加密"里选择"没有加密也可以连接"。这里是我最郁闷的,好象还不会配置使用加密的vpn.... 

 

最新文章
·支持IP-VPN实例  (2004年06月10日)
·MPLS VPN:革新企业网  (2004年06月10日)
·VPN的各种协议介绍  (2004年06月10日)
·应用层VPN实现安全访问  (2004年06月10日)
·VPN实现无限应用  (2004年06月10日)
·MPLS VPN的优势  (2004年06月10日)





 
 
Copyright © 1999-2005 GZICP.com All Rights Reserved