优选主流主机商
任何主机均需规范使用

Linux系统路由表配置详解:一步步教你优化网络连接

Linux的路由表详细介绍

一 在Linux下执行route命令

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 [root@localhost backup] # route -n Kernel IP routing table Destination   Gateway     Genmask     Flags Metric Ref  Use Iface 0.0.0.0     192.168.0.1   0.0.0.0     UG  100  0    0 enp0s3 192.168.0.0   0.0.0.0     255.255.255.0  U   100  0    0 enp0s3 192.168.122.0  0.0.0.0     255.255.255.0  U   0   0    0 virbr0   [root@localhost backup] # route Kernel IP routing table Destination   Gateway     Genmask     Flags Metric Ref  Use Iface default     gateway     0.0.0.0     UG  100  0    0 enp0s3 192.168.0.0   0.0.0.0     255.255.255.0  U   100  0    0 enp0s3 192.168.122.0  0.0.0.0     255.255.255.0  U   0   0    0 virbr0

二 route命令详解

1、命令语法

?

1 2 3 route [-n] 选项与参数: -n:将主机名以IP方式显示

2、查询结果分析

?

1 2 3 4 5 6 7 8 Destination :其实就是Network的意思。 Gateway   :就是该接口的Gateway的IP,若为 0.0 . 0.0 ,表示不需要额外的IP。 Genmask  :就是Netmask,与Destination组合成一台主机或网络。 Flags      :共有多个标志可以来表示该网络或主机代表的意义。              U:代表该路由可用。              G:代表需要经过Gateway来帮忙传递。              H:代表该行路由为一台主机,而非一个网络。 Iface      :就是 interface (接口)的意思。

 

未经允许不得转载:搬瓦工中文网 » Linux系统路由表配置详解:一步步教你优化网络连接