1、官網下載strongswan
2020/03/29, size 7'282'749 bytes, pgp-signature,
md5: d97e8eeb4fc0223f0d6fb331c4d2bcce
鏈接:https://www.strongswan.org/download.html
2、編譯和安裝
tar -zxvf strongswan-5.8.4.tar.gz ./configure --prefix=/usr/ --sysconfdir=/etc/ make make install
3、配置
以下官網鏈接有各種配置方案。
https://www.strongswan.org/testing/testresults/swanctl/index.html
可以依據自己需求,在兩台ubuntu機器內分別選擇一種方案進行配置即可。需要額外注意的是,將配置中的IP改成兩台機器對應的IP。、
我在兩台ubuntu內配置了/etc/swanctl/swanctl.conf。
4、測試
配置完畢后,在兩台機器均執行:
sudo swanctl --load-all
若失敗,報錯如下:
connecting to 'unix:///var/run/charon.vici' failed: No such file or directory Error: connecting to 'default' URI failed: No such file or directory
則,執行如下指令:
sudo /usr/libexec/ipsec/charon & sudo systemctl enable strongswan.service
從一台機器發起協商,h2h與配置內名稱相對應:
sudo ipsec up h2h