可以参考http://www.ipsec-howto.org/ 1。编译kernel 2.6 必须选择下面的选择 CONFIG_INET_AH CONFIG_INET_ESP CONFIG_XFRM_USER 可能还要安装module-init-tool 如何生成kernel看另外的文档 2。ipsec-tools /configure --prefix=/ make make install 3。两台机器的通讯 linux(192.168.0.254) host-A--------------linux box(192.168.0.141)host-B 在一台linux中 #加入pf_sock modprobe af_key #加密 modprobe md5 modprobe des #AH modprobe ah4 #esp modprobe esp4 cat >setkey.sh <<EOF #!/sbin/setkey -f flush; spdflush; # AH add 192.168.0.141 192.168.0.254 ah 15700 -A hmac-md5 "1234567890123456"; add 192.168.0.254 192.168.0.141 ah 24500 -A hmac-md5 "1234567890123456"; # ESP add 192.168.0.141 192.168.0.254 esp 15701 -E 3des-cbc "123456789012123456789012"; add 192.168.0.254 192.168.0.141 esp 24501 -E 3des-cbc "123456789012123456789012"; spdadd 192.168.0.141 192.168.0.254 any -P out ipsec esp/transport//require ah/transport//require; spdadd 192.168.0.254 192.168.0.141 any -P in ipsec esp/transport//require ah/transport//require; EOF 执行setkey后,就可以通讯了 速度测试: 没有ipsec 有ipsec A->B 10.21M/s 2.43M/s B->A 10.94M/s 2.27M/s 上面的用的是手工密钥,可以还可以用Preshared Keys,X.509 Certificates。 其中/usr/share/ssl/misc/CA可以用来生成X.509 Certificates 生成证书: mkdir certs cd certs /usr/share/ssl/misc/CA -newca # 254 passwd :ca254 # 141 passwd :ca141 /usr/share/ssl/misc/CA -newreq # 254 passwd :cert254 # 141 passwd :cert141 #sign it using the certificate authority?? /usr/share/ssl/misc/CA -sign mv newcert.pem vpngateway_cert.pem mv newreq.pem vpngateway_key.pem mkdir /etc/certs cp ~/certs/*.pem /etc/certs/ #因为racoon不认这个key的格式,转一下 cd /etc/ openssl rsa -in 254_key.pem -out 254_key.pem #input cert254 4。网关之间的通讯 C(192.168.0.119)---(192.168.0.114)linux(10.0.0.12)---(10.0.0.13)linux(192.168.0.115)----C(192.168.0.253) 和上面差不多
[C语言系列]C# 和 Linux 时间戳转换 [Web开发]PHP flock文件锁介绍 [Web开发]flock() Linux下的文件锁 [电脑应用]Linux下的六个免费的虚拟主机管理系统介绍 [电脑应用]Linux数据库大比拚 [操作系统]在Windows中玩转Linux操作系统 [办公软件]在RedHat Linux 9里安装gaim0.80 [办公软件]掌握 Linux 调试技术 [办公软件]理解 Linux 配置文件 [聊天工具]Real10 & Xpdf installation on Linux Box
|