小编kri*_*itx的帖子

route -n 在 Linux 中如何工作?

我可以理解 的输出strace route -n,但route真的读取任何文件/proc来获取路由表吗?此外,如果路由和 IP 地址存储在 下/proc,为什么不strace显示正在访问的文件?

root@xxxx:/etc/postfix# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.21.58.0     0.0.0.0         255.255.254.0   U     0      0        0 eth0
0.0.0.0         10.21.58.1     0.0.0.0         UG    100    0        0 eth0
Run Code Online (Sandbox Code Playgroud)

编辑,经过更多研究:

似乎route 确实读取了/proc:下的文件,特别是/proc/net/route. 那么,路由信息是如何到达那里的呢?

linux linux-kernel

2
推荐指数
1
解决办法
5327
查看次数

标签 统计

linux ×1

linux-kernel ×1