用 `ip route show` 查看路由表和默认网关

流量走错网卡或网关疑似不通时,路由表是第一排查点——`ip route show` 就是读取它的快捷命令。

Linux路由网关故障排查IP低风险
运行 `ip route show` 打印内核路由表,其中以 `default via` 开头的行就是当前默认网关。

01命令

命令
$ ip route show

02作用说明

每个数据包都按内核路由表转发,所以「为什么连不上 X」的问题应先看这里。`default via <IP> dev <网卡>` 一行指出了网关和出口接口,其余行则是各链路直连的网段。还可以用 `ip route get 1.1.1.1` 查看某个目标地址实际会走哪条路由。

03风险

风险低风险
使用条件Ships with iproute2, installed on virtually all modern distros

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • ip(8) — Linux manual page
    man7.org · technical · 2026-09-17
    依据: Documents the `ip route show` subcommand that prints the kernel routing table

最后验证: 2026-09-17 · 分类: 网络

06相关方案