I'm routing specific devices through a separate gateway device that connects to a Tailscale VPN exit node.
I'm using this command so my device can act as NAT router to Tailscale:
sudo iptables -t nat -A POSTROUTING -o tailscale0 -j MASQUERADE
But this only works because I've enabled IP forwarding in sysctl:
sudo sysctl net.ipv4.ip_forward=1
sudo sysctl net.ipv6.conf.all.forwarding=1
I'd like to be more specific with my NAT routing such that only traffic to certain domains go through the tailscale0 interface and everything else passes through. I'm assuming this is the same issue you'd see with OpenVPN's tun0 and tap0 interfaces.
How can I accomplish L3 domain routing with iptables?