Skip to content

Detect which iptables to use in containers #5621

Open

Description

@bradfitz

[we have copies of this bug scattered about as comments on other bugs, so creating one tracking bug]

On Linux, when Tailscale is running in a container, we should ask the kernel directly whether iptables-legacy or iptables-nft is the right interface and use the right binary, regardless of what the "iptables" binary is a symlink to on disk.

And if the right binary is not available, fail loudly.

That is, the host environment outside of the container could be using iptables-legacy vs iptables-nft and even if the host's Debian alternatives or equivalent is correct, the container's alternatives might be wrong.

This manifests in lots of weird iptables errors.

@andrew-d has done all the hard work for this bug already. Filing this bug to cross-reference other bugs against.

Activity

  1. zyclonite commented on Jan 15, 2023

    @zyclonite
  2. DentonGentry commented on Jan 15, 2023

    @DentonGentry
  3. zyclonite commented on Jan 16, 2023

    @zyclonite

    on coreos for example just detecting that could be tricky as both variants exist... checking for existing rules on one of them would also be quite a hack...
    i would still prefer a way to have some toggle to force the container

  4. rodrigc commented on May 31, 2023

    @rodrigc
    Contributor

    Maybe replicating the logic done in Kubernetes to detect iptables vs. nftables is an option:
    https://unix.stackexchange.com/a/589006

  5. DentonGentry commented on May 31, 2023

    @DentonGentry
    Contributor

    #391 is also relevant, if tailscaled can stop using iptables/nftables binaries altogether.

  6. rodrigc commented on May 31, 2023

    @rodrigc
    Contributor

    @DentonGentry I am at Tailscale Up today,
    and talked with a manager, @catzkorn . @catzkorn mentioned that there is someone at tailscale ( @KevinLiang10 ) who is scoping out a solution to address #391 .

    That solution for that will probably solve #5621

  7. rodrigc commented on Sep 5, 2023

    @rodrigc
    Contributor

    I verified here that the logic in #391 to detect nftables works inside a container

  8. zyclonite commented on Sep 6, 2023

    @zyclonite

    if nftables are installed and iptables-nft is as well available to stay compatible like on the current fedora coreos builds it does not work and need to be forced to use nftables

  9. rodrigc commented on Sep 6, 2023

    @rodrigc
    Contributor
  10. zyclonite commented on Sep 6, 2023

    @zyclonite

    yes

  11. rodrigc commented on Sep 6, 2023

    @rodrigc
    Contributor

    @zyclonite if you set TS_DEBUG_FIREWALL_MODE=nftables, what do lines appear in the tailscaled logs when detecting the type of firewall?

  12. 24 remaining items

  13. added a commit that references this issue on Mar 13, 2024
  14. foertel commented on Apr 26, 2026

    @foertel

    Did we just abandon this? 🤓

    On current CoreOS still weird iptables errors pop up in tailscale status when running current tailscale/tailscale docker container.

    It is fine when I set -e TS_DEBUG_FIREWALL_MODE=nftables.

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