[Bug] IPv6 connectivity is lost after initializing port forwarding
I maintainer di solito rispondono entro 1 giorno
@wanghe-fit2cloud ci sta già lavorando.
Dal 20/9/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Contact Information
No response
1Panel Version
v2.3.1
Problem Description
1Panel 初始化或恢复端口转发功能时,只要检测到系统存在 IPv6 防火墙命令,就会自动启用:
net.ipv6.conf.all.forwarding = 1
同时,该配置会被写入 /etc/sysctl.conf 并立即应用。
Linux 启用全局 IPv6 forwarding 后,会把服务器视为 IPv6 路由器。使用默认值 accept_ra=1 的公网网卡将不再接收 IPv6 Router Advertisement。
对于通过 RA/SLAAC 获取公网 IPv6 地址和默认路由的云服务器,这会导致公网 IPv6 地址无法重新获取或续期,IPv6 默认路由消失,最终只剩下 fe80:: 链路本地地址,IPv6 入站和出站连接均不可用。
使用静态 IPv6 地址和静态网关的服务器不会出现该问题,因此相同版本的 1Panel 在不同服务器上的表现不一致。
当前 dev-v2 分支仍存在相关逻辑:
- agent/utils/firewall/forwarding/sysctl.go
- agent/utils/firewall/forwarding/iptables.go
- agent/utils/firewall/forwarding/nftables.go
相关源码:
https://github.com/1Panel-dev/1Panel/blob/dev-v2/agent/utils/firewall/forwarding/sysctl.go
https://github.com/1Panel-dev/1Panel/blob/dev-v2/agent/utils/firewall/forwarding/iptables.go
Steps to Reproduce
-
准备一台通过 RA/SLAAC 获取公网 IPv6 地址和默认路由的 Linux 云服务器。
-
确认初始状态:
sysctl net.ipv6.conf.all.forwarding
sysctl net.ipv6.conf.eth0.accept_ra
典型结果:
net.ipv6.conf.all.forwarding = 0
net.ipv6.conf.eth0.accept_ra = 1
-
确认服务器当前拥有公网 IPv6,并且 IPv6 网络正常。
-
在 1Panel 的“主机 → 防火墙 → 端口转发”中初始化端口转发;或者从已启用旧版端口转发的 v2.2.5 升级至 v2.3.1。
-
检查系统配置:
sysctl net.ipv6.conf.all.forwarding
grep -n "net.ipv6.conf.all.forwarding" /etc/sysctl.conf
可以看到:
net.ipv6.conf.all.forwarding = 1
-
重启网络、重启服务器,或等待现有 RA/SLAAC 地址和路由信息失效。
-
再次检查
ip -6 address和ip -6 route,公网 IPv6 地址或默认路由消失,只剩下fe80::链路本地地址。
The expected correct result
初始化仅包含 IPv4 规则的端口转发功能时,不应修改服务器的 IPv6 forwarding 和 Router Advertisement 行为。
建议:
- 不要仅根据 ip6tables、ip6tables-restore 或 nftables 是否存在,就自动启用全局 IPv6 forwarding。
- 仅在用户创建或恢复 IPv6 端口转发规则时启用 IPv6 forwarding。
- 启用前检查服务器是否存在依赖 RA/SLAAC 的公网网卡。
- 如果相关网卡使用 accept_ra=1,应停止操作并显示明确警告,提示用户在 forwarding 模式下需要配置 accept_ra=2。
- 不建议未经确认就自动把所有网卡的 accept_ra 修改为 2,因为这会改变服务器的 IPv6 路由及 RA 信任策略。
Related log output
启用端口转发前:
net.ipv6.conf.all.forwarding = 0
net.ipv6.conf.eth0.accept_ra = 1
公网 IPv6:正常
IPv6 默认路由:正常
启用或恢复端口转发后:
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.eth0.accept_ra = 1
公网 IPv6:在重新配置或租期失效后消失
IPv6 默认路由:消失
/etc/sysctl.conf 中新增:
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
Additional Information
No response
- Lingua principale
- Go
- Stelle
- 37.1k
- Fork
- 3.4k
- Merge medio
- 12h 4m
- PR unite (30g)
- 93
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di 1Panel-dev/1Panel
-
[Feature] Change the chart layout in the Overview and Usage Statistics tabs from two charts per row to one chart per row, consistent with the API Key and Smart Routing tabs.Forse già presa @wanghe-fit2cloud l’ha presa oggi. Apertatype: ai-gateway type: optimization
1Panel-dev/1Panel#14065 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
fix: Update TypeSafe JEV client to support API v0.7 schemaForse già presa @wanghe-fit2cloud l’ha presa oggi. Apertatype: ai-gateway type: optimization
1Panel-dev/1Panel#14047 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Ensure context menu actions work with multiple selected filesForse già presa @wanghe-fit2cloud l’ha presa 1 giorno fa. Apertatype: optimization
1Panel-dev/1Panel#14045 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] AI Gateway Concurrency ErrorsForse già presa @wanghe-fit2cloud l’ha presa 1 giorno fa. Apertatype: ai-gateway
1Panel-dev/1Panel#14035 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Excessive Overhead in the Embedding GatewayForse già presa @wanghe-fit2cloud l’ha presa 1 giorno fa. Apertatype: ai-gateway
1Panel-dev/1Panel#14034 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di 1Panel-dev/1Panel
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Add SolentaForse già presa @sharmao07 l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
slavakurilyak/awesome-ai-agents#760 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
agent-review-finding bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
jordansmall/spindrift#5281 ·
I maintainer di solito rispondono entro 1 giorno