Skip to content

Tailscale does not set up IPv6 NAT when running in containers #11344

Closed

Description

@irbekrm

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:

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

  1. self-assigned this
    on Mar 6, 2024
  2. changed the title [-]Tailscale does not set up IPv6 NAT when running on (some) Kubernetes[/-] [+]Tailscale does not set up IPv6 NAT when running in containers[/+] on Mar 6, 2024
  3. irbekrm commented on Mar 6, 2024

    @irbekrm
    ContributorAuthor

    This should have been fixed in #11353

    unstable-v1.61.87 image tags/1.61.87 helm chart has the fix.

  4. irbekrm commented on Mar 8, 2024

    @irbekrm
    ContributorAuthor

    Closing as should be fixed in #11353

  5. added a commit that references this issue on Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions