如何刷新自定义路线?

如何刷新自定义路线?

我在 MacOS 系统上,运行一些脚本后,我的路由表中出现了一些垃圾,如下所示:

27.123.232/22      172.19.25.254      UGSc            0        0     en0
36.255.220/22      172.19.25.254      UGSc            0        0     en0
43.246.112/22      172.19.25.254      UGSc            0        0     en0
45.114.108/22      172.19.25.254      UGSc            0        0     en0
45.122.96/21       172.19.25.254      UGSc            0        0     en0
52.80/16           172.19.25.254      UGSc            0        0     en0
52.81/16           172.19.25.254      UGSc            0        0     en0
52.82/15           172.19.25.254      UGSc            0        0     en0
101.36/17          172.19.25.254      UGSc            0        0     en0
101.36.128/17      172.19.25.254      UGSc            0        0     en0
103.9.192/22       172.19.25.254      UGSc            0        0     en0
103.14.32/22       172.19.25.254      UGSc            0        0     en0
103.27.184/22      172.19.25.254      UGSc            0        0     en0
103.27.212/22      172.19.25.254      UGSc            0        0     en0
103.35.180/22      172.19.25.254      UGSc            0        0     en0
103.68.64/22       172.19.25.254      UGSc            0        0     en0
103.68.88/22       172.19.25.254      UGSc            0        0     en0
103.68.100/22      172.19.25.254      UGSc            0        0     en0
103.68.128/22      172.19.25.254      UGSc            0        0     en0
103.68.192/22      172.19.25.254      UGSc            0        0     en0
103.69.16/22       172.19.25.254      UGSc            0        0     en0
103.69.116/22      172.19.25.254      UGSc            0        0     en0
103.69.132/22      172.19.25.254      UGSc            0        0     en0
103.69.152/22      172.19.25.254      UGSc            0        0     en0
103.69.212/22      172.19.25.254      UGSc            0        0     en0
103.70.8/22        172.19.25.254      UGSc            0        0     en0
103.70.148/22      172.19.25.254      UGSc            0        0     en0
103.70.184/22      172.19.25.254      UGSc            0        0     en0
103.70.220/22      172.19.25.254      UGSc            0        0     en0
103.70.224/22      172.19.25.254      UGSc            0        0     en0
103.70.236/22      172.19.25.254      UGSc            0        0     en0
103.70.252/22      172.19.25.254      UGSc            0        0     en0
103.71/22          172.19.25.254      UGSc            0        0     en0
103.71.32/22       172.19.25.254      UGSc            0        0     en0
103.71.48/22       172.19.25.254      UGSc            0        0     en0
103.71.68/22       172.19.25.254      UGSc            0        0     en0
103.71.72/22       172.19.25.254      UGSc            0        0     en0
103.71.80/22       172.19.25.254      UGSc            0        0     en0
103.71.84/22       172.19.25.254      UGSc            0        0     en0
103.71.88/22       172.19.25.254      UGSc            0        0     en0
103.71.120/22      172.19.25.254      UGSc            0        0     en0
103.71.124/22      172.19.25.254      UGSc            0        0     en0
103.71.128/22      172.19.25.254      UGSc            0        0     en0
103.71.144/22      172.19.25.254      UGSc            0        0     en0
103.71.196/22      172.19.25.254      UGSc            0        0     en0
103.71.200/22      172.19.25.254      UGSc            0        0     en0
103.71.232/22      172.19.25.254      UGSc            0        0     en0
103.72.12/22       172.19.25.254      UGSc            0        0     en0
103.72.16/22       172.19.25.254      UGSc            0        0     en0
103.72.20/22       172.19.25.254      UGSc            0        0     en0
103.72.24/22       172.19.25.254      UGSc            0        0     en0
103.72.28/22       172.19.25.254      UGSc            0        0     en0
103.72.32/22       172.19.25.254      UGSc            0        0     en0
103.72.36/22       172.19.25.254      UGSc            0        0     en0
103.72.40/22       172.19.25.254      UGSc            0        0     en0
103.72.44/22       172.19.25.254      UGSc            0        0     en0
103.72.48/22       172.19.25.254      UGSc            0        0     en0
103.72.52/22       172.19.25.254      UGSc            0        0     en0
103.72.112/22      172.19.25.254      UGSc            0        0     en0
103.72.116/22      172.19.25.254      UGSc            0        0     en0
103.72.120/22      172.19.25.254      UGSc            0        0     en0
103.72.124/22      172.19.25.254      UGSc            0        0     en0
103.72.128/22      172.19.25.254      UGSc            0        0     en0
103.72.132/22      172.19.25.254      UGSc            0        0     en0
103.72.144/22      172.19.25.254      UGSc            0        0     en0
103.72.148/22      172.19.25.254      UGSc            0        0     en0
103.72.164/22      172.19.25.254      UGSc            0        0     en0
103.72.172/22      172.19.25.254      UGSc            0        0     en0
103.72.180/22      172.19.25.254      UGSc            0        0     en0
103.72.224/22      172.19.25.254      UGSc            0        0     en0
103.72.228/22      172.19.25.254      UGSc            0        0     en0
103.72.232/22      172.19.25.254      UGSc            0        0     en0
103.72.236/22      172.19.25.254      UGSc            0        0     en0
103.72.240/22      172.19.25.254      UGSc            0        0     en0
103.72.244/22      172.19.25.254      UGSc            0        0     en0
103.72.248/22      172.19.25.254      UGSc            0        0     en0
103.72.252/22      172.19.25.254      UGSc            0        0     en0
103.73/22          172.19.25.254      UGSc            0        0     en0
103.73.4/22        172.19.25.254      UGSc            0        0     en0
103.73.8/22        172.19.25.254      UGSc            0        0     en0
103.73.12/22       172.19.25.254      UGSc            0        0     en0
103.73.16/22       172.19.25.254      UGSc            0        0     en0
103.73.20/22       172.19.25.254      UGSc            0        0     en0
103.73.24/22       172.19.25.254      UGSc            0        0     en0
103.73.28/22       172.19.25.254      UGSc            0        0     en0
103.73.48/22       172.19.25.254      UGSc            0        0     en0
103.73.88/22       172.19.25.254      UGSc            0        0     en0
103.73.96/22       172.19.25.254      UGSc            0        0     en0
103.73.116/22      172.19.25.254      UGSc            0        0     en0
103.73.120/22      172.19.25.254      UGSc            0        0     en0
103.73.128/22      172.19.25.254      UGSc            0        0     en0
103.73.132/22      172.19.25.254      UGSc            0        0     en0
103.73.136/22      172.19.25.254      UGSc            0        0     en0
103.73.140/22      172.19.25.254      UGSc            0        0     en0
103.73.144/22      172.19.25.254      UGSc            0        0     en0
103.73.168/22      172.19.25.254      UGSc            0        0     en0
103.73.176/22      172.19.25.254      UGSc            0        0     en0
103.73.204/22      172.19.25.254      UGSc            0        0     en0
103.73.208/22      172.19.25.254      UGSc            0        0     en0
103.73.240/22      172.19.25.254      UGSc            0        0     en0
103.73.244/22      172.19.25.254      UGSc            0        0     en0
103.73.248/22      172.19.25.254      UGSc            0        0     en0
103.74.24/22       172.19.25.254      UGSc            0        0     en0
103.74.28/22       172.19.25.254      UGSc            0        0     en0
103.74.32/22       172.19.25.254      UGSc            0        0     en0
103.74.36/22       172.19.25.254      UGSc            0        0     en0
103.74.40/22       172.19.25.254      UGSc            0        0     en0
103.74.44/22       172.19.25.254      UGSc            0        0     en0
103.74.48/22       172.19.25.254      UGSc            0        0     en0
103.74.56/22       172.19.25.254      UGSc            0        0     en0
103.74.60/22       172.19.25.254      UGSc            0        0     en0
103.74.80/22       172.19.25.254      UGSc            0        0     en0
103.74.124/22      172.19.25.254      UGSc            0        0     en0
103.74.148/22      172.19.25.254      UGSc            0        0     en0
103.74.152/22      172.19.25.254      UGSc            0        0     en0
103.74.156/22      172.19.25.254      UGSc            0        0     en0

还有更多...显然。因此很明显,我无法通过键入来删除它们route delete ...。我尝试了路由刷新,但没有用。有没有办法一次性删除它们?

我能够通过使用输出所有需要删除的 IP netstat -nr | grep 172.19.25.254 | awk '{print$1}',但我不知道下一步该做什么......

答案1

信不信由你,你只需要发出sudo route -n flush几次。尝试 4 或 5 次。然后关闭网络接口并重新启动,方法是在系统偏好设置中禁用/重新启用,或者发出:

sudo ifconfig en0 down

进而:

sudo ifconfig en0 up

相关内容