hwdsl2 / docker-ipsec-vpn-server

Docker image to run an IPsec VPN server, with IPsec/L2TP, Cisco IPsec and IKEv2
https://hub.docker.com/r/hwdsl2/ipsec-vpn-server
Other
6.35k stars 1.38k forks source link

centos8以上iptables的问题 #403

Closed wanghongzhou closed 10 months ago

wanghongzhou commented 11 months ago

问题描述 我在k8s集群中使用helm安装hwdsl2/ipsec-vpn-server,启动时报错:

3ea08ed77d857d192dbd11d4d170411

我检查了一下宿主机lsmod | grep table,发现确实没有加载iptable_filter,iptable_nat,ip_tables三个内核模块, 因为宿主机是centos9,iptables默认使用的是iptables-nft而不是iptables-legacy。 查看https://gitlab.alpinelinux.org/alpine/aports/-/issues/14058 这个地址后发现3.19版本才切换倒nft,但是上面说debain默认使用nft,于是我把镜像换成了hwdsl2/ipsec-vpn-server:debain然后重启安装。 安装后进入容器发现还是使用的legacy, 这时翻看Dockerfile.debian才发现设置为legacy了,此时宿主机iptable_filter,iptable_nat,ip_tables三个内核模块被加载进来了, k8s的网络也出现了故障,因为calico组件依赖iptables-nft,请问下为何一定要在Dockerfile.debian中设置为legacy?

hwdsl2 commented 10 months ago

@wanghongzhou 你好!设置为 legacy 是因为需要与各种常用的宿主机系统兼容,比如 Debian 12 上的 Docker 环境,如果在容器内使用 nft 的话,添加的 IPTables 规则会不工作。对于你的用例,你可以 从源代码构建 修改后的镜像并在 Dockerfile.debian 进行相应的改动。