Add ip rule to NixOS config for tailscale subnet router issue

I’m having some issues with Tailscale where passing --accept-routes causes connections from the LAN to not work (can’t ping, ssh, etc. the LAN ip as if the firewall is enabled)

Tailscale has information about this on their wiki: How to prioritize LAN traffic with overlapping subnet routes, and the solution is to install an ip rule:

ip rule add to priority 2500 lookup main

What is the correct way to make this persistent in my NixOS config?

1 Like