You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moving out of #1401 : there may be an issue with IPv6 support in Android interacting with exit-nodes.
After setting up an Ubuntu system to advertise routes to 0.0.0.0/0,::/0
I think default route is working for me, at least for IPv4. I've turned off Wi-fi on this phone, to make it use LTE. whatismyipaddress.com says my phone is 2607:fb90:X:X:X:X:X:X and 172.58.X.X.
2607:fb90 and 172.32.0.0/11 are T/Mobile IP ranges.
When I enable routing via my Ubuntu machine in the Tailscale app, whatismyipaddress.com says my IPv4 address is 135.180.X.X, and that IPv6 is not detected.
135.180.X.X is my sonic.net address, so the phone went over LTE to get to the house to the Ubuntu machine to route it back out.
I can still reach the IPv6 web server running on the Ubuntu system, so IPv6 isn't broken altogether. It just seems like Android cannot get IPv6 packets past the Ubuntu system
Using adb shell ip -6 route show table all to show the whole routing table with the exit node configured versus off, we see a new default route pointing to tun0 when the exit node is configured. This is fine, this is what we would expect to see.
default dev tun0 table 1101 proto static metric 1024 pref medium
However it also removes the IPv6 prefix route pointing to the Wi-fi interface. This route is only present when the exit-node is set to none, it disappears when an exit-node is set.
2602:248:7b4a:ce60::/64 dev wlan0 table 1030 proto kernel metric 256 expires 86219sec pref medium
$ adb shell ip -6 addr show dev wlan0
30: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 3000
inet6 2602:248:7b4a:ce60:94b:ba7f:e4f2:a639/64 scope global temporary dynamic
valid_lft 86286sec preferred_lft 14286sec
inet6 2602:248:7b4a:ce60:78a3:676:f0bb:f142/64 scope global dynamic mngtmpaddr stable-privacy
valid_lft 86286sec preferred_lft 14286sec
inet6 fe80::2f60:2c82:4163:8389/64 scope link stable-privacy
valid_lft forever preferred_lft foreve
I believe this is why IPv6 stops working, it loses the route which allows it to reach the outside world. Link-local addresses should still work, which might be how the Android device was able to reach the little IPv6 web server I had running on the exit-node system (described in previous comment).
An actual diff of the two cases shows more diffs, because the tables renumber and the expiry times change. These should be harmless. I believe we remove and re-add the whole table when the exit-node setting changes:
$ diff /tmp/exit-node /tmp/exit-node-none
1c1 < 2602:248:7b4a:ce60::/64 dev wlan0 table 1030 proto kernel metric 256 expires 86215sec pref medium
---
> 2602:248:7b4a:ce60::/64 dev wlan0 table 1030 proto kernel metric 256 expires 86219sec pref medium
5c5
< default via fe80::a236:9fff:fe59:19b2 dev wlan0 table 1030 proto ra metric 1024 expires 1615sec mtu 1280 hoplimit 64 p
ref medium
---
> default via fe80::a236:9fff:fe59:19b2 dev wlan0 table 1030 proto ra metric 1024 expires 1619sec mtu 1280 hoplimit 64 p
ref medium
59,73c59,71
< unreachable default dev lo proto kernel metric 4294967295 error -101 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:6251:841c dev tun0 table 1101 proto static metric 1024 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:6253:a84d dev tun0 table 1101 proto static metric 1024 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:6254:d86f dev tun0 table 1101 proto static metric 1024 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:6256:2c3a dev tun0 table 1101 proto kernel metric 256 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:6256:2c3a dev tun0 table 1101 proto static metric 1024 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:625c:3d12 dev tun0 table 1101 proto static metric 1024 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:6265:6667 dev tun0 table 1101 proto static metric 1024 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:6279:d79 dev tun0 table 1101 proto static metric 1024 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:627b:7e36 dev tun0 table 1101 proto static metric 1024 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:627d:c577 dev tun0 table 1101 proto static metric 1024 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:627d:e54e dev tun0 table 1101 proto static metric 1024 pref medium
< fd7a:115c:a1e0:ab12:4843:cd96:627e:f33a dev tun0 table 1101 proto static metric 1024 pref medium
< fe80::/64 dev tun0 table 1101 proto kernel metric 256 pref medium
< default dev tun0 table 1101 proto static metric 1024 pref medium
---
> fd7a:115c:a1e0:ab12:4843:cd96:6251:841c dev tun0 table 1100 proto static metric 1024 pref medium
> fd7a:115c:a1e0:ab12:4843:cd96:6253:a84d dev tun0 table 1100 proto static metric 1024 pref medium
> fd7a:115c:a1e0:ab12:4843:cd96:6254:d86f dev tun0 table 1100 proto static metric 1024 pref medium
> fd7a:115c:a1e0:ab12:4843:cd96:6256:2c3a dev tun0 table 1100 proto kernel metric 256 pref medium
> fd7a:115c:a1e0:ab12:4843:cd96:6256:2c3a dev tun0 table 1100 proto static metric 1024 pref medium
> fd7a:115c:a1e0:ab12:4843:cd96:625c:3d12 dev tun0 table 1100 proto static metric 1024 pref medium
> fd7a:115c:a1e0:ab12:4843:cd96:6265:6667 dev tun0 table 1100 proto static metric 1024 pref medium
> fd7a:115c:a1e0:ab12:4843:cd96:6279:d79 dev tun0 table 1100 proto static metric 1024 pref medium
> fd7a:115c:a1e0:ab12:4843:cd96:627b:7e36 dev tun0 table 1100 proto static metric 1024 pref medium
> fd7a:115c:a1e0:ab12:4843:cd96:627d:c577 dev tun0 table 1100 proto static metric 1024 pref medium
> fd7a:115c:a1e0:ab12:4843:cd96:627d:e54e dev tun0 table 1100 proto static metric 1024 pref medium
> fd7a:115c:a1e0:ab12:4843:cd96:627e:f33a dev tun0 table 1100 proto static metric 1024 pref medium
> fe80::/64 dev tun0 table 1100 proto kernel metric 256 pref medium
86c84
< default via fe80::7c88:90b0:3d89:3def dev rmnet_data1 table 1011 proto ra metric 1024 expires 64539sec hoplimit 255 pref medium
---
> default via fe80::7c88:90b0:3d89:3def dev rmnet_data1 table 1011 proto ra metric 1024 expires 64543sec hoplimit 255 pref medium
91c89
< default via fe80::7cd0:2bc1:5947:27ed dev rmnet_data2 table 1012 proto ra metric 1024 expires 56363sec hoplimit 255 pref medium
---
> default via fe80::7cd0:2bc1:5947:27ed dev rmnet_data2 table 1012 proto ra metric 1024 expires 56367sec hoplimit 255 pref medium
116a115
> local fe80::65de:6b39:48b1:b180 dev lo table local proto unspec metric 0 pref medium
120d118
< local fe80::a16c:e301:1218:c23f dev lo table local proto unspec metric 0 pref medium
$
I got my phone set up as a debug target, pushed a Tailscale with the exit node PR, and set my phone to use an exit node. TL;DR: it appears to work, modulo some odd behavior in Chrome.
Some background: Android installs some very complex IP policy routing rules to accommodate many different scenarios, including being able to select on a per-socket basis what upstream network connection to use (e.g. so you can probe if wifi works while most of the OS sits on LTE). This makes it a little challenging to track what routes are getting used.
$ ip -6 rule show
0: from all lookup local
10000: from all fwmark 0xc0000/0xd0000 lookup 99
10500: from all iif lo oif dummy0 uidrange 0-0 lookup 1003
10500: from all iif lo oif rmnet_data0 uidrange 0-0 lookup 1010
10500: from all iif lo oif wlan0 uidrange 0-0 lookup 1030
10500: from all iif lo oif r_rmnet_data0 uidrange 0-0 lookup 1021
10500: from all iif lo oif rmnet_data1 uidrange 0-0 lookup 1011
11000: from all iif tun0 lookup 97
12000: from all fwmark 0x0/0x20000 iif lo uidrange 0-10406 lookup 1741
12000: from all fwmark 0x0/0x20000 iif lo uidrange 10408-99999 lookup 1741
12000: from all fwmark 0xc05d4/0xcffff lookup 1741
13000: from all fwmark 0x10063/0x1ffff iif lo lookup 97
13000: from all fwmark 0xd0001/0xdffff iif lo lookup 1010
13000: from all fwmark 0x105a2/0x1ffff iif lo lookup 1030
13000: from all fwmark 0xd0002/0xdffff iif lo lookup 1021
13000: from all fwmark 0x105d4/0x1ffff iif lo uidrange 0-10406 lookup 1741
13000: from all fwmark 0x105d4/0x1ffff iif lo uidrange 10408-99999 lookup 1741
13000: from all fwmark 0x105d4/0x1ffff iif lo uidrange 0-0 lookup 1741
13000: from all fwmark 0x505d5/0x5ffff iif lo lookup 1011
14000: from all iif lo oif dummy0 lookup 1003
14000: from all fwmark 0xc0000/0xc0000 iif lo oif rmnet_data0 lookup 1010
14000: from all iif lo oif wlan0 lookup 1030
14000: from all fwmark 0xc0000/0xc0000 iif lo oif r_rmnet_data0 lookup 1021
14000: from all iif lo oif tun0 uidrange 0-10406 lookup 1741
14000: from all iif lo oif tun0 uidrange 10408-99999 lookup 1741
14000: from all fwmark 0x40000/0x40000 iif lo oif rmnet_data1 lookup 1011
15000: from all fwmark 0x0/0x10000 lookup 99
16000: from all fwmark 0x0/0x10000 lookup 98
17000: from all fwmark 0x0/0x10000 lookup 97
18000: from all iif r_rmnet_data0 lookup 1030
18000: from all iif r_rmnet_data0 lookup 1003
19000: from all fwmark 0x5a2/0x1ffff iif lo lookup 1030
21000: from all fwmark 0x5d4/0xffff lookup 1030
22000: from all fwmark 0x0/0xffff iif lo lookup 1030
32000: from all unreachable
Not wanting to decode the whole thing here, but broadly: if a socket specifically binds to a particular network interface, use that interface's routing table. For everything else, behavior depends on whether the socket requested to use a specific upstream network, and whether "Android Protect VPN" (the builtin "vpn through google" thing) is active. The default case for "I just want to talk to the internet" seems to be:
12000: from all fwmark 0x0/0x20000 iif lo uidrange 0-10406 lookup 1741
12000: from all fwmark 0x0/0x20000 iif lo uidrange 10408-99999 lookup 1741
The fwmark is matching "traffic not marked as Protected", and the uidrange is matching "everything except the uid that's running the Tailscale app" (checked by ps -A -n | grep tailscale and finding that it's UID 10407 on my phone). Route table 1741 contains Tailscale's routes:
fd7a:115c:a1e0:ab12:4843:cd96:6241:ce1b dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6245:3b2f dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6245:3b54 dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6245:a712 dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6249:b40f dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:624b:341f dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:624f:e20f dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6250:fa09 dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6251:4805 dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6265:6667 dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6265:f173 dev tun0 proto kernel metric 256 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6265:f173 dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6267:8a2e dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:626b:430b dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:626b:7941 dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:626c:b663 dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:626e:ec6c dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:626f:ea16 dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6270:5a71 dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:6271:765 dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:627d:c43f dev tun0 proto static metric 1024 pref medium
fd7a:115c:a1e0:ab12:4843:cd96:627e:717b dev tun0 proto static metric 1024 pref medium
fe80::/64 dev tun0 proto kernel metric 256 pref medium
default dev tun0 proto static metric 1024 pref medium
Note I dumped IPv6 policy rules and routing tables, but IPv4 routing mirrors this exactly.
So, all this adds up to: IPv6 traffic that doesn't try hard to not use Tailscale is using Tailscale as its default route. I confirmed this with a couple more things:
in adb shell, ping6 google.com gets responses, and tcpdumping on my exit node I see traffic flowing out correctly.
still in the shell, netcat 2607:f8b0:400a:804::200e 443 successfully connects (to some random google.com serving machine), and again tcpdump sees the TCP session fly past on the exit node.
To cross-check, https://test-ipv6.com is a more in-depth check of IPv6 connectivity, and what it reports is that IPv6 is available, but "your browser is avoiding using IPv6". Translated, it means that it can use IPv6, but seems to be preferring IPv4 whenever it has a choice in the matter - which is the reverse of the normal "happy eyeballs" algorithm, which prefers v6 when possible.
@DentonGentry proposed a hypothesis that I like, which is that Chrome may be treating IPv6 ULAs (such as our Tailscale IPs and routes) as "less good" connectivity than native IPv6, and so is preferring IPv4 because it thinks the v6 connectivity is bad. Chrome apparently does this already with 6RD addresses, among others, so it's a plausible suggestion. I'm currently struggling to clone the Chromium source repository so that I can explore how exactly it's implementing Happy Eyeballs, to confirm or disprove.
In conclusion: exit nodes on Android seem to be working for me, but Chrome is behaving slightly weirdly in a way that doesn't harm the overall usability of the feature. We should probably root-cause what Chrome is up to, but no other particular worries.
@DentonGentry if you can repro your complete internet failure when using an exit node, I'd love to poke more at that, but It Works For Me currently.
I ended up rebooting the phone. I spent a day screwing around in adb and a termux shell on the device and with various networking utilities and rebuilding the Tailscale app. Something made it unhappy.
I'm now getting the same thing as you're seeing:
ipv6test.google.com says I don't have an IP6 address.
whatismyipaddress.com says IPv6 is "Not detected."
test-ipv6.com says I have an IPv6 address but the browser is avoiding using it. (I had not tried this yesterday)
Not clear that we'll do anything more about this: IPv6 via exit-node definitely does work on Android now. We get the warning from https://test-ipv6.com that "your browser is avoiding using IPv6," which we're attributing to the use of ULA IPv6 addresses and the browser deciding that ULA is less good.
If there are no further comments before the next bug scrub, we'll close this bug.
Activity
DentonGentry commentedon Mar 12, 2021
With Tailscale disconnected, using the Wi-Fi in the house, https://ipv6test.google.com/ says that I have an IPv6 address.
With Tailscale connected but not using an exit node, using the Wi-Fi in the house, https://ipv6test.google.com/ says that I have an IPv6 address.
I am also able to connect from the Android phone over IP6 on Tailscale to a web server running on the Ubuntu system:
With Tailscale connected and using the Ubuntu system as an exit node, using the Wi-Fi in the house, https://ipv6test.google.com/ says that I do not have an IPv6 address.
I can still reach the IPv6 web server running on the Ubuntu system, so IPv6 isn't broken altogether. It just seems like Android cannot get IPv6 packets past the Ubuntu system
DentonGentry commentedon Mar 12, 2021
Using
adb shell ip -6 route show table allto show the whole routing table with the exit node configured versus off, we see a new default route pointing to tun0 when the exit node is configured. This is fine, this is what we would expect to see.However it also removes the IPv6 prefix route pointing to the Wi-fi interface. This route is only present when the exit-node is set to none, it disappears when an exit-node is set.
I believe this is why IPv6 stops working, it loses the route which allows it to reach the outside world. Link-local addresses should still work, which might be how the Android device was able to reach the little IPv6 web server I had running on the exit-node system (described in previous comment).
An actual diff of the two cases shows more diffs, because the tables renumber and the expiry times change. These should be harmless. I believe we remove and re-add the whole table when the exit-node setting changes:
DentonGentry commentedon Mar 12, 2021
I'm not able to add that route back manually as a test:
danderson commentedon Mar 13, 2021
I got my phone set up as a debug target, pushed a Tailscale with the exit node PR, and set my phone to use an exit node. TL;DR: it appears to work, modulo some odd behavior in Chrome.
Some background: Android installs some very complex IP policy routing rules to accommodate many different scenarios, including being able to select on a per-socket basis what upstream network connection to use (e.g. so you can probe if wifi works while most of the OS sits on LTE). This makes it a little challenging to track what routes are getting used.
Not wanting to decode the whole thing here, but broadly: if a socket specifically binds to a particular network interface, use that interface's routing table. For everything else, behavior depends on whether the socket requested to use a specific upstream network, and whether "Android Protect VPN" (the builtin "vpn through google" thing) is active. The default case for "I just want to talk to the internet" seems to be:
The fwmark is matching "traffic not marked as Protected", and the uidrange is matching "everything except the uid that's running the Tailscale app" (checked by
ps -A -n | grep tailscaleand finding that it's UID 10407 on my phone). Route table 1741 contains Tailscale's routes:Note I dumped IPv6 policy rules and routing tables, but IPv4 routing mirrors this exactly.
So, all this adds up to: IPv6 traffic that doesn't try hard to not use Tailscale is using Tailscale as its default route. I confirmed this with a couple more things:
adb shell,ping6 google.comgets responses, and tcpdumping on my exit node I see traffic flowing out correctly.netcat 2607:f8b0:400a:804::200e 443successfully connects (to some random google.com serving machine), and again tcpdump sees the TCP session fly past on the exit node.However, in Chrome, Google's IPv6 test page (https://ipv6test.google.com/) reports that IPv6 is not being used. Similarly, googling "what is my IP?" from chrome on my phone returns my exit node's IPv4 address.
However! If you visit an IPv6-only website, such as https://ipv6.google.com, the site loads, and the exit node shows IPv6 traffic taking place. And if you google "what is my IP?" from ipv6.google.com, the result shows the correct IPv6 address of the exit node.
To cross-check, https://test-ipv6.com is a more in-depth check of IPv6 connectivity, and what it reports is that IPv6 is available, but "your browser is avoiding using IPv6". Translated, it means that it can use IPv6, but seems to be preferring IPv4 whenever it has a choice in the matter - which is the reverse of the normal "happy eyeballs" algorithm, which prefers v6 when possible.
@DentonGentry proposed a hypothesis that I like, which is that Chrome may be treating IPv6 ULAs (such as our Tailscale IPs and routes) as "less good" connectivity than native IPv6, and so is preferring IPv4 because it thinks the v6 connectivity is bad. Chrome apparently does this already with 6RD addresses, among others, so it's a plausible suggestion. I'm currently struggling to clone the Chromium source repository so that I can explore how exactly it's implementing Happy Eyeballs, to confirm or disprove.
In conclusion: exit nodes on Android seem to be working for me, but Chrome is behaving slightly weirdly in a way that doesn't harm the overall usability of the feature. We should probably root-cause what Chrome is up to, but no other particular worries.
@DentonGentry if you can repro your complete internet failure when using an exit node, I'd love to poke more at that, but It Works For Me currently.
DentonGentry commentedon Mar 13, 2021
I ended up rebooting the phone. I spent a day screwing around in adb and a termux shell on the device and with various networking utilities and rebuilding the Tailscale app. Something made it unhappy.
I'm now getting the same thing as you're seeing:
DentonGentry commentedon Jun 26, 2021
Not clear that we'll do anything more about this: IPv6 via exit-node definitely does work on Android now. We get the warning from https://test-ipv6.com that "your browser is avoiding using IPv6," which we're attributing to the use of ULA IPv6 addresses and the browser deciding that ULA is less good.
If there are no further comments before the next bug scrub, we'll close this bug.
DentonGentry commentedon Jul 14, 2021
I'm going to close this as fixed, IPv6 and exit nodes do work on Android now. We'll track remaining IPv6 work on #2299.