路由表命中?

Lee*_*e B 7 networking linux windows routing routes

使用 iptables -L -n -v 可以获得每条防火墙规则被应用的次数,这在调试时非常有用。我想知道是否有类似的方法来找出网络路由被使用了多少次。我主要询问 Linux 和 Windows 解决方案,但任何平台的解决方案都会很有趣。

Ben*_*ams 2

尝试

route -neeC
Run Code Online (Sandbox Code Playgroud)

并查看“使用”栏。man route表示这是路线的查找计数。

  • Fwiw,这个 2009 年的答案在 linux >= 3.6 (~2012) 上将不再有效(空结果):[ipv4:删除路由缓存](https://git.kernel.org/pub/scm/linux/kernel/git /torvalds/linux.git/commit/?id=89aef8921bfbac22f00e04f8450f6e447db13e42) (3认同)