Linux简明系统维护手册(五)(2)

2008-02-23 07:17:39来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折



  echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter

  echo 1 > /proc/sys/net/ipv4/ip_forward

  如果你把下面两项编译成模块(前面扩号是M而不是*):



     FTP protocol support (NEW)     

       IRC protocol support (NEW)

  你需要在rc.local中加上:



  modprobe ip_nat_ftp

  安装完了,接下来我们将说明几种VPN的玩法。

  2、配置Frees/wan用于支持双网关通信。也就是两个异地的子网通过一对ipsec的VPN网关进行交互访问。第一种玩法是网络对网络的VPN。一般的,某企业在甲乙两地(距离相当远)各有一个办公室,每个办公室各有一套LAN,他们分别通过专线连接到internet网络上。甲LAN上是企业的管理中心,运行着企业的管理系统。而乙LAN上的用户也需要使用该管理系统,尽管乙LAN可以通过internet(公网)连接过去,但是企业的老板说不行!我们的数据不能暴露在公网上,必须加密!好了,我们的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)

  2.4 在你安装的openssl目录中找到CA.sh脚本。注意,应该是你当前运行的openssl版本的CA.sh

  2.5 cd /var/sslca 进入到你刚才建立的目录

  2.6 比如你刚才找到的CA.sh在/usr/lib/ssl/misc/,那么就输入/usr/lib/ssl/misc/CA.sh –newca,接下来你会被问到一系列问题。问题和回答类似于下面的样子。如果你确认哪些你有把握更改就改,比如公司名称、邮件、密码等。不能确定的就按照下面的样子抄上即可。



  ~/sslca#/usr/lib/ssl/misc/CA.sh -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:(enter same password again)

  -----

  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) [AU]:US(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/lib/ssl/misc/CA.sh -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:(enter password)

  Verifying password - Enter PEM pass phrase:(repeat password)

  -----

  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) [AU]:US(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

  natecars@buzzword:~/sslca$ /usr/lib/ssl/misc/CA.sh -sign

  Using configuration from /usr/lib/ssl/openssl.cnf

  Enter PEM pass phrase:(password you entered for the ca certificate)

  Check that the request matches the signature

Signature ok

  The Subjects Distinguished Name is as follows

  countryName           :PRINTABLE:'US'

  stateOrProvinceName   :PRINTABLE:'State'

  localityName          :PRINTABLE:'City'

  organizationName      :PRINTABLE:'21vianet'

  commonName            :PRINTABLE:'vpnserver.rd.xxx.com'

  emailAddress          :IA5STRING:'rd@xxx.com'

  Certificate is to be certified until Feb 13 16:28:40 2012 GMT (3650 days)

  Sign the certificate? [y/n]:y(enter)



  1 out of 1 certificate requests certified, commit? [y/n]y(enter)

  Write out database with 1 new entries

Data Base Updated

  (certificate snipped)

  Signed certificate is in newcert.pem

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Linux 常用命令(进入与退出系统)

下一篇:Linux简明系统维护手册(三)