在Debian系统中,ifconfig
命令主要用于配置、激活和查询网络接口参数,但它并不直接显示路由信息。要查看Debian系统的路由信息,你可以使用route
命令或者ip route
命令。
route
命令route -n
-n
选项表示以数字形式显示地址,不进行DNS解析,这样可以更快地获取路由信息。
ip route
命令ip route
命令是现代Linux系统中更常用的查看和管理路由信息的工具。
ip route show
或者使用简写:
ip r
无论是使用route -n
还是ip route show
,你都会得到类似以下的输出:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
U
表示该路由可用,G
表示需要通过网关。通过这些信息,你可以了解Debian系统的网络路由配置情况。