开发者

How does a router use the routing table to choose the outgoing line?

开发者 https://www.devze.com 2023-02-06 09:05 出处:网络
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 n开发者_开发问答umber of the IP pack

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 n开发者_开发问答umber 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...


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号