转载请注明出处: http://blog.csdn.net/zhangyang0402/archive/2010/07/13/5732815.aspx
一、版本
内核当前版本
# uname -r
2.6.18-164.el5
ipsec-tools版本
# rpm -qa|grep ipsec-tools
ipsec-tools-0.6.5-13.el5_3.1
由于系统自带的ipsec-tools版本较低,且无源码,这里从http://ipsec-
tools.sourceforge.net/下载当前最新版本0.7.2
#tar ipsec-tools-0.7.2.tar.gz
#cd ipsec-tools
二、安装过程中出现的问题总结
1. checking openssl version... too old
configure: error: OpenSSL version must be 0.9.6 or higher. Aborting.
执行#./configure --prefix=/root/myipsec 的时候,出现上面的错误
查看已安装的openssl版本
# openssl version
OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
解决方法: 安装openssl-devel
#yum -y install openssl-devel
2.configure: error: Unable to find linux-2.6 kernel headers. Aborting.
解决方法:这里需要内核头文件,这里使用2.6.34版本内核源码
#cp linux-2.6.34.tar.bz2 /usr/src
#cd /usr/src
#tar xjvf linux-2.6.34.tar.bz2
#mv linux-2.6.34 linux
3. undefined reference to `yywrap'
#make 的时候出现上面的错误
解决方法: 安装flex
#yum -y install flex
4.../../src/include-glibc/linux/swab.h:6:22: error: asm/swab.h: No such file or
directory
#make 的时候出现下面的错误:
In file included from ../../src/include-glibc/linux/byteorder/little_endian.h:12,
from /usr/include/asm/byteorder.h:53,
from ../../src/include-glibc/linux/ip.h:20,
from isakmp.c:115:
../../src/include-glibc/linux/swab.h:6:22: error: asm/swab.h: No such file or
directory
make[4]: *** [isakmp.o] Error 1
make[4]: Leaving directory `/root/ipsec-tools-0.7.2/src/racoon'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/root/ipsec-tools-0.7.2/src/racoon'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/root/ipsec-tools-0.7.2/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/ipsec-tools-0.7.2'
make: *** [all] Error 2
解决方法: 拷贝swab.h
#mkdir /usr/src/linux/include/asm
#cp /usr/src/linux/arch/x86/include/asm/swab.h /usr/src/linux/include/asm
#cp /usr/src/linux/arch/x86/include/asm/swab.h /usr/include/asm
三、测试
最后,成功进行make和make install
# ls /root/myipsec/
include lib sbin share var
配置/root/myipsec/sbin目录下的setkey和racoon,成功进行ipsec通信,IPsec-Tools安装成功!