Repository navigation
Description
What is the issue?
It appears that in some cases (tested with GKE and EKS deployments), tailscale running in non-userspace mode in containers incorrectly determines that it is not possible to set up IPv6 NAT rules (masquerading).
This seems to be because the check for whether IPv6 NAT is available always (? as far as I have tested) fails in container envs:
/proc/net/ip6_tables_namesseems to remain empty till the first timeiptablesrules are queried (see /proc/net/ip_tables_names is empty until iptables is queried moby/moby#34337 and my testing seemed to confirm that)- modprobe does not work in container envs (unless running as privileged)
One issue that this creates (from a user report) is that it is not possible to access IPv6 hosts via exit nodes deployed on Kubernetes in non-userspace mode.
I tested that an IPv6 masquerading rule can be added by hand to the exit node Pod and it is then able to route IPv6 traffic.
Steps to reproduce
-
Create an exit node on Kubernetes, i.e via
Connector. -
Exec to the Pod and observe that masquerading is only set up for IPv4 (assuming this runs with iptables):
Details
/ # iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
ts-postrouting all -- anywhere anywhere
Chain ts-postrouting (1 references)
target prot opt source destination
MASQUERADE all -- anywhere anywhere mark match 0x40000/0xff0000
/ # ip6tables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
-
Observe that a tailnet node that uses this exit node cannot access IPv6 endpoints.
-
Exec to the Pod and manually add masquerading for IPv6:
ip6tables -t nat -I POSTROUTING 1 -m mark --mark 0x40000/0xff0000 -j MASQUERADE
- Observe that IPv6 endpoints can now be accessed via the exit node.
Are there any recent changes that introduced the issue?
No response
OS
No response
OS version
No response
Tailscale version
No response
Other software
No response
Bug report
No response
Activity
[-]Tailscale does not set up IPv6 NAT when running on (some) Kubernetes[/-][+]Tailscale does not set up IPv6 NAT when running in containers[/+]util/linuxfw: add container-friendly IPv6 NAT check
util/linuxfw: add container-friendly IPv6 NAT check
util/linuxfw: add container-friendly IPv6 NAT check
util/linuxfw: add container-friendly IPv6 NAT check
util/linuxfw: add container-friendly IPv6 NAT check (#11353)
irbekrm commentedon Mar 6, 2024
This should have been fixed in #11353
unstable-v1.61.87image tags/1.61.87helm chart has the fix.irbekrm commentedon Mar 8, 2024
Closing as should be fixed in #11353
util/linuxfw: fix support for containers without IPv6 iptables filters
util/linuxfw: correct logical error in NAT table check
util/linuxfw: correct logical error in NAT table check (#11380)
util/linuxfw: fix support for containers without IPv6 iptables filters (
N (#4)
util/linuxfw: add container-friendly IPv6 NAT check (tailscale#11353)
util/linuxfw: correct logical error in NAT table check (tailscale#11380)
util/linuxfw: fix support for containers without IPv6 iptables filters (