简体   繁体   English

了解Windows路由表

[英]understanding windows routing tables

This is my current routing table (I rearranged it and grouped it by interface): 这是我当前的路由表(我重新排列了它并按接口分组):

     Destination    Network mask          Gateway    Interface        Metric
          0.0.0.0          0.0.0.0    192.168.178.1    192.168.178.28     50

    192.168.178.0    255.255.255.0       On-link    192.168.178.28    306
   192.168.178.28  255.255.255.255       On-link    192.168.178.28    306
  192.168.178.255  255.255.255.255       On-link    192.168.178.28    306
        224.0.0.0        240.0.0.0       On-link    192.168.178.28    306
  255.255.255.255  255.255.255.255       On-link    192.168.178.28    306

        127.0.0.0        255.0.0.0       On-link         127.0.0.1    331 
        127.0.0.1  255.255.255.255       On-link         127.0.0.1    331 
  127.255.255.255  255.255.255.255       On-link         127.0.0.1    331 
        224.0.0.0        240.0.0.0       On-link         127.0.0.1    331 
  255.255.255.255  255.255.255.255       On-link         127.0.0.1    331 

     192.168.56.0    255.255.255.0      On-link      192.168.56.1    281 
     192.168.56.1  255.255.255.255      On-link      192.168.56.1    281 
   192.168.56.255  255.255.255.255      On-link      192.168.56.1    281 
  255.255.255.255  255.255.255.255      On-link      192.168.56.1    281 
        224.0.0.0        240.0.0.0      On-link      192.168.56.1    281 

    192.168.137.0    255.255.255.0      On-link     192.168.137.1    271 
    192.168.137.1  255.255.255.255      On-link     192.168.137.1    271 
  192.168.137.255  255.255.255.255      On-link     192.168.137.1    271 
        224.0.0.0        240.0.0.0      On-link     192.168.137.1    271 
  255.255.255.255  255.255.255.255      On-link     192.168.137.1    271 

a) The first line is the default route that should be taken if no other route matches, correct?. a)第一行是没有其他路由匹配时应采取的默认路由,是否正确? In that case, the packet should be sent over the interface 192.168.178.28 to my default gateway. 在这种情况下,数据包应通过接口192.168.178.28发送到我的默认网关。

Is it correct that from the routing table I can tell that only the NIC with 192.168.178.28 has access to the internet? 从路由表中我可以看出只有192.168.178.28的网卡才能访问互联网吗? If the other NICs had, there would have to be an entry for the default gateway for theses NICs as well, right? 如果有其他网卡,那么这些网卡的默认网关也必须有一个条目,对吧?

b) The line b)线

192.168.178.0    255.255.255.0       On-link    192.168.178.28    306

means that any packet addressed to a host in the 192.168.178 network should leave via the 192.168.178.28 interface (my wireless NIC), right? 意味着发往192.168.178网络中主机的任何数据包应通过192.168.178.28接口(我的无线网卡)离开,对吧?

c) But what does this entry mean? c)但是这个条目意味着什么?

   192.168.178.28  255.255.255.255       On-link    192.168.178.28    306

Packets addressed to my computer should be sent via my wireless NIC? 发往我电脑的数据包应该通过我的无线网卡发送? I don't really understand this entry. 我真的不明白这个条目。 Where would the packet be coming from? 数据包将来自哪里?

d) And this entry d)这个条目

  192.168.178.255  255.255.255.255       On-link    192.168.178.28    306

is a boradcast, isn't it? 是一个boradcast,不是吗? So when an application on my pc sends a packet to this address, it is a broadcast to any host inside the 192.168.17 8 network? 因此,当我的电脑上的应用程序向此地址发送数据包时,它是对192.168.17 8网络内任何主机的广播?

e) And then the next two entries: e)接下来的两个条目:

 224.0.0.0        240.0.0.0      On-link    192.168.178.28    306
 255.255.255.255  255.255.255.255    On-link    192.168.178.28    306
  • 224.0.0.0 is a multicast, right? 224.0.0.0是多播,对吗?
  • And 255.255.255.255 is also a broadcast to any host inside my LAN? 255.255.255.255也是我局域网内任何主机的广播? What is the differnce to 192.168.178.255 ? 192.168.178.255什么不同?
  • And why do these two entries exist for all of my NICs? 为什么我的所有NIC都存在这两个条目?

f) and one general question: I always thought that only routers have routing tables, but it must be the case that any system than has the IP protocol implemented has a routing table, so every tablet, smartphone and PC, right? f)和一个普遍的问题:我一直认为只有路由器有路由表,但必须是这样的情况,任何系统实现的IP协议都有路由表,所以每台平板电脑,智能手机和PC,对吗?

g) And a last one: g)最后一个:

192.168.178.28 and 192.168.56.1 are on different subnets (according to the subnet mask). 192.168.178.28192.168.56.1位于不同的子网上(根据子网掩码)。 So when I want to send a packet from one to the other, the packet has to go through the router, even though both NICs are on my machine, correct? 因此,当我想从一个数据包发送数据包到另一个数据包时,数据包必须通过路由器,即使两个网卡都在我的机器上,对吗?

Thanks for help and explanations! 感谢您的帮助和解释!

In general, the routing table is organized by priority (so the order you show does not make too much sense). 通常,路由表按优先级进行组织(因此您显示的顺序没有太多意义)。 Windows shows the table upside down: first entry is the last rule (ie if all others fail, use this one). Windows将表格颠倒显示:第一个条目是最后一条规则(即如果所有其他条目都失败,请使用此规则)。

For every IP destination, the whole table is processed in order and a match is sought. 对于每个IP目的地,按顺序处理整个表并寻找匹配。 If several rules match, the smallest metric gets used. 如果多个规则匹配,则使用最小的度量标准。

a) Yes, the first line is the default route, if no other rule matches this one gets used. a)是的,第一行是默认路由,如果没有其他规则匹配则使用该路由。

It´s not strictly true that this interface has Internet access though: it´s the only interface that (hopefully) knows how to handle data to other networks not mentioned in other rules. 但是,这个接口可以访问互联网并不严格:它是(希望)知道如何处理其他规则中未提及的其他网络的唯一接口。 If it points to a router for example, then Internet access is there... 如果它指向路由器,例如,那么互联网访问...

b) yes, it´sa network entry b)是的,这是一个网络入口

c) it´sa host entry: if an application is bound to 192.168.178.28 and would send data to this address. c)它是一个主机条目:如果一个应用程序绑定到192.168.178.28并将数据发送到该地址。 it would use the same interface (in general, routing tables allow host entries to permit special rules for specific hosts) 它将使用相同的接口(通常,路由表允许主机条目允许特定主机的特殊规则)

d) yes, it´s the local network broadcast for a specific nw d)是的,它是针对特定nw的本地网络广播

e) 224.... is multicast, yes. e)224 ....是多播,是的。 255.255.255.255 is (in theory) a broadcast to the whole world. (理论上)255.255.255.255是对全世界的广播。 Luckily it only gets transmitted to the local interface though :-) If you would do a ping 255.255.255.255 this rule would "catch". 幸运的是,它只会被传输到本地接口:-)如果您要执行ping 255.255.255.255此规则将“捕获”。 A ping to 192.168.178.255 would use the other rule. ping到192.168.178.255将使用另一个规则。

All interfaces must have full route info, so all rules are created by default for each nw interface. 所有接口都必须具有完整的路由信息​​,因此默认情况下会为每个nw接口创建所有规则。

f) Every device with an IP interface will have a routing table. f)每个具有IP接口的设备都有一个路由表。 The ones in routers can be much more complex, hosts usually have tables automatically created by the OS. 路由器中的那些可以复杂得多,主机通常具有由OS自动创建的表。

g) No, the routing table tells the IP stack to use the correct interface as the outgoing one, no need to send to the router. g)不,路由表告诉IP堆栈使用正确的接口作为传出接口,不需要发送到路由器。 So if an application in your PC wants to send data to 192.168.56.x, it will send it through the 192.168.56.1 interface (which in your case appears to be a virtual NW card) 因此,如果您的PC中应用程序想要将数据发送到192.168.56.x,它将通过192.168.56.1接口(在您的情况下看起来像是虚拟NW卡)发送它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM