I guess if it's GitHub, you can tie it to a specific commit hash, file name, line number tuple, but if the codebase ever changes a lot its not super useful. I've also not had luck with other, less used git webviews (git.blender.org)
How does Linux NAT a ping?
71–80 of 108 posts
Re: How does Linux NAT a ping?
#72It annoys me when I write blog posts like this, it's so hard to link to a specific line of code and have that link stay alive and useful/fresh over time. I guess if it's GitHub, you can tie it to a specific commit hash, file name, line number tuple, but if the codebase ever changes a lot its not super useful. I've also not had luck with other, less used git webviews (git.blender.org)
Re: How does Linux NAT a ping?
#73When a ping is sent from a device on a local network to a device on the internet, the router performing NAT rewrites the source address of the ping to its public IP address and rewrites the ID field of the ICMP packet to a unique value. When the response is received, the router uses the unique ID value to forward the response to the correct device on the local network.
Why not use the source private IP instead of the “unique value”?
It's another reason WebRTC/STUN was a big issue when it first became widely available, it made it easy to leak details about your LAN to outside servers.
Re: How does Linux NAT a ping?
#74When a ping is sent from a device on a local network to a device on the internet, the router performing NAT rewrites the source address of the ping to its public IP address and rewrites the ID field of the ICMP packet to a unique value. When the response is received, the router uses the unique ID value to forward the response to the correct device on the local network.
Re: How does Linux NAT a ping?
#75Earlier quoted context omitted.
You could be using IPv6 ULA addresses internally on your home network to have static addressing. The real solution is moving to DNS names though with your router maintaining them based on DHCP leases or just using multicast DNS (Zeroconf). In the future you can probably go "IPv6-mostly" with a CLAT engine to ditch dual-stack: https://blog.apnic.net/2022/11/21/deploying-ipv6-mostly-acce...
> In the future you can probably go "IPv6-mostly" with a CLAT engine ...although there still isn't any kernel support for the necessary SIIT v4 v6 translation, so to implement CLAT you end up using unmaintained (and unmergeably bad) out-of-tree kernel modules or unmaintained (and slow) userspace daemons hanging off a tuntap interface.
Re: How does Linux NAT a ping?
#76Earlier quoted context omitted.
Taking this thought just a tiny bit further, this is changing a stateless protocol to a stateful one.
NAT stands for Network Address Translation, which means a NAT device maintains a translation table of internal IPs to external, so that it can return response packets coming from Internet to a proper destination on the internal network. By definition NAT will maintain state which is translation table. Now that table can be dynamic or static, but it doesn't change the fact that there will be some state to maintain.
Stateless NAT is also possible, but then it has to be 1:1. Which has it's purpose, but is rarely used.
A practical example would be with IPv6 if your ISP doesn't allocate you a static prefix. Stateless NAT would allow you to use a /64 from the private range of fd00::/8 in your local network which the router would translate to your globally unique /64. No state needed, because there would be as many IPs available in your LAN prefix as in your GUA prefix. All it would do would be translating fdxx:xxxx:xxxx:xxxx:1234:1234:1234:1234 to 2yyy:yyyy:yyyy:yyyy:1234:1234:1234:1234 and vice versa.
I've also done stateless NAT on IPv4. When you request more IPs from some cloud providers, they assign you a bunch of /32s, not a proper subnet, virtually requiring you to run a cloud router.
Re: How does Linux NAT a ping?
#77NAT is such a trashy abstraction. IPv4 needs to die.
IPv6 needs to die also. It had more than enough time to become dominant and has just floundered.
Now, try starting a new ISP without CGNAT (which will lead to a garbage experience for everyone) or IPv6. You'll have to spend literal tens (if not hundreds) of millions just on IP addresses alone.
Re: How does Linux NAT a ping?
#78NAT is such a trashy abstraction. IPv4 needs to die.
I have a few devices on my home internet, on a handful of 192.168 subnets The other week I moved my ISP. The AS my house belonged to obviously changed to the new ISP, and I got a new v4 IP All I had to do was update my Wan router to forward trafffic from the new Ip. Instead with ipv6 I would have to change every node on my network, update my internal DNS. Now in theory I could have my own /48 which I take with me. Th…
With the (IMHO) big advantage that unless some madman has configured NAT66, the traffic over ULA will *never* get out into the internet.
The fact you have GUAs allocated doesn't mean you have to necessarily use them for your internal traffic. Most of the time link local addresses (on small scale, with auto discovery via LLMNR or mDNS) or ULAs are way more convenient than GUAs or IPv4 local addresses.
Re: How does Linux NAT a ping?
#79Earlier quoted context omitted.
Priorities. I don't have to put up with PPPoE in 2023, but it's a hell of a lot less expensive than pulling munifiber to my garage (and the monthly fees for munifiber are higher too, so there's no point in time where it makes economic sense), and consistency and stable addressing is currently winning over the promise of 5g/leo satellite.
Sure, but you're choosing that prioritisation. It's not being forced on you.
As for me, I want IPv4 to stay forever. It works for me and I don't see any reason to spend time and migrate to something else.
Re: How does Linux NAT a ping?
#80NAT is such a trashy abstraction. IPv4 needs to die.