# Tailscale

Install and configure the Tailscale client to establish a secure mesh network and manage node connectivity.

### References

<ReferenceLinks references={frontmatter.references} />

---

1.  ## Install

        ```sh preserveIndent wrap
        curl -fsSL https://tailscale.com/install.sh | sh
        ```

2.  ## Optimizations for subnet routers and exit nodes (optional)

        Enable IP forwarding and adjust network interface offloading to maximize throughput for routed traffic.

        ### Network performance

        ```sh
        NETDEV=$(ip -o route get 1.1.1.1 | cut -f 5 -d " ")
        sudo ethtool -K $NETDEV rx-udp-gro-forwarding on rx-gro-list off
        ```

        ### Persist on reboot

        ```sh
        printf '#!/bin/sh

        ethtool -K %s rx-udp-gro-forwarding on rx-gro-list off
        ' "$(ip -o route get 1.1.1.1 | cut -f 5 -d " ")" | sudo tee /etc/networkd-dispatcher/routable.d/50-tailscale
        sudo chmod 755 /etc/networkd-dispatcher/routable.d/50-tailscale
        ```

        ### Enable IP forwarding

        ```sh
        echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
        echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
        sudo sysctl -p /etc/sysctl.d/99-tailscale.conf
        ```

3.  ## Start

        ```sh
        sudo tailscale up --advertise-routes={{SUBNET_VAR}} --accept-dns=false --advertise-exit-node --accept-routes=false
        ```

4.  ## Admin console

        - Go to <a class="link" href="https://login.tailscale.com/admin/machines" target="_blank" rel="noopener">https://login.tailscale.com/admin/machines</a>.
        - Approve `exit node` and `subnet routes` for your device.
        - Go to DNS > **Nameservers**.
        - **Add Nameserver:** Select `Custom`.
        - **IP address:** Enter your `Tailscale IP` *(100.x.y.z)*.
        - **Override Local DNS:** toggle to `ON`.
