该方案将vpp作为strongswan 的插件使用,实现vpp数据转发的加密
安装VPP
参考我的vpp环境搭建文档
startup.conf 配置文件添加
socksvr {
default
}
punt {
socket /var/run/vpp/sw-vpp
}
安装strongswan
# git clone strongswan
安装依赖项
# yum install –y gmp-devel
# yum install gperf –y
- 原因
编译前,需要安装gperf,如果不安装该工具会导致一些该工具生成的代码缺失导致连接时出错;
修改配置文件
Strongswan目录下修改路径为vpp的路径
vpp# ls /root/vpp/build-root/install-vpp_debug-native/vpp/include/
strongswan # vi src/libcharon/plugins/socket_vpp/Makefile.am
strongswan # vi src/libcharon/plugins/kernel_vpp/Makefile.am
更改后
AM_CPPFLAGS = \
-I${linux_headers} \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libcharon/plugins/kernel_vpp \
-I$(top_srcdir)/src/libcharon \
-I$(top_srcdir)/src/libipsec \
-I/root/vpp/build-root/install-vpp_debug-native/vpp/include #两个都是更改为vpp的路径了
在此目录下
/usr/local/etc/strongswan.d/charon/socket-vpp.conf
/usr/local/etc/strongswan.d/charon/kernel-vpp.conf
1 > 两个默认插件的内容修改一下将默认加载变成不加载 load = no
2 > 新增的两个插件加载状态变为yes
strongswan# /usr/local/etc/strongswan.d/charon/socket-vpp.conf
strongswan# /usr/local/etc/strongswan.d/charon/kernel-vpp.conf
kernel-vpp {
load=yes
}
socket-vpp {
load=yes
}
使用脚本初始化
strongswan# ./autogen.sh
strongswan# ./configure --enable-socket-vpp --enable-kernel-vpp --enable-libipsec
编译VPP
vpp # make pkg-rpm
vpp/build-root #sudo rpm –i vpp-lib-18.07.1-19~g511ce25.x86_64.rpm
vpp/build-root #sudo rpm -i vpp-selinux-policy-18.07.1-19~g511ce25.x86_64.rpm
strongswan
strongswan #make
strongswan #make install
实验结果
- 启动vpp
- 启动strongswan
DBGvpp# show api clients
Shared memory clients Name PID Queue Length Queue VA Health
strongswan 100673 0 0x00000001301c4a00 OKDBGvpp#