阅读上一个主题 :: 阅读下一个主题 |
作者 |
留言 |
rhinofly 道童
注册时间: 2004-05-07 文章: 233
|
发表于: Tue 2004-06-15 11:31:03 发表主题: mpd pptp server 简易安装实例 |
|
|
代码: |
mpd pptp server 简易安装实例
mpd pptp server mini howto
by 蜗牛/Rhinofly Yin
http://oss4e.org
2004.06.15
关键字: freebsd mpd pptp 安装 配置
版权:GNU Free Documentation License (FDL)
注:这是我把以前自己写的同名笔记稍做修改重新发布,以前的笔记似乎google不到了。
#mpd pptp server
mpd 是FreeBSD下的pptp 综合工具,可以用来做pptp客户端和服务器,通过适当配置作vpn也不错,这里只是一个作pptp server的实例
mpd自己带的文档已经很详细了,如果你需要其他的功能,看看文档吧,E文的。
#URL:http://www.sourceforge.net/projects/mpd
由于mpd pptp server配置非常简单快捷,而pptp通道的安全性还是相当高的,因此,很多时候,我用来作为连接到自己的服务器进行管理的
安全通道,一些基于web的管理是不加密的,pptp端到端的加密正好弥补了这个漏洞。
而现在mpd也支持RADIUS验证,如果你想要做稍微大型一点的pptp server也未尝不可。
#内核应该有如下支持
# for mpd pptp server
options NETGRAPH #netgraph(4) system
options NETGRAPH_ASYNC
options NETGRAPH_BPF
options NETGRAPH_ECHO
options NETGRAPH_ETHER
options NETGRAPH_HOLE
options NETGRAPH_IFACE
options NETGRAPH_KSOCKET
options NETGRAPH_LMI
# MPPC compression requires proprietary files (not included)
#options NETGRAPH_MPPC_COMPRESSION
options NETGRAPH_MPPC_ENCRYPTION
options NETGRAPH_PPP
options NETGRAPH_PPTPGRE
options NETGRAPH_RFC1490
options NETGRAPH_SOCKET
options NETGRAPH_UI
#end
#虽然系统会自动加载相应的内核模块,如果你的内核中没有以上选项,但是还是建议编译到内核里;
#安装、配置mpd pptp server.
cd /usr/ports/net/mpd
make clean
make install
make clean
#开放5个拨入;
#ports带来的配置文件样例里有很多种情形下的配置,我们只取其中的pptp server部分。
#vi /usr/local/etc/mpd/mpd.conf
#begin of mpd.conf
#
#default 部分表示启动mpd时激活的项目;
default:
load client1
load client2
load client3
load client4
load client5
client1:
new -i ng0 pptp1 pptp1
set ipcp ranges 172.16.120.80/32 172.16.120.100/32
load client_standard
#
client2:
new -i ng1 pptp2 pptp2
set ipcp ranges 172.16.120.81/32 172.16.120.101/32
load client_standard
#
client3:
new -i ng2 pptp3 pptp3
set ipcp ranges 172.16.120.82/32 172.16.120.102/32
load client_standard
#
client4:
new -i ng3 pptp4 pptp4
set ipcp ranges 172.16.120.83/32 172.16.120.103/32
load client_standard
#
client5:
new -i ng4 pptp5 pptp5
set ipcp ranges 172.16.120.84/32 172.16.120.104/32
load client_standard
#
client_standard:
set iface disable on-demand
#set iface enable proxy-arp
#set iface idle 1800
set bundle enable multilink
set link yes acfcomp protocomp
set link no pap chap
set link enable chap
#set link mtu 1460
set link mtu 1260
set link keep-alive 10 60
set ipcp yes vjcomp
set ipcp dns 61.145.117.164
# set ipcp nbns 172.16.120.4
set bundle enable compression
set ccp yes mppc
set ccp yes mpp-e40
set ccp yes mpp-e128
set ccp yes mpp-stateless
#end of mpd.conf
###注意:mpd现在支持RADIUS验证
radius:
# You can use radius.conf(5), its useful, because you can share the
# same config with userland-ppp and other apps.
set radius config /etc/radius.conf
# and/or specify the server directly here
set radius retries 3
set radius timeout 3
set radius server localhost testing123 1812 1813
# send the given IP in the RAD_NAS_IP_ADDRESS attribute to the server.
set radius me 1.1.1.1
# send accounting updates every 5 minutes
set radius acct-update 300
# let the RADIUS server assign the IP
set ipcp enable radius-ip
# enable RADIUS, and fallback to mpd.secret, if RADIUS auth failed
set bundle enable radius-auth radius-fallback
# enable RADIUS accounting
set bundle enable radius-acct
# use idle-timeout, session-timeout, routes list and mtu from the RADIUS server
set iface enable radius-idle radius-session radius-mtu radius-route
# activate MPPE and let the RADIUS server assign MPPE-types and MPPE-policies
set bundle enable compression
set ccp yes mppc
set ccp enable radius
##################
#vi /usr/local/etc/mpd/mpd.links
#bengin of mpd.links
pptp1:
set link type pptp
set pptp self 0.0.0.0
set pptp enable incoming
set pptp disable originate
#
pptp2:
set link type pptp
set pptp self 0.0.0.0
set pptp enable incoming
set pptp disable originate
#
pptp3:
set link type pptp
set pptp self 0.0.0.0
set pptp enable incoming
set pptp disable originate
#
pptp4:
set link type pptp
set pptp self 0.0.0.0
set pptp enable incoming
set pptp disable originate
#
pptp5:
set link type pptp
set pptp self 0.0.0.0
set pptp enable incoming
set pptp disable originate
#
#end of mpd.links
#注意:mpd.conf里面,每一个配置项的link名称(new -i ng0 pptp1 pptp1,这一行定义),
#比如client1(links = pptp1),client2(links = pptp2),在mpd.links中必须有相应的link type定义,
#pptp1:
# set link type pptp
#pptp2:
# set link type pptp
#其他类推;
#用户名和密码;
#vi /usr/local/etc/mpd/mpd.secret
#bengin of mpd.secret
#username <---> password <-----> ip address range to user
#这里可以指定某个用户拨号时使用的地址
#user1 fortest 172.16.120.111/24
#也可以不指定
user1 fortest
#end of mpd.secret
#注意:杀死进程时不要使用-9强行结束,否则可能导致进程不能正常关闭设备,必须重新启动系统才能恢复;
#使用懒得delay start up
#cp /usr/local/etc/rc.d/mpd.sh.sample /usr/local/modules/public/etc/rc.d/mpd-server
#ln -s /usr/local/modules/public/etc/rc.d/mpd-server /usr/local/sbin
#一般做法
cp /usr/local/etc/rc.d/mpd.sh.sample /usr/local/etc/rc.d/mpd-server.sh
#配置日志记录
touch /var/log/mpd.log
#FreeBSD 4.x的做法
#vi /etc/syslog.conf
#添加如下,!mpd表示mpd这个进程;
!mpd
*.* /var/log/mpd.log
#FreeBSD 5.x的做法
##奇怪,FBSD 5.2.1无daemon项目
daemon.* /var/log/mpd.log
####
#vi /etc/newsyslog.conf
/var/log/mpd.log 644 5 100 * Z
#重新启动syslogd
killall -HUP syslogd
####################################
|
_________________ -
蜗牛的蜗,蜗牛的牛.
-
Keep It Simple, Stupid.
-
msn&email:rhinofly@oss4e.net
-
旧时澳洲林中土,幻作中原飞天牛
- |
|
返回页首 |
|
 |
webman 道童

注册时间: 2002-07-05 文章: 351
|
发表于: Wed 2004-06-16 00:10:06 发表主题: |
|
|
严格按步骤做!但就是在4.9上没成功!
表现为:能拨号并验证通过,连接上。但就是ping不通对方网络中任意一台PC(相同网段),另该如何指定VPN客户端的网关? |
|
返回页首 |
|
 |
韬光晦影 道童

注册时间: 2004-03-05 文章: 447 来自: sn
|
发表于: Wed 2004-06-16 00:19:46 发表主题: |
|
|
rhino很凶,要学习之~~! _________________ ��⊙⊙─┐
/. │韬光晦影 http://www.d2cn.com ┌
└──┴┴───────────────┘ |
|
返回页首 |
|
 |
123 半仙
注册时间: 2004-03-04 文章: 165
|
发表于: Wed 2004-06-16 08:16:41 发表主题: |
|
|
学习! |
|
返回页首 |
|
 |
rhinofly 道童
注册时间: 2004-05-07 文章: 233
|
发表于: Wed 2004-06-16 09:40:10 发表主题: |
|
|
pptp只是点到点的通道,你想ping通对方网络中任意一台PC,就应该自己计划好路由,mpd并不给你自动添加其他需要的路由;
pptp能连接说明mpd已经没问题。
假设网络拓扑:
公司LAN (192.168.100.0/24 gateway:192.168.100.254)
|
|
fxp0 -- 连接内网
192.168.100.254/24
mpd server+ipfilter nat
211.97.xxx.xxx/28
gateway:211.97.xxx.254
fxp1 --连接公网
|
|
|
|
202.96.134.133/24
gateway:202.96.134.254
pptp client
要想pptp client连接mpd后能直接访问公司LAN内的机器,有几个地方要注意:
1.公司lan内机器的tcpip设置中gateway指向mpd server(实际上可以有其他的设置方法,但那要复杂好多);
2.mpd 的配置中,使用的pptp通道地址,不可以跟lan使用的私网地址同网段(实际上可以相同,但是,需要更复杂的设置);
3.pptp client上不可以有别的网卡有跟lan使用的私网地址同网段的ip(实际上可以相同,但是,需要更复杂的设置);
4.如此设置,tcpip访问内网是没有问题的,但要注意的是,mpd在此是充当路由器的功能(而不是交换机),因此,试图通过浏览网上邻居来找到lan上的文件共享和打印只能说明你对路由和微软的文件和打印共享认识不足(还是老话,其实也是可以的,但是,需要更多更复杂的设置,如果你懂得这些设置,你就不会对pptp client如何通过mpd访问内网有困惑)。
webman 写到: | 严格按步骤做!但就是在4.9上没成功!
表现为:能拨号并验证通过,连接上。但就是ping不通对方网络中任意一台PC(相同网段),另该如何指定VPN客户端的网关? |
_________________ -
蜗牛的蜗,蜗牛的牛.
-
Keep It Simple, Stupid.
-
msn&email:rhinofly@oss4e.net
-
旧时澳洲林中土,幻作中原飞天牛
- |
|
返回页首 |
|
 |
webman 道童

注册时间: 2002-07-05 文章: 351
|
发表于: Wed 2004-06-16 20:46:16 发表主题: |
|
|
pptp通道地址?是指哪个地址?是pptp client连接上去得到的地址? |
|
返回页首 |
|
 |
rhinofly 道童
注册时间: 2004-05-07 文章: 233
|
发表于: Thu 2004-06-17 12:06:35 发表主题: |
|
|
client1:
new -i ng0 pptp1 pptp1
set ipcp ranges 172.16.120.80/32 172.16.120.100/32
load client_standard
ppp 连接的地址是成对的。 _________________ -
蜗牛的蜗,蜗牛的牛.
-
Keep It Simple, Stupid.
-
msn&email:rhinofly@oss4e.net
-
旧时澳洲林中土,幻作中原飞天牛
- |
|
返回页首 |
|
 |
webman 道童

注册时间: 2002-07-05 文章: 351
|
发表于: Thu 2004-06-17 13:18:31 发表主题: |
|
|
rhinofly 写到: | client1:
new -i ng0 pptp1 pptp1
set ipcp ranges 172.16.120.80/32 172.16.120.100/32
load client_standard
ppp 连接的地址是成对的。 |
我的理解是:前面一个地址是本机连接内网的IP地址!后面一个地址是欲给VPN连上来的客户端地址。
不知道是不是理解正确?
另,我虽然VPN认证通过,在XP里显示连接成功,但只能PING通客户端自己的VPN连接地址,连服务器内网地址也PING不通。
且我只要能PING通同一网段的地址就可以了,这还是需要路由吗? |
|
返回页首 |
|
 |
rhinofly 道童
注册时间: 2004-05-07 文章: 233
|
发表于: Thu 2004-06-17 14:00:27 发表主题: |
|
|
理解错误。
webman 写到: | rhinofly 写到: | client1:
new -i ng0 pptp1 pptp1
set ipcp ranges 172.16.120.80/32 172.16.120.100/32
load client_standard
ppp 连接的地址是成对的。 |
我的理解是:前面一个地址是本机连接内网的IP地址!后面一个地址是欲给VPN连上来的客户端地址。
不知道是不是理解正确?
另,我虽然VPN认证通过,在XP里显示连接成功,但只能PING通客户端自己的VPN连接地址,连服务器内网地址也PING不通。
且我只要能PING通同一网段的地址就可以了,这还是需要路由吗? |
_________________ -
蜗牛的蜗,蜗牛的牛.
-
Keep It Simple, Stupid.
-
msn&email:rhinofly@oss4e.net
-
旧时澳洲林中土,幻作中原飞天牛
- |
|
返回页首 |
|
 |
webman 道童

注册时间: 2002-07-05 文章: 351
|
发表于: Thu 2004-06-17 14:17:11 发表主题: |
|
|
我的理解来源自:mpd.conf.sample
其中是这么写的:
# Mpd as a PPTP server compatible with Microsoft Dial-Up Networking clients.
#
# Suppose you have a private Office LAN numbered 192.168.1.0/24 and the
# machine running mpd is at 192.168.1.1, and also has an externally visible
# IP address of 1.2.3.4.
#
# We want to allow a client to connect to 1.2.3.4 from out on the Internet
# via PPTP. We will assign that client the address 192.168.1.50 and proxy-ARP
# for that address, so the virtual PPP link will be numbered 192.168.1.1 local
# and 192.168.1.50 remote. From the client machine's perspective, it will
# appear as if it is actually on the 192.168.1.0/24 network, even though in
# reality it is somewhere far away out on the Internet.
#
# We 'set link mtu 1460' to avoid GRE packet fragmentation.
您能否说说在mpd.conf.sample中对地址192.168.1.1的理解。
另:
# default:
# load client1
# load client2
# ...
#
# client1:
# new -i ng0 pptp1 pptp1
# set ipcp ranges 192.168.1.1/32 192.168.1.50/32
# load client_standard
# ...
#
# client2:
# new -i ng1 pptp2 pptp2
# set ipcp ranges 192.168.1.1/32 192.168.1.51/32
# load client_standard
# ...
都使用了相同的192.168.1.1/32地址,这和您的配置文件有点不同? |
|
返回页首 |
|
 |
rhinofly 道童
注册时间: 2004-05-07 文章: 233
|
发表于: Fri 2004-06-18 13:02:32 发表主题: |
|
|
proxy-ARP _________________ -
蜗牛的蜗,蜗牛的牛.
-
Keep It Simple, Stupid.
-
msn&email:rhinofly@oss4e.net
-
旧时澳洲林中土,幻作中原飞天牛
- |
|
返回页首 |
|
 |
rhinofly 道童
注册时间: 2004-05-07 文章: 233
|
发表于: Fri 2004-06-18 13:03:08 发表主题: |
|
|
client_standard:
set iface disable on-demand
set iface enable proxy-arp _________________ -
蜗牛的蜗,蜗牛的牛.
-
Keep It Simple, Stupid.
-
msn&email:rhinofly@oss4e.net
-
旧时澳洲林中土,幻作中原飞天牛
- |
|
返回页首 |
|
 |
rhinofly 道童
注册时间: 2004-05-07 文章: 233
|
发表于: Fri 2004-06-18 13:03:34 发表主题: |
|
|
我以为这些选项人人都会看的。 _________________ -
蜗牛的蜗,蜗牛的牛.
-
Keep It Simple, Stupid.
-
msn&email:rhinofly@oss4e.net
-
旧时澳洲林中土,幻作中原飞天牛
- |
|
返回页首 |
|
 |
webman 道童

注册时间: 2002-07-05 文章: 351
|
发表于: Fri 2004-06-18 22:12:01 发表主题: |
|
|
说实话,我对proxy-ARP还不懂其含义!我正在查相关资料!
而对于你的回复也不怎么明白。
或许,这样你感觉很COOL…… |
|
返回页首 |
|
 |
rhinofly 道童
注册时间: 2004-05-07 文章: 233
|
发表于: Sat 2004-06-19 09:23:31 发表主题: |
|
|
也许你会觉得这是Coooooool,对于我来说,我只是不想在论坛的各位老大面前开讲“tcpip协议入门”。
对于一个网络技术员来说,pptp(ppp)协议,路由基础,arp协议是很基础的东西,如果你对这些还不太了解,自己找资料看吧。
BTW:很早很早以前,一个老大说了,论坛是开眼界的地方。 _________________ -
蜗牛的蜗,蜗牛的牛.
-
Keep It Simple, Stupid.
-
msn&email:rhinofly@oss4e.net
-
旧时澳洲林中土,幻作中原飞天牛
- |
|
返回页首 |
|
 |
123 半仙
注册时间: 2004-03-04 文章: 165
|
发表于: Sat 2004-06-19 09:24:05 发表主题: |
|
|
rhinofly,you are really cool!
But my idea is the same as webman's? |
|
返回页首 |
|
 |
|