Last active
August 19, 2025 07:15
-
-
Save shibeta/6a30b77780883a7ee90c6bf94774253f to your computer and use it in GitHub Desktop.
A script to auto enable transport layer offloads to improve UDP throughput for Tailscale
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Tailscale GRO optimization for OpenWrt | |
| # This script applies ethtool GRO settings on the WAN interface | |
| # to improve Tailscale UDP throughput as exit node or subnet router. | |
| # Works on linux kernel >= 6.2, Tailscale >= 1.54 | |
| # See https://tailscale.com/s/ethtool-config-udp-gro | |
| # Check if ethtool exists. If not, exit with an error. | |
| # The path /usr/sbin/ethtool is common on OpenWrt. | |
| if [ ! -f /usr/sbin/ethtool ]; then | |
| logger -t tailscale-gro-fix "ethtool not found. Cannot apply GRO optimizations." | |
| exit 1 | |
| fi | |
| # We only want to run this script when the 'wan' interface comes up. | |
| # The variables ACTION and INTERFACE are provided by the hotplug system. | |
| [ "$ACTION" = "ifup" ] && [ "$INTERFACE" = "wan" ] || exit 0 | |
| # The DEVICE variable is the actual network adapter name of the 'wan' interface. | |
| # DHCP usually wan, PPPoE usually pppoe-wan | |
| if [ -n "$DEVICE" ]; then | |
| logger -t tailscale-gro-fix "Applying Tailscale GRO optimizations for '$DEVICE'." | |
| # Apply the recommended settings. | |
| ethtool -K "$DEVICE" rx-udp-gro-forwarding on rx-gro-list off | |
| if [ $? -eq 0 ]; then | |
| logger -t tailscale-gro-fix "GRO optimizations applied successfully." | |
| else | |
| logger -t tailscale-gro-fix "Failed to apply GRO optimizations to '$DEVICE'." | |
| exit 1 | |
| fi | |
| fi | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment