红联Linux门户
Linux帮助

RH Linux 9下面的VPN Server架设指南

发布时间:2006-10-30 01:03:30来源:红联作者:tongxiaokun
  Server: Red Hat Linux 9 Kernel 2.6.10

  Client: Win2000 Pro/Server SP4,WinXP SP2

  Server所需要:

  www.kernel.org
  kernel: linux-2.6.10.tar.bz2

  http://www.polbox.com/h/hs001/
  kernel_patch: linux-2.6.10-mppe-mppc-1.2.patch.gz
  pppd: ppp-2.4.3.tar.gz
  pppd_patch: ppp-2.4.3-mppe-mppc-1.1.patch.gz
  pptpd: pptpd-1.2.3.tar.gz

  为了方便起见,可以把它们放在同一个目录下

  我不喜欢用RPM方式安装,所以都是用的源码方式编译安装
一、先给内核打补丁

# tar zjvf linux-2.6.10.tar.bz2
# gunzip linux-2.6.10-mppe-mppc-1.2.patch.gz
# patch -p0 -i linux-2.6.10-mppe-mppc-1.2.patch
# ln -s linux-2.6.10 linux
# cd linux
# make menuconfig
Device Drivers -> Networking Support->


  把 "PPP support" 编进内核,你也可作为模块编译。

PPP Support for async serial ports
PPP Support for sync tty ports
PPP Deflate compression
Microsoft PPP compression/encryption (MPPC/MPPE)"
Cryptographic options


  把 "Cryptographic API" 编进内核,你也可作为模块编译。确保SHA1 和 ARC4 支持已经选上:

SHA1 digest algorithm
ARC4 cipher algorithm


  保存配置文件,退出

  编译内核

  make all modules modules_install install

  修改/etc/modprobe.conf (2.4的Kernel请修改/etc/modules.conf)

  重启,进入2.6.10

二、安装PPP

  安装之前先用 rpm -qa |grep ppp 看一下是否系统有安装RH9自带的ppp-2.4.1-10

  如果有的话, 用 rpm -e 卸载先,可能还有依赖关系,依次卸载,如:

#rpm -e rp-pppoe-3.5-2
#rpm -e wvdial-1.53-9
#rpm -e ppp-2.4.1-10

# tar xzvf ppp-2.4.3.tar.gz
# gunzip ppp-2.4.3-mppe-mppc-1.1.patch
# patch -p0 -i ppp-2.4.3-mppe-mppc-1.1.patch
# cd ppp-2.4.3
# ./configure
# make; make install


  三、安装 pptpd


#tar xzvf pptpd-1.2.3.tar.gz
# ./configure
# make; make install


  相关的配置文件:

/etc/pptpd.conf
# pptpd的基本配置文件
/etc/ppp/options.pptpd
# VPN拨号选项
/etc/ppp/chap-secrets
# 用户名和密码信息
/etc/modules.conf
# 模块加载信息
(2.4的Kernel请修改/etc/modules.conf)

vi /etc/pptpd.confppp /usr/local/sbin/pppd
#指定pppd的路径
option /etc/ppp/options.pptpd
# 指定option 文件位置
localip 192.168.1.3
#同服务器的LAN地址
remoteip 192.168.1.230-239
#分配?客户端的ip


  本例范围从192.168.1.230到192.168.1.239。您也可以单独指定某个地址或者多段地址,用逗号隔开,如在192.168.1.230-239,192.168.1.254

vi /etc/ppp/options.pptpd

name *
lock
mtu 1450
mru 1450
proxyarp
auth
ipcp-accept-local
ipcp-accept-remote
lcp-echo-failure 3
lcp-echo-interval 5
deflate 0
# Handshake Auth Method
- 加密协议类型
+chap
+mschap-v2
# Data Encryption Methods
mppe required,stateless
其它详细说明请参见 man pppd
或者 man pptpd

vi /etc/ppp/chap-secrets
#client server Password IP Address
test * 12345 *


因为密码是明文显示的,最好能修改文件权限,使root作为owner和chmod 700

vi /etc/modules.conf
alias char-major-108 ppp_generic
alias /dev/ppp ppp_generic
alias tty-ldisc-3 ppp_async
alias tty-ldisc-14 ppp_synctty
alias ppp-compress-18 ppp_mppe_mppc
alias ppp-compress-21 bsd_comp
alias ppp-compress-24 ppp_deflate
alias ppp-compress-26 ppp_deflate


  重新启动

# reboot


  在我这里 alias ppp-compress-18 ppp_mppe_mppc 好像没用,只好手动加载:

# modprobe ppp_mppe_mppc


  确认内核支持

strings `which pppd`|grep -i mppe|wc --lines
30
###大于等于30就行#####
[strings `which pppd`|grep -i mppc|wc --lines
7
#### 不为 0 #####
dmesg | grep MPPE
MPPE/MPPC encryption/compression module registered


  启动pptpd

# /usr/local/sbin/pptpd
Mar 17 23:07:32 localhost pptpd[4471]:
MGR: Manager process started
Mar 17 23:07:32 localhost pptpd[4471]:
MGR: Maximum of 10 connections available


  设置客户端连接,“安全”里面选择自定义,如图所示,这里取决于你在option.pptpd里面的设置:

Mar 17 23:09:59 localhost pptpd[4473]:
CTRL: Client 192.168.1.136
control connection started
Mar 17 23:09:59 localhost pptpd[4473]:
CTRL: Starting call
(launching pppd, opening GRE)
Mar 17 23:09:59 localhost pppd[4474]:
pppd 2.4.3 started by root, uid 0
Mar 17 23:09:59 localhost pppd[4474]:
Using interface ppp0
Mar 17 23:09:59 localhost pppd[4474]:
Connect: ppp0 <--> /dev/pts/1
Mar 17 23:10:02 localhost pptpd[4473]:
CTRL: Ignored a SET LINK INFO
packet with real ACCMs!
Mar 17 23:10:02 localhost pppd[4474]:
MPPC/MPPE 128-bit stateless compression enabled
Mar 17 23:10:04 localhost pppd[4474]:
found interface eth0 for proxy arp
Mar 17 23:10:04 localhost pppd[4474]:
local IP address 192.168.1.3
Mar 17 23:10:04 localhost pppd[4474]:
remote IP address 192.168.1.230

  成功!
文章评论

共有 2123 条评论

  1. 0.0.0.* 于 2007-03-07 06:51:58发表:

    I have already found your site to be very helpful. It is especially nice for newcomers as well as people that have been here for a while. I am sure I will come and check it often. horseshoe casino tunica mississippi casino to play offline sim slots game antique slots machine for sale playtech casino bonus cheat game poker series video world video poker tip argosy casino hotel lawrenceburg best online casino fastest payouts arizona casino charlies decatur hotel

  2. 0.0.0.* 于 2007-03-06 20:07:44发表:

    The site is easy to use and very helpful. Thank you for this wonderful service. I am recommending it to everyone. ringtone converter motorola ringtone free cell phone ringtone payday loan colorado payday loan no fax document payday loan debt online payday loan utah real music ringtones ringtones free us cellular ringtone payday loan on line

  3. 0.0.0.* 于 2007-03-06 07:53:17发表:

    Thank you for your hard work in providing this excellent service to our wonderful worldbour!! It will be such a help to stay informed of so much that's happening. best online blackjack roulette system uk bus to mohegan sun casino best casino gambling online play no deposit casino bonus forum cash creek casino ca baccarat the internet casino free on line slots machine casino hard hotel joint rock american odds roulette