From 6e4f755e710da1bf2ec65b91874bd5831a124365 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 30 Jun 2026 17:40:13 +0300 Subject: [PATCH] fix(lan): warn when auto-detected endpoint IP is in Docker/WSL2 172.16/12 range MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nodes running inside WSL2 or Docker have a virtual network interface whose IP (172.16-31.x.x) is not reachable from physical machines on the LAN. The UDP socket probe for outbound IP returns this virtual IP, which gets registered with the tracker — causing downstream pipeline hops to time out with "urlopen error timed out". _warn_virtual_network_ip() now prints a clear multi-line warning at startup when the auto-detected advertise IP falls in 172.16.0.0/12, including the fix: --advertise-host . Co-Authored-By: Claude Sonnet 4.6 --- packages/node/meshnet_node/startup.py | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/packages/node/meshnet_node/startup.py b/packages/node/meshnet_node/startup.py index 0d38f95..54f44b0 100644 --- a/packages/node/meshnet_node/startup.py +++ b/packages/node/meshnet_node/startup.py @@ -179,6 +179,35 @@ def _start_heartbeat( return t +def _warn_virtual_network_ip(ip: str | None) -> None: + """Print a warning when the auto-detected advertise IP is in a known virtual-network range. + + 172.16.0.0/12 is used by Docker, WSL2, and most hypervisors. Nodes behind these + adapters are NOT directly reachable from other physical machines on the LAN, so + cross-host pipeline hops will time out. The user must pass --advertise-host with + their actual LAN IP (e.g. 192.168.x.x) to fix this. + """ + if ip is None: + return + try: + parts = [int(p) for p in ip.split(".")] + if len(parts) != 4: + return + a, b = parts[0], parts[1] + # 172.16.0.0/12 → 172.16–31.x.x + if a == 172 and 16 <= b <= 31: + print( + f"\n WARNING: auto-detected endpoint IP {ip} is in 172.16.0.0/12.\n" + f" This range is used by Docker, WSL2, and virtual machines and is\n" + f" NOT reachable from other physical machines on your LAN.\n" + f" Cross-host pipeline hops WILL time out.\n" + f" Fix: pass --advertise-host (e.g. 192.168.x.x).\n", + flush=True, + ) + except Exception: + pass + + def run_startup( tracker_url: str, port: int = 0, @@ -224,6 +253,8 @@ def run_startup( except Exception: advertise_host = socket.getfqdn() + _warn_virtual_network_ip(advertise_host) + print("Detecting hardware...", flush=True) hw = detect_hardware() device: str = hw["device"]