ECS安装Tailscale后突然失联……第一次知道原来DNS用的是阿里内部网段的IP
前情提要:为了给Tailscale的DERP服务器有账号验证,在ECS上安装了Tailscale
然后ECS涉及到阿里云内网服务的东西都挂掉了)
简要的说:
Tailscale启动时,会修改防火墙,自行添加部分规则,其中100.64.0.0/10的规则覆盖到了ECS的部分阿里云内网服务,比如阿里云的内网DNS、阿里云的网页SSH、云检测服务等。
故障原因:
Tailscale的防火墙设置中,会有一条防伪造规则
DROP all -- !tailscale0 * 100.64.0.0/10这个防火墙设置会导致不从tailscale0接口进来的100.64.0.0/10网段内的数据被抛弃,所以影响到了阿里云内网服务到ECS的通讯。
简单的解决方法:
先关掉Tailscale服务,然后用tailscale up --reset --netfilter-mode=off重新启动Tailscale
影响:使用tailscale up --reset --netfilter-mode=off会让Tailscale在不修改防火墙的情况下运行;同时可能会让Tailscale涉及到路由或防火墙的部分功能无法使用,如转发,宣告内网之类的。
Tailscale添加的防火墙规则
Chain INPUT (policy ACCEPT 39749 packets, 7554K bytes)
pkts bytes target prot opt in out source destination
356 38250 ts-input all -- * * 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT 17 packets, 975 bytes)
pkts bytes target prot opt in out source destination
0 0 ts-forward all -- * * 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain ts-forward (1 references)
pkts bytes target prot opt in out source destination
0 0 MARK all -- tailscale0 * 0.0.0.0/0 0.0.0.0/0 MARK xset 0x40000/0xff0000
0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 mark match 0x40000/0xff0000
0 0 DROP all -- * tailscale0 100.64.0.0/10 0.0.0.0/0
0 0 ACCEPT all -- * tailscale0 0.0.0.0/0 0.0.0.0/0
Chain ts-input (1 references)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- lo * 100.113.83.5 0.0.0.0/0
0 0 ACCEPT all -- tailscale0 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:41641
0 0 RETURN all -- !tailscale0 * 100.115.92.0/23 0.0.0.0/0
7 421 DROP all -- !tailscale0 * 100.64.0.0/10 0.0.0.0/0