Currently AOSP only has support for IPv6 tethering when using mobile networks under supported carriers since Android 7.0.

It’s unclear how to do this for IPv6-capable VPN or even Wi-Fi. The main issue is configuring a valid IPv6 address for clients. This is further complicated by the fact that sometimes dnsmasq (actually I’m not 100% sure yet) will configure another valid IPv6 address using Router Advertisement.

Update: It might be possible to create a bridge. [1, 2]

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:42 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
worstpersoncommented, Nov 20, 2020

Finally stumbled on how this can be done, I feel really dumb for not landing on this sooner. Turns out we can use TPROXY mangle rules to capture and redirect outbound IPv6 traffic to a local transparent proxy. transocks-wong and microsocks (for example) would be enough for TCP support, but I’m unsure about UDP atm.

The kernel module to achieve this is very widely supported on Android: CONFIG_NETFILTER_XT_TARGET_TPROXY

3reactions
worstpersoncommented, Nov 4, 2020

Think I answered poorly. AFAICT public ipv6 addresses for tethered clients are configured via slaac server on the provider side, not anything on the client side. Guess this would be testable by blocking icmp6 between rndis0 and the ipv6 mobile interface and reconnecting.

I had some recent success getting tethering with ipv6 working. I grabbed Lineage sources for my phone and rebuilt my kernel with CONFIG_NF_NAT_IPV6 and CONFIG_IP6_NF_TARGET_MASQUERADE enabled. Also cross-compiled radvd for ipv6 provisioning. radvd.conf defines interface rndis0, prefix fd00::/64, and ipv6 dns servers.

#!/system/bin/sh

#netID = 99 0x63
setprop sys.usb.config 'rndis,adb'
ndc interface setcfg rndis0 192.168.42.129 24 up
ip -6 addr add fd00::1/64 dev rndis0 scope global
ip -6 route add fd00::/64 dev rndis0 proto kernel src fd00::1
ndc ipfwd enable tethering
ndc network interface add 99 rndis0
ndc network route add 99 rndis0 192.168.42.0/24
ndc network route add 99 rndis0 fd00::/64
ndc network route add 99 rndis0 fe80::/64
ndc nat enable rndis0 tun0 99
ndc ipfwd add rndis0 tun0

ip6tables -t nat -N tetherctrl_nat_POSTROUTING
ip6tables -t nat -A POSTROUTING -j tetherctrl_nat_POSTROUTING
ip6tables -t nat -A tetherctrl_nat_POSTROUTING -o tun0 -j MASQUERADE
ip6tables -t filter -D tetherctrl_FORWARD -g tetherctrl_counters
ip6tables -t filter -A tetherctrl_FORWARD -i tun0 -o rndis0 -m state --state RELATED,ESTABLISHED -g tetherctrl_counters	
ip6tables -t filter -A tetherctrl_FORWARD -i rndis0 -o tun0 -m state --state INVALID -j DROP	
ip6tables -t filter -A tetherctrl_FORWARD -i rndis0 -o tun0 -g tetherctrl_counters	
ip6tables -t filter -A tetherctrl_FORWARD -j DROP

# These commands as written are blocking
dnsmasq --keep-in-foreground --no-resolv --no-poll --dhcp-authoritative --dhcp-range=192.168.42.10,192.168.42.99,1h --dhcp-option=6,8.8.8.8,8.8.4.4 --dhcp-leasefile=/sdcard/dnsmasq.leases --dhcp-option-force=43,ANDROID_METERED --pid-file=/sdcard/dnsmasq.pid --listen-mark 0xf0063

radvd -n

Here I set the ipv6 address and route, mark traffic for the global ipv6 subnet, and add the missing ip6tables rules to match. Found I needed to call dnsmasq directly as ndc tether seemed to interfere.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IPv6 When Tethering - WirelessMoves
IPv6 When Tethering ... At first the PC checks if its IPv6 link local address with interface-id set to the MAC address of...
Read more >
Connection Sharing / Tethering with IPv6 - Reddit
Many devices have options for tethering (e.g. smartphones) or connection sharing (PCs). These features usually allow you to share an (IPv4) internet…
Read more >
Observations on tethering IPv6 - WIRELESS JOINT
Observations on tethering IPv6 ... The standard way to classify hotspot/tether traffic on mobile networks is through the the APN settings.
Read more >
wifi hotspot - Does Android have support for IPv6 tethering?
Not only that, but tethering explicitly doesn't even work at all when you're on an IPv6-only network, unless your phone has IPv4 connectivity, ......
Read more >
Tethering | Android Open Source Project
The Tethering module shares an Android device's internet connection with other connected client ... The Tethering module supports IPv4 and IPv6 dual stack....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found