Recently, I’ve been traveling with a Dual-SIM smartphone, which I also use for Wi-Fi tethering my notebook. I can use both SIM cards from different network operators for Internet connectivity and can switch back and forth while Wi-Fi tethering remains active. This is particularly useful while roaming, as the SIM cards are usually connected to different local networks in the roaming country (VPLMNs in 3GPP parlance). If the signal of one network is weak at one location, there’s a good chance the other is better, so no manual network reselection is required. Both home network operators support IPv6, so I was wondering how the smartphone manufacturer has implemented the notification to the notebook that the IPv6 prefix and the IPv6 DNS server address have changed when I switch between the SIM cards!?
Note that no change is necessary for the IPv4 side. Wi-Fi tethering uses local NATing, so the router IPv4 address (the smartphone) and the IPv4 addresses of Wi-Fi tethering client devices such as notebooks remains the same. For IPv6 on the other hand, no NATing is necessary or used, so changing the backhaul network requires client devices to change their IPv6 addresses.
It turns out that my Dual-SIM device has this implemented very nicely! The screenshot above shows how the process works. At 7.8 seconds into the trace, the notebook connects to the Wi-Fi tethering hotspot of the smartphone for the first time and receives an IPv6 Router Advertisement message that contains the IPv6 prefix and other information.
After checking connectivity I then change to the second SIM on the phone. This triggers a new Router Advertisement packet (packet 2331, see above) at 48 seconds into the trace, in which the lifetime of the current IPv6 prefix and DNS server is set to 0. The Router Advertisement in packet 2530 that arrives 200 milliseconds later then contains two things:
- The new IPv6 prefix and DNS server information
- Again a reminder that the previous IPv6 prefix and DNS is no longer valid
The lower part of the screenshot above shows how the parameters look like. This information is then then repeated in some forms and shape a number of times for 15 seconds until only the new IPv6 information is contained in the Router Advertisement packet 2979.
The following screenshot shows how Ubuntu 20.04 looks at the situation after the network change:
After the change, the 2a00:20:c044… network addresses are now the new global IP addresses. The 2a01:598:a881… IPv6 addresses on the other hand have been retired and were set to ‘deprecated’ and their lifetime is 0 seconds.
A nice implementation!