109 lines
3.7 KiB
Markdown
109 lines
3.7 KiB
Markdown
# LAN Routing Fix: Tailscale 10GbE Throughput Issue
|
|
|
|
## Problem
|
|
|
|
Hosts with host-level Tailscale on the `192.168.0.0/24` LAN have their local traffic intercepted by Tailscale's policy routing table 52. Instead of going directly over the physical 10GbE link, traffic gets routed through the WireGuard tunnel via Calypso's advertised `192.168.0.0/24` subnet route.
|
|
|
|
### Root Cause
|
|
|
|
Calypso (Headscale node ID:12) advertises `192.168.0.0/24` as a subnet route so remote nodes (Moon, Seattle, NUC) can reach LAN devices over Tailscale. However, machines that are **already on** that LAN also accept this route into Tailscale's routing table 52 (ip rule priority 5270), causing local traffic to hairpin through the tunnel.
|
|
|
|
Diagnosis:
|
|
```bash
|
|
# Shows traffic going through tailscale0 instead of the physical NIC
|
|
ip route get 192.168.0.200
|
|
# → 192.168.0.200 dev tailscale0 table 52 src 100.75.252.64
|
|
|
|
# Table 52 has the LAN subnet routed through Tailscale
|
|
ip route show table 52 | grep 192.168.0
|
|
# → 192.168.0.0/24 dev tailscale0
|
|
```
|
|
|
|
### Affected Hosts
|
|
|
|
| Host | LAN IP | Physical NIC | Affected? |
|
|
|---|---|---|---|
|
|
| Guava (TrueNAS) | 192.168.0.100 | enp1s0f0np0 (10GbE) | **YES** — fixed |
|
|
| homelab-vm | 192.168.0.210 | ens18 | **YES** — fixed |
|
|
| Atlantis | 192.168.0.200 | eth2/ovs_eth2 (10GbE) | No (Synology OVS) |
|
|
| Calypso | 192.168.0.250 | ovs_eth2 | No (Synology OVS) |
|
|
| Pi-5 | 192.168.0.66 | eth0 | No (not accepting route) |
|
|
| NUC | 192.168.68.100 | eno1 | No (different subnet) |
|
|
|
|
### Measured Impact (Guava → Atlantis)
|
|
|
|
| Route | Throughput | Retransmits |
|
|
|---|---|---|
|
|
| Before fix (via Tailscale) | 1.39 Gbps | 6,891 |
|
|
| After fix (direct LAN) | **7.61 Gbps** | 5,066 |
|
|
|
|
**5.5x improvement** — from WireGuard-encapsulated tunnel to direct 10GbE.
|
|
|
|
## Fix Applied
|
|
|
|
Add an ip policy rule at priority 5200 (before Tailscale's table 52 at 5270) that forces LAN traffic to use the main routing table, which routes via the physical NIC:
|
|
|
|
```bash
|
|
sudo ip rule add to 192.168.0.0/24 lookup main priority 5200
|
|
```
|
|
|
|
This means: for any traffic destined to `192.168.0.0/24`, check the main table first. The main table has `192.168.0.0/24 dev <physical-nic>`, so traffic goes direct. All Tailscale traffic to `100.x.x.x` nodes is unaffected.
|
|
|
|
### Verification
|
|
|
|
```bash
|
|
# Should show physical NIC, not tailscale0
|
|
ip route get 192.168.0.200
|
|
|
|
# Should get sub-1ms ping
|
|
ping -c 3 192.168.0.200
|
|
|
|
# Confirm rule is in place
|
|
ip rule show | grep 5200
|
|
```
|
|
|
|
### Revert
|
|
|
|
```bash
|
|
sudo ip rule del to 192.168.0.0/24 lookup main priority 5200
|
|
```
|
|
|
|
## Persistence
|
|
|
|
### Guava (TrueNAS)
|
|
|
|
Init script added via TrueNAS API (ID: 2):
|
|
- **Type:** COMMAND
|
|
- **When:** POSTINIT
|
|
- **Command:** `ip rule add to 192.168.0.0/24 lookup main priority 5200`
|
|
- **Comment:** Bypass Tailscale routing for LAN traffic (direct 10GbE)
|
|
|
|
Manage via TrueNAS UI: **System → Advanced → Init/Shutdown Scripts**
|
|
|
|
### homelab-vm (Ubuntu 24.04)
|
|
|
|
Systemd service at `/etc/systemd/system/lan-route-fix.service`:
|
|
```ini
|
|
[Unit]
|
|
Description=Ensure LAN traffic bypasses Tailscale routing table
|
|
After=network-online.target tailscaled.service
|
|
Wants=network-online.target
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
ExecStart=/sbin/ip rule add to 192.168.0.0/24 lookup main priority 5200
|
|
ExecStop=/sbin/ip rule del to 192.168.0.0/24 lookup main priority 5200
|
|
RemainAfterExit=yes
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
```
|
|
|
|
Enabled with `sudo systemctl enable lan-route-fix.service`.
|
|
|
|
## Notes
|
|
|
|
- Remote nodes (Moon, Seattle, NUC) that are **not** on `192.168.0.0/24` are unaffected — they correctly use Calypso's subnet route to reach LAN devices via Tailscale.
|
|
- If a new host is added to the LAN with host-level Tailscale, the same fix will need to be applied.
|
|
- The Synology boxes (Atlantis, Calypso) use Open vSwitch bridging and don't exhibit this issue.
|