Centos 7 快速搭建IOS可用IPsec

安装 strongswan

yum install -y http://ftp.nluug.nl/pub/os/Linux/distr/fedora-epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
yum install -y strongswan

配置conf文件

vim /etc/strongswan/ipsec.conf

config setup
    cachecrls=yes
    uniqueids=yes
 
conn default
    keyexchange=ikev1
    authby=xauthpsk
    xauth=server
    left=%defaultroute
    leftsubnet=0.0.0.0/0
    leftfirewall=yes
    right=%any
    rightsubnet=10.7.0.0/24
    rightsourceip=10.7.0.2/24
    rightdns=8.8.8.8
    auto=add

配置用户文件

vim /etc/strongswan/ipsec.secrets
: PSK "your share key"
noodles1 : XAUTH "your pwd"
noodles2 : XAUTH "your pwd"

配置firewalld 和 nat转发

# 内核支持转发
echo ‘net.ipv4.ip_forward=1‘ >> /etc/sysctl.conf 
sysctl -p 

# 允许伪装IP
firewall-cmd --permanent --zone=public --add-masquerade

# nat
firewall-cmd --permanent --direct --passthrough ipv4 -t nat -I POSTROUTING  -j MASQUERADE -s 10.0.0.0/8

# 允许ipsec服务端口
firewall-cmd --zone=public --add-port=500/udp --permanent
firewall-cmd --zone=public --add-port=4500/udp --permanent

firewall-cmd --reload

启动服务并配置自启动

systemctl enable strongswan
systemctl restart strongswan

ios连接测试

ios ipsec 设置


成功

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native