|
配置Frees/wan用于支持双网关通信。也就是两个异地的子网通过一对ipsec的VPN网关进行交互访问。第一种玩法是网络对网络的VPN,我们的 VPN网络就可以应用于该企业的这种需求。首先在甲乙两个LAN的出口各放置一台我们的Linux服务器,他们都安装好了ipsec(前面说的安装步骤一个都不少),两个LAN的数据分别通过各自的这台机器(ipsec gateway)进入公网,凡是经过该网关的数据全部都是加密的。在效果上,两个LAN的用户可以互相ping到对方的机器,尽管他们可能一个是 192.168.1.0/24网段,另一个是192.168.10.0/24网段的。他们好像在同一个局域网中工作,没有界限。公共网络的加密部分对他们来说也是透明的。而两个LAN在公共网络上交换的数据是密文的。这就是虚拟专用网VPN网对网的环境。
2.1 我们先配置甲网的ipsec网关(该网关有两个网卡,我们配置他们的地址分别为eth1:192.168.1.231和eth0:21.9.22.22)。安装完成后,我们首先要做的事情是生成CA证书。(用到刚才安装的openssl)
2.2 找到openssl.cnf文件,一般在/etc/ssl/中,也可能在/var/ssl中或/usr/ssl中(实在不行你就find / -name “openssl.cnf”找找嘛!),要是有好几个,你要搞清楚哪个是你安装的版本。改动其中的default_bits选项的值从1024到 2048,然后改动default_days的值到3650。让期限为10年!保存退出。
2.3 在/var/中建立一个目录:/var/sslca,改变该目录的权限为700(chmod 700 /var/sslca) 并且 mkdir /etc/ipsec.d/cacerts
2.4 在你安装的openssl目录中找到CA.sh脚本。注意,应该是你当前运行的openssl版本的CA.sh
2.5 cd /var/sslca 进入到你刚才建立的目录
2.6 比如你刚才找到的CA在/usr/share/ssl/misc,那么就输入 /usr/share/ssl/misc/CA –newca,接下来你会被问到一系列问题。问题和回答类似于下面的样子。如果你确认哪些你有把握更改就改,比如公司名称、邮件、密码等。不能确定的就按照下面的样子抄上即可。
~/sslca# /usr/share/ssl/misc/CA -newca CA certificate filename (or enter to create) (enter) Making CA certificate ... Using configuration from /usr/lib/ssl/openssl.cnf Generating a 2048 bit RSA private key ........................................+++ ........................................+++ writing new private key to './demoCA/private/./cakey.pem' Enter PEM pass phrase:(enter password) Verifying password - Enter PEM pass phrase:(输入密码) ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [GB]:GB(enter) State or Province Name (full name) [Some-State]:State(enter) Locality Name (eg, city) []:City(enter) Organization Name (eg, company) [Internet Widgits Pty Ltd]:21vianet(enter) Organizational Unit Name (eg, section) []:(enter) Common Name (eg, YOUR name) []:CA(enter) Email Address []:ca@xxx.com(enter) ~/sslca#
2.7 下一步是给网关生成证书:
命令和要回答的问题如下:
~/sslca# /usr/share/ssl/misc/CA -newreq
Using configuration from /usr/lib/ssl/openssl.cnf Generating a 2048 bit RSA private key ...................................+++ ...............................+++ writing new private key to 'newreq.pem' Enter PEM pass phrase:(输入密码) Verifying password - Enter PEM pass phrase: (输入密码) ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [GB]:GB(enter) State or Province Name (full name) [Some-State]:State(enter) Locality Name (eg, city) []:City(enter) Organization Name (eg, company) [Internet Widgits Pty Ltd]:ExampleCo(enter) Organizational Unit Name (eg, section) []:(enter) Common Name (eg, YOUR name) []:vpnserver.rd.xxx.com(enter) Email Address []:user@xxx.com(enter)
Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []:(enter) An optional company name []:(enter) Request (and private key) is in newreq.pem
[1] [2] [3] [4] 下一页 |