因为RHEL5.4 自带的OPENSWAN -2.6.21-5.el5无法生成RSA key
(问题为 Error Generating a new ipsec hostkey http://www.centos.org/forums/viewtopic.php?t=20620),
所以源码安装openswan
1 下载openswan:
wget http://www.openswan.org/download/openswan-2.6.34.tar.gz
2 编译安装
编译安装之前,先确保安装了 gcc kernel-devel kernel-header gmp gmp-devel gawk flex bison,
tar -zxvf openswan-2.6.34.tar.gz
make programs
make install
depmod -a
3 设置openswan运行所需的环境:
vim /etc/sysctl.conf
net.ipv4.ip_forward=1
net.ipv4.conf.default.rp_filer= 0
settings for ipsec:
vim ipsec_env_settings.sh
#!/bin/bash
for i in /proc/sys/net/ipv4/conf/*/send_redirects
do
echo "0" > $i
done
for i in /proc/sys/net/ipv4/conf/*/accept_redirects
do
echo "0" > $i
done
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "1" > /proc/sys/net/core/xfrm_larval_drop
echo "0" > /selinux/enforce #disable selinux
4 启动IPSEC
service ipsec start OR /etc/init.d/ipsec start
5 验证运行是否正常
ipsec verify