问题
sudo apt-get update
报错‘Could not resolve ‘mirrors.cloud.aliyuncs.com‘
解决办法
如果你也装了tailscale的话,下面方法希望对你有效
输入iptables -nL --line-number
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ts-input all -- 0.0.0.0/0 0.0.0.0/0
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 ts-forward all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
Chain ts-forward (1 references)
num target prot opt source destination
1 MARK all -- 0.0.0.0/0 0.0.0.0/0 MARK xset 0x40000/0xff0000
2 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 mark match 0x40000/0xff0000
3 DROP all -- 100.64.0.0/10 0.0.0.0/0
4 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
Chain ts-input (1 references)
num target prot opt source destination
1 ACCEPT all -- 100.104.226.57 0.0.0.0/0
2 RETURN all -- 100.115.92.0/23 0.0.0.0/0
会看到一条规则把100.64.0.0/10网段给禁用了,这个网段刚好是阿里云内网
删除这条规则,以下命令根据规则位置会稍有不同注意修改iptables -D ts-forward 3
然后就可以正常更新软件源了!
参考资料:[1]一次Tailscale网络问题的调试过程 - Frank's Weblog (nyan.im)