tailscale-linux-子网配置

tailscale在linux下组网需要配置,不像win一样Plug and play。这也是linux的乐趣,只有真正热爱且有时间的人会得到奖励。

之前一直没找到方法,今天才找到官方文档中的相关部分。
先看链接

1
2
https://tailscale.com/kb/1019/subnets/#enable-ip-forwarding
https://tailscale.com/kb/1023/troubleshooting/#why-do-i-get-an-error-about-ip-forwarding-when-using-advertise-routes

Enable IP forwarding

If your Linux system has a /etc/sysctl.d directory, use:

1
2
3
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

Otherwise, use:

1
2
3
echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf

If your Linux node uses firewalld, you may need to also allow masquerading due to a known issue. As a workaround, you can allow masquerading with this command:

1
firewall-cmd --permanent --add-masquerade

Other distros may require different steps.

When enabling IP forwarding, ensure your firewall is set up to deny traffic forwarding by default. This is a default setting for common firewalls like ufw and firewalld, and ensures your device doesn’t route traffic you don’t intend.


tailscale-linux-子网配置
https://zhaosn.github.io/2022/tailscale-subnet-linux/
作者
Zhao SN
发布于
2022年10月28日
更新于
2022年10月28日
许可协议