StrongSwan变迁
1. strongswan 5之前
- pluto: IKEv1
- charon: IKEv2
- starter: 启动charon
- 配置: ipsec.conf ipsec.secrets
2. strongswan 5
- charon: IKEv1/IKEv2
- starter: 启动charon
- 配置: ipsec.conf ipsec.secrets
- 废弃:pluto
3. strongswan 5.9之后
- charon
- swanctl
- 配置: swanctl.conf
- 废弃:starter ipsec.conf ipsec.secrets
安装
ubuntu
1 | apt-get update |
centos
1 | yum install epel-release |
alpine
1 | apk add strongswan |
配置
- 配置目录:
/etc/strongswan/
调试命令
- 查看连接状态:
swanctl -l
- 查看协商日志:
tailf /var/log/messages
使用示例
1. alpine配置
隧道配置:/etc/ipsec.conf
1 | conn psk181 |
认证配置:/etc/ipsec.secrets
:
1 | 100.100.1.182 100.100.2.181 : PSK "123456" |
配置IP防火墙
1 | 配置防火墙路由等 |
查看隧道信息
1 | localhost:~# swanctl -l |
2. centos配置
隧道配置:/etc/strongswan/swanctl/conf.d/pks182.conf
1 | connections { |
配置IP防火墙
1 | 配置防火墙路由等 |
查看隧道状态
1 | [root@localhost ~]# swanctl -l |