TailscaleのExit Nodeが動かなくなったとき
なぜかマスカレードが効かなくなり、クライアントからexit nodeの出口として使えなくなった
クライアントでexit nodeに接続した状態で外部にpingしてみる→exit nodeまではICMPが届いていることは確認
カーネルのアップグレードにより、Tailscaleがiptablesにmasquarade用のconfigを挿入できなくなったのが原因
関連
https://github.com/tailscale/tailscale/issues/14410
https://github.com/tailscale/tailscale/issues/15549
対応その1(推奨)
まずはカーネルのアップグレードをしてみる(パッチが公開されている)
それでもダメな場合は以下を設定する
https://github.com/tailscale/tailscale/issues/14410
code:sh
sudo vim /etc/default/tailscaled
# Add following
TS_DEBUG_FIREWALL_MODE=nftables
対応その2:
マスカレードの設定が存在するか確認
code:sh
sudo iptables -t nat -S ts-postrouting
# sudo nft list chain ip nat ts-postrouting
ない場合、Tailscaleからの通信をマスカレードするように設定
code:sh
sudo iptables -t nat -A ts-postrouting -s 100.64.0.0/10 -j MASQUERADE
# sudo iptables -t nat -I ts-postrouting 1 -o eth0 -j MASQUERADE
Raspberry Piの場合
code:sh
# sudo nft list ruleset
sudo nft add chain ip nat ts-postrouting '{ type nat hook postrouting priority 100; }'
sudo nft add rule ip nat ts-postrouting ip saddr 100.64.0.0/10 masquerade
永続化
code:sh
sudo apt-get install -y iptables-persistent
sudo netfilter-persistent save
https://chatgpt.com/c/67f3dfc5-da54-8004-9112-e243429998a9
Tailscale
public