当前位置: 首页 > 图文教程 > 服务器 > Linux服务器 > 高手进阶Linux架设最简单的VPN系统

Linux服务器
Linux Samba Server的配置详解
Linux系统下配置功能完善的Web服务器
Linux终端代理的设置方法介绍
Fodera Core 7系统下构建CVS服务器的方法
Linux进入系统时自动设置环境变量的方法
介绍GPG命令加密文件的方法
如何清理Linux系统中不需要的文件
Linux系统中两种替代“花生壳”的办法
Linux下配置 Tomcat+JDK+MySQL应用平台
Linux操作系统下RPM软件包的使用技巧
linux知识:htaccess
linux:.htaccess文件使用教程
Apache [forbidden 403]错误的解决办法
FreeBSD6.1快速安装配置Bugzilla2.22
访问网站403错误 Forbidden解决方法
httpd.conf文件配置详解
Apache中禁止IP段,在httpd.conf中的写法
apache禁止使用IP访问的实现方法
Apache中禁止以目录方式访问的设置
.htaccess学习笔记

Linux服务器 中的 高手进阶Linux架设最简单的VPN系统


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-18   浏览: 63 ::
收藏到网摘: n/a

公司在北京,但是主要设备都在南京电信的一个主要IDC里,那边有我们的两个PIX525UR(做了故障切换),上面做了严格的访问控制,因此,为了方便公司里的移动,出差及在家的员工办公,才有了做VPN系统的想法.好使具有相应权限的使用者从个人PC通过支持MPPE128的加密隧道连接至公司的VPNServer,再通过VPNServer将数据转发到南京IDC的我公司应用网络,其间的连接也是基于IPSEC的安全VPN隧道.由此可以保证我公司的所有应用需求的安全性和便捷性.。

1.硬件资源:服务器一台

PIX525UR防火墙一台

2.软件资源:Mandrake9.2

kernelmod

pptpd

Super-freeswan

iptables

公网ip地址

注:我在测试了几种LINUX(包括Redhat,SuSE,Mandrake,Astaro)后,感觉Mandrake是最简单,最稳妥的平台。

下面就是安装过程:

1.操作系统安装:

安装过程无特殊要求,在选择安装组件的时候除开发工具外其它一概不选,主要是出于安全性考虑.

2.安装kernelmod:

tarzxvfkernelmod-0.7.1.tar.gz

cd/kernelmod

./kernelmod.sh

3.安装pptpd:

①升级ppp

rpm–Uvhppp-2.4.2-0.1b3.i386.rpm

②安装pptpd

rpm–ivhpptpd-1.1.4-1b4.fr.i386.rpm

4.安装Super-freeswan:

rpm–ivhsuper-freeswan-1.99.8-8.2.100mdk.i586.rpm

5.升级iptables:

rpm–Uvhiptables-1.2.8-12.i386.rpm

呵...至此,全部的安装过程就完成了,简单吧,

注:以上软件都可以在rpmfind.net找到!

下面是最主要的配置过程:

1.操作系统的配置:

①升级openssh

②关闭不需要的服务(sendmailisdn…)

③编辑/etc/sysctl.conf

net.ipv4.ip_forward=0=>1

net.ipv4.conf.default.rp_filter=1=>0

2.Pix配置文件(VPN部分):

access-listinside_outbound_nat0_aclpermitip"南京IP段"255.255.255.0"公司VPN用户的IP段"255.255.255.0

access-listoutside_cryptomap_20permitip"南京IP段"255.255.255.0"公司VPN用户的IP段"255.255.255.0

nat(inside)0access-listinside_outbound_nat0_acl

sysoptconnectionpermit-ipsec

cryptoipsectransform-setESP-3DES-MD5esp-3desesp-md5-hmac

cryptomapoutside_map20ipsec-isakmp

cryptomapoutside_map20matchaddressoutside_cryptomap_20

cryptomapoutside_map20setpeer"VPN服务器的IP"

cryptomapoutside_map20settransform-setESP-3DES-MD5

cryptomapoutside_mapinterfaceoutside

isakmpenableoutside

isakmpkey"密码"address"VPN服务器的IP"netmask255.255.255.255no-xauthno-config-mode

isakmpidentityaddress

isakmppolicy20authenticationpre-share

isakmppolicy20encryption3des

isakmppolicy20hashmd5

isakmppolicy20group2

isakmppolicy20lifetime28800

3.PPtP配置

①/etc/pptpd.conf

speed115200

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"

mtu1490

mru1490

proxyarp

auth

-chap

-mschap

+mschap-v2

require-mppe

ipcp-accept-local

ipcp-accept-remote

lcp-echo-failure3

lcp-echo-interval5

ms-dnsX.X.X.X

deflate0

4.Super-freeswan配置

①/etc/freeswan/ipsec.conf

#basicconfiguration

configsetup

#THISSETTINGMUSTBECORRECToralmostnothingwillwork;

#%defaultrouteisokayformostsimplecases.

interfaces="ipsec0=eth0"

#Debug-loggingcontrols:"none"for(almost)none,"all"forlots.

klipsdebug=none

plutodebug=none

#Useauto=parametersinconndescriptionstocontrolstartupactions.

plutoload=%search

plutostart=%search

#ClosedownoldconnectionwhennewoneusingsameIDshowsup.

uniqueids=yes

nat_traversal=yes

#defaultsforsubsequentconnectiondescriptions

#(thesedefaultswillsoongoaway)

conn%default

keyingtries=0

disablearrivalcheck=no

authby=rsasig

#leftrsasigkey=%dnsondemand

#rightrsasigkey=%dnsondemand

connpix

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-tnat-APOSTROUTING-oeth0-s10.0.1.201/32-d"南京IP段"-jMASQUERADE

serviceiptablessave

注:添加用户名及修改密码/etc/ppp/chap-secrets

用户权限设定编辑修改iptables规则

如果公司路由器上有access-list,则添加

上一页[1][2]