4.3.3 route 命令
路由表管理命令
路由表主要构成:
- Destination: 目标网络ID,表示可以到达的目标网络ID,0.0.0.0/0 表示所有未知网络,又称为默认路由,优先级最低
- Genmask:目标网络对应的netmask
- Iface: 到达对应网络,应该从当前主机哪个网卡发送出来
- Gateway: 到达非直连的网络,将数据发送到临近(下一个)路由器的临近本主机的接口的IP地址,如果是直连网络,gateway是0.0.0.0
- Metric: 开销cost,值越小,路由记录的优先级最高
查看路由表:
route
route -n
范例:
[root@rocky8 ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default _gateway 0.0.0.0 UG 100 0 0 eth0
r172.31.0.0 0.