Detailed routing table

Flags flag description:
U Up means that this route is currently in the startup state
H Host, means that this gateway is a host
G Gateway, means that this gateway is a router
R Reinstate Route, a route re-initialized using dynamic routing
D Dynamically, this route is dynamic When will there be dynamic routing information?
M Modified, this route is dynamically modified by the routing daemon or director


Every Windows system has an IP routing table , which stores the network destination address range that the local computer can reach and routing information on how to reach it. The routing table is the basis of TCP/IP communication, and any TCP/IP communication on the local computer is controlled by the routing table.

Understanding routing tables

You can run route print or netstat -r to display the routing table on the local computer, as shown in the following image:

C:\Documents and Settings\administrator>route print

=========================================================================== 
Interface List 
0x1 ........................... MS TCP Loopback interface 
0x10003 ...00 50 8d 4f 5f c5 ...... Realtek RTL8139/810x Family Fast Ethernet NIC 
=========================================================================== 
=========================================================================== 
Active Routes:

 

Network Destination

Netmask

Gateway

Interface

Metric

1

0.0.0.0

0.0.0.0

192.168.1.1

192.168.1.6

30

2

127.0.0.0

255.0.0.0

127.0.0.1

127.0.0.1

1

3

192.168.1.0

255.255.255.0

192.168.1.6

192.168.1.6

30

4

192.168.1.240

255.255.255.240

192.168.1.8

192.168.1.6

20

5

192.168.1.240

255.255.255.240

192.168.1.7

192.168.1.6

15

6

192.168.1.6

255.255.255.255

127.0.0.1

127.0.0.1

30

7

192.168.1.255

255.255.255.255

192.168.1.6

192.168.1.6

30

8

224.0.0.0

240.0.0.0

192.168.1.6

192.168.1.6

30

9

255.255.255.255

255.255.255.255

192.168.1.6

192.168.1.6

1

Default Gateway: 192.168.1.1 
=========================================================================== 
Persistent Routes: 
None
 
 

路由表中的每一个路由项具有五个属性,在此我将它们分为四个部分:

1、网络地址Network Destination)、网络掩码Netmask):网络地址和网络掩码相与的结果用于定义本地计算机可以到达的网络目的地址范围。通常情况下,网络目的地址范围包含以下四种:

  • 主机地址;某个特定主机的网络地址,网络掩码为255.255.255.255,如上表中的6、7、9;

  • 子网地址,某个特定子网的网络地址,如上表中的4、5;

  • 网络地址;某个特定网络的网络地址,如上表中的2、3、8;

  • 默认路由;所有未在路由表中指定的网络地址,如上表中的1,在后文将详细描述;

在添加路由时,Windows要求输入的网络地址和网络掩码相与后的结果必须等于网络地址,否则路由添加会失败。

2、网关Gateway,又称为下一跳服务器):在发送IP数据包时,网关定义了针对特定的网络目的地址,数据包发送到的下一跳服务器。如果是本地计算机直接连接到的网络,网关通常是本地计算机对应的网络接口,但是此时接口必须和网关一致;如果是远程网络或默认路由,网关通常是本地计算机所连接到的网络上的某个服务器或路由器。

3、接口Interface):接口定义了针对特定的网络目的地址,本地计算机用于发送数据包的网络接口。网关必须位于和接口相同的子网(默认网关除外),否则造成在使用此路由项时需调用其他路由项,从而可能会导致路由死锁。

4、跃点数Metric):跃点数用于指出路由的成本,通常情况下代表到达目标地址所需要经过的跃点数量,一个跃点代表经过一个路由器。跃点数越低,代表路由成本越低;跃点数越高,代表路由成本越高。当具有多条到达相同目的网络的路由项时,TCP/IP会选择具有更低跃点数的路由项。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325443207&siteId=291194637