1.硬件资源:服务器一台
PIX 525UR防火墙一台
2.软件资源:Mandrake 9.2
kernelmod
pptpd
Super-freeswan
iptables
公网ip地址
注:我在测试了几种LINUX(包括Redhat,SuSE,Mandrake,Astaro)后,感觉Mandrake是最简单,最稳妥的平台.
下面就是安装过程:
1.操作系统安装:
安装过程无特殊要求,在选择安装组件的时候除开发工具外其它一概不选,主要是出于安全性考虑.
2.安装kernelmod:
tar zxvf kernelmod-0.7.1.tar.gz
cd /kernelmod
./ kernelmod.sh
3.安装pptpd:
①升级ppp
rpm –Uvh ppp-2.4.2-0.1b3.i386.rpm
②安装pptpd
rpm –ivh pptpd-1.1.4-1b4.fr.i386.rpm
4.安装Super-freeswan:
rpm –ivh super-freeswan-1.99.8-8.2.100mdk.i586.rpm
5.升级iptables
rpm –Uvh iptables-1.2.8-12.i386.rpm
呵...至此,全部的安装过程就完成了,简单吧,
注:以上软件都可以在rpmfind.net找到!
下面是最主要的配置过程:
1.操作系统的配置:
①升级openssh
②关闭不需要的服务(sendmail isdn …)
③编辑/etc/sysctl.conf
net.ipv4.ip_forward = 0=>1
net.ipv4.conf.default.rp_filter = 1=>0
2.Pix配置文件(VPN部分):
access-list inside_outbound_nat0_acl permit ip "南京IP段" 255.255.255.0 "公司VPN用户的IP段" 255.255.255.0
access-list outside_cryptomap_20 permit ip "南京IP段" 255.255.255.0 "公司VPN用户的IP段" 255.255.255.0
nat (inside) 0 access-list inside_outbound_nat0_acl
sysopt connection permit-ipsec
crypto ipsec transform-set ESP-3DES-MD5 esp-3des esp-md5-hmac
crypto map outside_map 20 ipsec-isakmp
crypto map outside_map 20 match address outside_cryptomap_20
crypto map outside_map 20 set peer "VPN服务器的IP"
crypto map outside_map 20 set transform-set ESP-3DES-MD5
crypto map outside_map interface outside
isakmp enable outside
isakmp key "密码" address "VPN服务器的IP" netmask 255.255.255.255 no-xauth no-config-mode
isakmp identity address
isakmp policy 20 authentication pre-share
isakmp policy 20 encryption 3des
isakmp policy 20 hash md5
isakmp policy 20 group 2
isakmp policy 20 lifetime 28800
3.PPtP配置
①/etc/pptpd.conf
speed 115200
option /etc/ppp/options
localip "公司VPN用户的网关(例如10.0.1.1)"
remoteip "公司VPN用户的IP段(例如10.0.1.200-250)"
②/etc/ppp/chap-secrets
“用户名” "VPN服务器的IP" “密码” 10.0.1.20X (200
③/etc/ppp/options
lock
name "VPN服务器的IP"
mtu 1490
mru 1490
proxyarp
auth
-chap
-mschap
+mschap-v2
require-mppe
ipcp-accept-local
ipcp-accept-remote
lcp-echo-failure 3
lcp-echo-interval 5
ms-dns X.X.X.X
deflate 0
4.Super-freeswan配置
①/etc/freeswan/ipsec.conf
# basic configuration
config setup
# THIS SETTING MUST BE CORRECT or almost nothing will work;
# %defaultroute is okay for most simple cases.
interfaces="ipsec0=eth0"
# Debug-logging controls: "none" for (almost) none, "all" for lots.
klipsdebug=none
plutodebug=none
# Use auto= parameters in conn descriptions to control startup actions.
plutoload=%search
plutostart=%search
# Close down old connection when new one using same ID shows up.
uniqueids=yes
nat_traversal=yes
# defaults for subsequent connection descriptions
# (these defaults will soon go away)
conn %default
keyingtries=0
disablearrivalcheck=no
authby=rsasig
#leftrsasigkey=%dnsondemand
#rightrsasigkey=%dnsondemand
conn pix
left="VPN服务器的IP"
leftnexthop="VPN服务器的网关"
leftsubnet="公司VPN用户的IP段(例如10.0.1.0/32)"
right="南京PIX525UR的IP"
rightnexthop=%direct
rightsubnet="南京IP段"
authby=secret
pfs=no
auto=start
②/etc/freeswan/ipsec.secrets
"VPN服务器的IP" "南京PIX525UR的IP": PSK "密码"
5.iptables配置(样本),用以限制公司VPN用户的访问权限:
iptables -t nat -A POSTROUTING -o eth0 -s 10.0.1.201/32 -d "南京IP段" -j MASQUERADE
service iptables save
注:1.添加用户名及修改密码 /etc/ppp/chap-secrets
2.用户权限设定 编辑修改iptables规则
3.如果公司路由器上有access-list,则添加
permit 47 any host 219.238.213.244
4.校验IPsec服务是否启动成功
ipsec verify