1。http://ipsec-tools.sourceforge.net/ 下载源代码

2。解压后,configure –sysconfdir=/etc/racoon –enable-natt –enable-broken-natt –enable-hybrid –enable-dpd

3。make过程中会提示很多错误,参考如下解决:

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 bison

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

5.make[3]: *** [setkey] Error 1
make[3]: Leaving directory `/programs/ipsec-tools-0.5-rc1/src/setkey'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/programs/ipsec-tools-0.5-rc1/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/programs/ipsec-tools-0.5-rc1'
make: *** [all] Error 2

出现上面错误,需要修改configure文件,将里面的CFLAGS=“-g -02”修改为CFLAGS="-g -02 -fno-strict-aliasing",然后重新configure来过。