Does TCP hole punching actually work with common CPEs and CG-NATs? I don’t think I’ve ever seen it done successfully and have often wondered if it’s for a lack of use cases or due to its bad success rate and complexity compared to UDP hole punching. That said, I really wish there was a standardized way to do it. Some sort of explicit (or at least implicit but unambiguous) indicator to all firewalls that a connection…
The standard way to do it is called ipv6. Implementing it is probably easier than any of those RFCs
A most elegant TCP hole punching algorithm
91–100 of 111 posts
Re: A most elegant TCP hole punching algorithm
#92Earlier quoted context omitted.
No, it isn't. Many middleboxes (including OpenWrt by default) drop unsolicited inbound TCP connections even on IPv6, and therefore the same hole-punching algorithm is needed. The hole being punched is in the stateful firewall's connection tracker, not in the NAT. Basically, both parties need to convince their router that it is an outgoing connection initiated by them, not a prohibited-by-policy incoming connection.
There are two separate problems with IPv4 and only one applies to IPv6. Allowing incoming connections through a restrictive firewall is applicable to both. Address mangling via NAT applies only to one. Note also that in the IPv4 world you might be behind more than one layer of NAT which will make everything infinitely worse. Honestly ISPs really missed an opportunity to essentially provide IPv6-only as a service and…
This is in fact how many 4G and 5G networks work today. I’m sending this reply via one right now.
For wired connections, many DOCSIS cable ISPs use DS-Lite, which is v6 only on the last hop as well.
Re: A most elegant TCP hole punching algorithm
#93Earlier quoted context omitted.
There are two separate problems with IPv4 and only one applies to IPv6. Allowing incoming connections through a restrictive firewall is applicable to both. Address mangling via NAT applies only to one. Note also that in the IPv4 world you might be behind more than one layer of NAT which will make everything infinitely worse. Honestly ISPs really missed an opportunity to essentially provide IPv6-only as a service and…
IPv6 nat is a thing that exists and is used. IPv6 purists like to imagine it doesn't exist which is cute.
Re: A most elegant TCP hole punching algorithm
#94Claimed elegance is based on a very bold assumption that the NAT device preserves the source port of outbound connection. Hardly the case in even half of typical deployment cases.
I had to call them to make it stop since it tripped the VPN solution at work, that interpreted it as a MIM attack. They disabled it no questions asked as soon as I called, so I guess it mostly works for most people, but not all.
But on that note, isn't it basically time now for IPv6 so we can stop shit like this and go to directly addressable devices like everyone did in the early 90s.
Re: A most elegant TCP hole punching algorithm
#95Earlier quoted context omitted.
I like your comment, but it seems the author acknowledged this as a caveat to the algorithm. >Many home routers try to preserve the source port in external mappings. This is a property called “equal delta mapping” – it won’t work on all routers but for our algorithm we’re sacrificing coverage for simplicity. So to what percentage is this coverage sacrificed exactly? No idea. Not as useful if the percentage is high, a…
It’s the same assumption is required for any hole punching handshake (including STUN). > This is a property called “equal delta mapping” FWIW I’ve worked in computer networking for 20 years and have never heard it called this. This blog is the only source that comes up when I search for that exact term. I wonder where the author got it from.
Very clearly a hallucination
Re: A most elegant TCP hole punching algorithm
#96We are dropping this deterministic punch directly into the grubcrawler.dev edge binaries. Instead of relying on STUN/TURN servers to coordinate a swarm, millions of nodes trapped behind residential NATs will use the unix timestamp to mathematically predict a collision course, aggressively punch through their firewalls, and instantly hand the raw TCP socket over to rust-lightning (LDK).
No DNS. No signaling servers. No legacy IP registries. Just a self-assembling Lightning mesh of autonomous agents spinning up encrypted channels and executing paid RPC calls entirely in the dark.
Re: A most elegant TCP hole punching algorithm
#97Earlier quoted context omitted.
There are two separate problems with IPv4 and only one applies to IPv6. Allowing incoming connections through a restrictive firewall is applicable to both. Address mangling via NAT applies only to one. Note also that in the IPv4 world you might be behind more than one layer of NAT which will make everything infinitely worse. Honestly ISPs really missed an opportunity to essentially provide IPv6-only as a service and…
Exactly. And look, the linked Python script only solves one problem: making both firewalls believe that the party behind them is the one who initiated the connection. Address/port mangling is not addressed at all, both public addresses need to be provided externally. And it's simply not true that there is no NAT in the wild with IPv6: every OPNsense installation with two uplinks and the need for anything better than…
IPv6 is strictly worse for this precisely because it is treated as a second class citizen. If it was the default in all the tutorials and we started naming IPv4 as the legacy protocol developers would know better.
Re: A most elegant TCP hole punching algorithm
#98Re: A most elegant TCP hole punching algorithm
#99Earlier quoted context omitted.
That’s true we won’t get rid of hole-punching with IPv6. But at least it will get rid of TURN.
The hole punching is so much simpler because you don't need to guess your own address and port - you just know it
Re: A most elegant TCP hole punching algorithm
#100Earlier quoted context omitted.
Even with IPv6 you still might have stateful firewalls allowing only for outbound connection at both ends (e.g. a CPE a.k.a. “WiFi router”) and to establish communication you’d need to punch a hole in those firewalls.
That’s true we won’t get rid of hole-punching with IPv6. But at least it will get rid of TURN.