191 points · by pabs3 · 3y ago · 196 comments
If you have a working NAT64/DNS64 setup, macOS can make a AAAA (ipv6 DNS) request to ipv4only.arpa, and observe the form the result comes back as, in order to learn the IPv6 prefix used for IPv4 compatibility on the network (eg. 64:ff9b::/96), and if it's not given an IPv4 address via DHCP, will set up a local interface at 192.0.0.1 that is the default route for all IPv4 traffic. Anything sent to this interface will translate the address to the corresponding IPv6 compatibility address and send it to your IPv6 router (which should use NAT64 to send it to the destination.)
In this sense, you don't need any IPv4 infrastructure at all in your network (no DHCP, etc) and all traffic on your LAN will be IPv6, but IPv4-only apps (including those that hardcode IPv4 addresses and try to connect to them) work fine.
A quick web search says that linux has a similar thing implemented as a userspace daemon (clatd) which presumably does something similar, and importantly doesn't rely on LD_PRELOAD hacks like this article suggests (LD_PRELOAD doesn't work with static binaries like those written in Go, for instance.)
And this causes a massive headache when it comes to systems that track you based on your IPv4 address. For example there are applications that track you by your IP address. And if you want to opt-out they refuse because the IPv4 address you give them is owned by T-Mobile.
Also, it completely breaks stateless applications.
When you have an IPv4 <> IPv4 UDP tunnel you can just send traffic. If one device is behind NAT you set up port forwarding. It'll work today, it'll work tomorrow, and in 2 years.
The tunnel that the NAT64 system sets up is time-bound. So while outgoing traffic re-establishes the route, incoming traffic is not stateless. It stops.
I have this issue with WireGuard and iOS. The iOS implementation sadly prefers A over AAAA. So when I'm on 5G it connects over a NAT64 route, but due to the NAT64 route dropping after x time push notifications break. When you then turn on the phone, some traffic re-establishes the NAT64 tunnel and all of the sudden you get a whole bunch of notifications.
I use my own router which supports NAT64. I use OpenBSD which supports it natively in-kernel, but you can get NAT64 with any competent router software (OpenWRT, pfsense, etc.)
> And this causes a massive headache when it comes to systems that track you based on your IPv4 address. For example there are applications that track you by your IP address. And if you want to opt-out they refuse because the IPv4 address you give them is owned by T-Mobile.
Huh? I don't follow what you're saying... websites see an IPv4 address when I connect. I'm using NAT64, after all. It's just the _client OS_ that thinks it doesn't have an IPv4 address. My OS sends traffic as IPv6 to 64:ff9b::/96, but the router turns around and makes an IPv4 request with the IPv4 address I get from my ISP. I have IPv4 at the gateway but nothing else in my network sees it.
> Also, it completely breaks stateless applications.
I don't know what this means but I haven't seen a single broken application?
> When you have an IPv4 <> IPv4 UDP tunnel you can just send traffic. If one device is behind NAT you set up port forwarding. It'll work today, it'll work tomorrow, and in 2 years.
I can NAT inbound IPv4 requests to my internal IPv6 machines too, I don't know what the issue is for you here. I choose not to, since I don't want to deal with it, but the option is available if I want.
> The tunnel that the NAT64 system sets up is time-bound. So while outgoing traffic re-establishes the route, incoming traffic is not stateless. It stops.
I don't know what you're referring to here... it's exactly the same as how NAT works in IPv4. Outbound requests from my internal network are tracked with NAT, and return traffic is rewritten back to the IPv6 address that sent it. There's no difference between that and IPv4 outbound NAT here. I don't know what you're talking about with "tunnels" or anything.
Our best hope to avoid CGNAT is more/better IPv6 support.
Thank you for sharing! Yes, macOS has such logic and it works just fine. The main issue from clatd that it's pretty tricky to setup and it emulates presence of IPv4 on machine which is not very desirable as it tends to hide issues with other tools.
My plan was to explicitly disable IPv4 connectivity for machine and hide it from other app but keep it active for subset of well known broken tools and then fix them one by one and switch to IPv6 only setup.
https://archive.nanog.org/sites/default/files/wednesday_gene...
I pretty much stopped submitting patches enabling v6 functionality to various projects back in 2005 as everything I cared about was working at that point. (Side note, I was just trying to search a few of those - but seems that period pretty much doesn't exist in search engine caches anymore. I knew the state of preserving internet history is bad, but I didn't expect it to be _that_ bad)
If I don't have IPv4 connectivity, yet a 6-to-4 gateway exists and I have IPv6 connectivity, and some app tries to use IPv4, then clearly the gateway should be used.
How about some sysfs config option that says "redirect ipv4 to 6to4 gateway if no default ipv4 route exists", enabled by default.
The top level reply here discussing how MacOS handles it seems like something that should be able to be recreated with iptables, but when searching I am extremely surprised to discover that Linux does not seem to have the ability to do anything similar. It seems most solutions focus on using socat in userspace to proxy data between the sockets which is not really a practical solution.
There are various 6to4 on-ramps that solve this. Popular ones are NAT64/DNS64, 464Xlat, and DS-Lite. In my experience, DS-Lite works nicely with v4-only apps/services or v6-only apps/services.
I think the only way IPv6 will ever become mainstream is if either the EU or US Congress pass a bill making it the preferred IP standard.
The problem areas are with hosting and corporate networks. The Google numbers are smaller during the week as people use IPv4-only corporate networks.
Still, for a company like discord, not even using host names to allow DNS64 is really sad.
Another would be that government customers need to have IPv6-enabled sites. This could get a lot of companies to add IPv6 hosting.
It is not well publicized.
It turns out when you have a government that can tell you "move to IPv6 or we'll have your legs broken and your family thrown in prison" it's a bit easier to get things moving.
I know v6 supports NAT, but it was basically designed to remove it with the whole random addressing scheme, and that isn't necessary for solving this problem (idk if things were different in the 1990s).
- enough addresses for everyone on the planet, but we can't freely give out permanent static allocations to everyone because it would explode the routing tables
- so we never got our permanent roaming addresses we were promised
- NAT66 exists
- IPv6 was (still is?) a moving target for implementors
It's worse than an insult
Best practices changing applies to IPv4 too.
NAT exists but you don't need it and even if you do use it you don't have to track connections.
https://meta.trac.wordpress.org/ticket/3090
"The WordPress.org systems team DO have IPv6 plans, but at present there are higher priority tasks and there's no widespread requirement for IPv6 connectivity."
Its not possible to run a WordPress instance and auto-update with IPv6-only and without any kind of adress translation.
This is sad, but not surprising.
(Also that may be done on routers which today deal with NAT anyway)
And after transition is done, in theory, all you’d do would be turn off the translation box. In practice you’ll have to keep it up until the end of days, but that’s a separate matter.
Every time someone runs a linter over upstream, you're going to have to remake that patch. Sure, it's only 20 mins... But that multiplied by every bit of software you patch and every release, and you quickly realise that a huge chunk of your life was wasted doing what is effectively busywork.
Instead, contribute your time and efforts back to upstream, and now your efforts can help millions of people not just one. If others do the same, you'll see far more improvements to the software you use than you alone could ever write and maintain.
> This sort of negates that advantage
LD_PRELOAD trickery doesn't negate the advantage of having full source access, patching SSH would also have been a perfectly valid option, but is perhaps a better tool for this particular job.
For another use of the trick see https://github.com/mariusae/trickle (the project looks stale, though that may be because it is properly done and there have been no security/other bugs to fix in recent history) which slips its own functions in the call chain to apply user controlled (rather than firewall/routing level) throughput shaping to utilities that don't offer it out of the box.
You'll quickly discover that "open source" doesn't make everything easier.
Turns out actually doing this with the Linux kernel is exceptionally difficult. You can swap out the underlying sk, but doing it safely is damn near impossible because the two data structures aren’t really built like that.
One day, I’d love if someone added the ability to swap Unix sockets for TCP sockets at runtime to the kernel — for other reasons.
The other problem is that we found runtimes that would immediately send data after a non blocking connect (or receive data), and you needed a way to kick these off again. It was really a nightmare to restore all that state in a running socket.
The real solution was to add a new address family, and patch the kernel (as opposed to a module), that could dynamically switch back and forth (think AF_KCM). Unfortunately, I never got around to that.
No one is debating it's not ready for production use. It's just that it's a lot easier to configure clients in dual stack than do a 6 to 4 translation.
When I disabled IPv4 a few weeks ago, I couldn't use: HN, GitHub, Reddit, Discord, Duckduckgo.
Update - 23 Aug 2023 — Today, we are pleased to announce the general availability of IPv6 support for the Docker Hub Registry
Apparently it can be done now, I wont be finding out in a hurry.
None of those sites have v6 though, so you'll need some form of backwards compatibility running to reach them. Presumably you were missing that.
I recently had to setup a non-encrypted website because I have a few old devices that can no longer do HTTPS.
IPv4 on local networks will probably exist for a very long time.
That sounds like they haven't been updated for TLS>1.1 – if that is the case then rather than going all the way down the HTTP you could enable TLS1.1 (and maybe 1.0). It is open to POODLE/BEAST/others that way, but still have some protection and the site's configuration differs less from the rest of your infrastructure.
Unless the site is completely internal only of course, in which case just sticking with HTTP may be less faf.
ssh 64:ff9b::1.3.3.7
What address syntax is that? I mean I can easily guess what it means, but I wasn't aware such mixture exists. Do connect(2) and friends support that?In the example, 64:ff9b::103:307 is equivalent. A more complicated example might be akin to 64:ff9b::198.51.100.231, equivalent to 64:ff9b::c633:64e7.
I started to look into CLAT and really didn't want to have to go through the hassle of a whole new virtual interface with routes etc, when one single app can't just pass a couple different args to connect().
I actually had thought about trying to write something exactly like this myself.
I'm glad to learn it already exists.
It works by having several IPv6-only subnets and a dual stack router (running openwrt) that performs stateful NAT64 [1] using Jool. This allows to access both the IPv4 internet and local IPv4 islands[2] (basically old devices like printers).
There's no DHCP or NAPT involved: the router gets a /56 prefix from the ISP and performs prefix delegation, so every device does SLAAC and assigns itself a fully routable IPv6 address.
For DNS I use dnscrypt-proxy2: it's very easy to set up and it can do DNS64 and static hostnames mapping. Since prefix is stable, I just assign names to the stable EUI-64 addresses of the hosts I care about. Alternatively you can use bind for DNS64 and mDNS if you don't like manually assigning names. There's also a script to automatically assigns names based on ICMPv6 neighbours discovery [3].
I also host some services on the IPv4 internet from IPv6-only hosts: for this you need the NAT64 equivalent of port forwarding, which is setting up static BIB entries [4].
[1]: https://nicmx.github.io/Jool/en/intro-xlat.html#stateful-nat...
[2]: https://ungleich.ch/u/blog/managing-ipv4-islands-with-jool-a...
Also, isn't trying to run both IPv4 and IPv6 inherently a security issue coming from the complexity of dealing with two overlapping networks with very different logic ?
(they say my or most ISP can enable ipv6 on reuest; country : Slovenia, year : 2023)
host *.*.*.*
hostname 64:ff9:%h
(without the empty line)
Also work with scp, rsync,
The only thing missing is DHCPv6, and that's a deliberate decision - albeit a somewhat controversial one.
In general, consumer apps and consumer APIs are being developed with IPv6 support.
The new apps to name and shame for not natively supporting IPv6 in 2023 are mostly corporate and Big Enterprise.
I don't understand why IPv6 has not become more prevalent over the coming years. Seems like we're taking baby steps and growing in our dependence on IPv4 IPs, although based on other comments here it sounds like at least Linux and Mac have a way to handle this transparently, not sure about Windows.
I was thinking that there should be movement that IPv6 is the new default protocol. That includes requesting IPv6 from sites. Also, lots of docs on how to enable IPv6 with routers, program to label gear as IPv6-ready, and persuading manufacturers to enable IPv6 by default.
Finally, have best practices for IPv6 on corporate networks. With NAT64, it is possible to have IPv6-only network with IPv4 on the edge. I think it needs docs that describe how to do it, and lots of work in changing opinions of network engineers.
The trouble is definitely corporate networks. Changing opinions is hard, especially when network engineers have sunk cost fallacies and bad security training to worry about. Probably the only thing that's going to start making a difference for corporate networks is to let IPv4 costs continue to increase until enough corporate accountants start to notice that in financial reports and start to ask hard questions. Too bad there's no easy way to associate a market cost to 10.0.0.0/8 somehow.
shodan.io has support for ipv6. With ipv4 you're somewhat restricted to devices that get public ip (corporate networks) or devices that drill a hole (uPnP/port forward). IPv6 devices are publicly visible by default and you need to manually setup firewall to filter this out (not trivial - especially for UDP and ICMP)
In fact one of the warnings on dd-wrt official IPv6 tutorial: """ Keep in mind it can be dangerous to enable IPv6 without also having a firewall on each client that handles IPv6 packets, or having ip6tables on your router to filter incoming connections. ip6tables is NOT included by default with DD-WRT, which means your clients will be directly exposed to the Internet once you have enabled IPv6. """