路由器如何利用路由表来选择出局线路?
路由器如何知道哪条线路是发送数据包的最佳线路。我的意思是,路由表通常不包含 IP 数据包的目标网络号条目。它只知道与其相邻或附近的目的地。它不知道该地址是否存在。假设我向 LAN 代理发出 stackoverflow.com 请求。接下来它将请求发送到路由器。数据包如何使用最佳路径一路传输到美国的服务器,因为该路由器只知道附近的地址? 先感谢您...
How does a router know which is the best line on which to send packets. I mean, the routing table most often does not contain the entry for the destination network number of the IP packet. It only knows the destinations adjacent to it or nearby. It does not know if the address exists or not. Say I make a request for stackoverflow.com to my LAN proxy. Next it sends the request to a router. How is it that the packet is transported all the way to a server in the US using an optimal path seeing that that router knows only nearby addresses?
Thank you in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在互联网边缘,每个路由器都有一个或多个默认路由。默认路由用于路由器没有特定路由的所有目标地址,并且指向“内部” - 即。它被分配给路由器的上游链路。
因此,每个数据包将倾向于向上游流动,流向网络的核心。当您越来越接近网络核心时,路由器往往拥有越来越大的路由表 - 它们“了解”更多的网络。核心路由器本身没有默认路由 - 如果它们不知道如何到达目的地,它们只会丢弃数据包。此级别的路由器使用外部路由协议 BGP 与其他核心路由器交换路由。如果您的数据包到达了这么远,它将再次开始向下游流动,直到到达目的地。
Towards the edges of the Internet, each router has one or more default routes. The default route is used for all destination addresses for which the router doesn't have a specific route, and points "inward" - ie. it is assigned to the router's upstream link.
Each packet will therefore tend to flow upstream, towards the core of the network. As you get closer towards the network core, the routers tend to have larger and larger routing tables - they "know about" more networks. The core routers themselves do not have default routes - if they don't know how to get to the destination, they just drop the packet. The routers at this level use an exterior routing protocol, BGP, to exchange routes with other core routers. If your packet makes it this far, it will then start flowing downstream again, until it reaches its destination.
路由器有每个接口的 IP 地址/网络掩码对列表。任何发往该网络的内容都将直接在该网络上发送。
任何较远的地方都将列在“下一跳”路由器下。您的路由器将使用适当的本地接口将数据包转发到下一跳路由器。
如果路由器没有给定目的地的地图,它将被发送到默认的“下一跳”。这是本地计算机或家庭路由器/防火墙组合的默认设置。
A router has a list of IP address/netmask pairs for each interface. Anything that is destined for that network will be sent directly on that network.
Anything farther away will be listed under a "next-hop" router. Your router will forward the packet to the next-hop router, using the appropriate local interface.
If the router doesn't have a map for the given destination, it will instead be sent to the default "next-hop". This is the default for your local computer or for a home router/firewall combination.