电脑技术学习

mpd pptp server 配置实例

dn001
查了一下,似乎关于mpd的文章不多,把自己的一个笔记贴出来,大家多指教

代码:
mpd pptp server 配置实例

from: https://bbs.bsdbase.com/index.php?s=&act=ST&f=1&t=125

mpd pptp server 配置实例

Aborigen Yin(阿土)
tutu@bsdbase.com
2003.03.12

mpd 是FreeBSD下的pptp 综合工具,可以用来做pptp客户端和服务器,通过适当配置作vpn也不错,这里只是一个作pptp server的实例

mpd自己带的文档已经很详细了,如果你需要其他的功能,看看文档吧,E文的。

#内核应该有如下支持
# 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 install
cd /usr/local/etc/mpd

#开放5个拨入;
#vi /usr/local/etc/mpd/mpd.conf
#begin of mpd.conf
#
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 keep-alive 10 60
set ipcp yes vjcomp
set ipcp dns 211.239.166.211
# 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

#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强行结束,否则可能导致进程不能正常关闭设备,必须重新启动系统才能恢复;

#服务管理脚本;
#vi /usr/local/sbin/mpd.sh

#!/bin/sh
case "$1" in

start)
if [ -x /usr/local/sbin/mpd ]; then
/usr/local/sbin/mpd -b -d /usr/local/etc/mpd -f mpd.conf && echo 'Mpd PPtP server started.'
fi


stop)
killall mpd && echo 'Mpd PPtP server stopped.'

restart)
echo .
echo Restart Mpd PPtP server ......
$0 stop
sleep 10
$0 start

*)
echo "$0 start | stop | restart"


esac
#end of mpd.sh

chmod 700 /usr/local/sbin/mpd.sh
#设置开机自动执行
ln -s /usr/local/sbin/mpd.sh /usr/local/etc/rc.d/mpd.sh

#配置日志记录
touch /var/log/mpd.log
#vi /etc/syslog.conf
#添加如下,!mpd表示mpd这个进程;
!mpd
*.* /var/log/mpd.log
#vi /etc/newsyslog.conf
/var/log/mpd.log 644 5 100 * Z
#重新启动syslogd
killall -HUP syslogd

####################################
mpd.sh restart



另外,红袖曾经投诉过论坛吃空格的问题,我发现,可以用code这个功能解决,试试?

标签: