mirror of
https://github.com/hwdsl2/docker-ipsec-vpn-server.git
synced 2026-04-26 01:55:53 +03:00
[GH-ISSUE #455] 部署docker容器后,使用IEKv2证书连接,win11和安卓手机都能认证连接成功,但内网和外网都不能访问 #424
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @barry8316 on GitHub (Nov 12, 2024).
Original GitHub issue: https://github.com/hwdsl2/docker-ipsec-vpn-server/issues/455
任务列表
问题描述
vpn使用iekv2模式能连接成功,但不能访问内网和外网。
1、在客户端点开链接,发现只有发送流量,没有接收流量。
2、宿主机防火墙配置规则
iptables -A INPUT -p udp --dport 500 -j ACCEPT
iptables -A INPUT -p udp --dport 4500 -j ACCEPT
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -A FORWARD -s 172.17.0.0/16 -d 10.2.0.0/16 -j ACCEPT
iptables -A FORWARD -s 10.2.0.0/16 -d 172.17.0.0/16 -j ACCEPT
iptables -t nat -A POSTROUTING -s 172.17.0.0/16 -d 10.2.0.0/16 -j MASQUERADE
其中172为容器子网,10为vpn子网,彼此之间ping不通。
3、在容器内使用以下命令查看vpn状态:
root@ab:/# ipsec briefstatus
State Information: DDoS cookies not required, Accepting new IKE connections
IKE SAs: total(1), half-open(0), open(0), authenticated(1), anonymous(0)
IPsec SAs: total(1), authenticated(1), anonymous(0)
很奇怪是有一个连接通过认证,但没有开放状态的连接。
期待的正确结果
希望连接成功后能正常访问内外网络。
服务器信息(请填写以下信息)
客户端信息(请填写以下信息)
@hwdsl2 commented on GitHub (Nov 12, 2024):
@barry8316 你好!目前本项目对 Openwrt 的 Docker 主机的支持有限。对于你所说的问题,可能是你的宿主机的防火墙配置规则的问题,而不是 Docker 镜像的问题。我对 Openwrt 不熟悉,一般来说,Docker 启动时会自动添加防火墙规则,你上面这些防火墙规则可能都不需要。
你可以尝试在容器中运行 Bash shell,然后使用 curl 或 wget 等工具检查网络连接,例如
wget -O - https://www.google.com,以确保容器内部可以访问因特网。另外,你可以启用 Libreswan 日志,重试连接并检查日志。