[GH-ISSUE #403] centos8以上iptables的问题 #376

Closed
opened 2026-03-02 08:01:44 +03:00 by kerem · 1 comment
Owner

Originally created by @wanghongzhou on GitHub (Oct 9, 2023).
Original GitHub issue: https://github.com/hwdsl2/docker-ipsec-vpn-server/issues/403

问题描述
我在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?

Originally created by @wanghongzhou on GitHub (Oct 9, 2023). Original GitHub issue: https://github.com/hwdsl2/docker-ipsec-vpn-server/issues/403 **问题描述** 我在k8s集群中使用helm安装hwdsl2/ipsec-vpn-server,启动时报错: ![3ea08ed77d857d192dbd11d4d170411](https://github.com/hwdsl2/docker-ipsec-vpn-server/assets/12545839/b1aa84dd-2b3b-4064-a724-c1c5d8f130da) 我检查了一下宿主机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?
kerem closed this issue 2026-03-02 08:01:44 +03:00
Author
Owner

@hwdsl2 commented on GitHub (Oct 9, 2023):

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

<!-- gh-comment-id:1753123247 --> @hwdsl2 commented on GitHub (Oct 9, 2023): @wanghongzhou 你好!设置为 legacy 是因为需要与各种常用的宿主机系统兼容,比如 Debian 12 上的 Docker 环境,如果在容器内使用 nft 的话,添加的 IPTables 规则会不工作。对于你的用例,你可以 [从源代码构建](https://github.com/hwdsl2/docker-ipsec-vpn-server/blob/master/docs/advanced-usage-zh.md#%E4%BB%8E%E6%BA%90%E4%BB%A3%E7%A0%81%E6%9E%84%E5%BB%BA) 修改后的镜像并在 Dockerfile.debian 进行相应的改动。
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/docker-ipsec-vpn-server#376
No description provided.