4

I want to understand a "hot potato" principle. Given a router with 5 interfaces. The first interface gets a packet and has to decide to which interface this packet should be forwarded. I think the following processes take place in the router:

1) Packet arrives

2) Network prefix is extracted

Lookup in routing table (BGP? or another table?)

3) Find all matching data records depending on the network prefix (one of the interfaces should be in the path to getaway)

4) Select the one with the smallest IGP path (path to getaway within the same AS).

Is my algorithm correct?

  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer. – Ron Maupin Apr 1 '18 at 23:05
  • I cannot mark your the answer as accepted solution. I has written my question from another account (guest?) and I cannot remember my credentials – Igor Apr 5 '18 at 16:25
5

Is my algorithm correct?

Not exactly. Routing protocols do not route. A router can route without even using a routing protocol. Routing protocols simply exchange routes with other routers. The router will determine which routes populate the routing table from various sources, including routing protocols, based on things like reliability of the prefix source, e.g. AD, etc., but the router will route packets based on what is already in the routing table.

Also, the router only has the destination address, not the mask of the network where the destination is, so it doesn't extract a network prefix from the destination address.

The router will strip off the layer-2 frame, examine the layer-3 destination address on the packet, and perform a lookup in its routing table, looking for the longest prefix that matches the destination address. If it doesn't find a match, it drops the packet. If it finds a match it will have the outgoing interface, and it will build a new frame for the next interface and forward the new frame out the interface.


Edit:

Based on your comment, you seem to be confusing how the routing table is populated with how it is used by the router to route packets.

A router will look at all the route sources (directly connected networks, static routes, and routing protocols) to determine candidates for the routing table. Each routing protocols maintains its own tables of routes received from other routers. Candidate routes from the routing protocols are the routes in the routing protocol's tables with the best metric to a destination network.

If a candidate has no opponents in the other sources, it is installed in the routing table.

If there are multiple candidates using the same source, e.g. routing protocol, it compares the metrics for the candidates, and it selects the one with the lowest metric to install in the routing table.

If there are multiple candidates from multiple sources, it uses something like Cisco's AD (Administrative distance), which is the reliability of the source, to select the candidate to install in the routing table because metrics from different routing protocols cannot be compared.

| improve this answer | |
  • And what about hot potato principle? How the interface with the shortest path to getaway is selected? – Igor Mar 26 '18 at 23:38
  • That has to do with how routes are selected for the routing table, not how the router actually routes packets. Those are two very different things. – Ron Maupin Mar 26 '18 at 23:40
  • @Igor, I updated the answer to cover how the routing table is populated. – Ron Maupin Mar 26 '18 at 23:46
0

Your algorithm is roughly implemented in BGP, which by default performs “hot potato” routing. All other things being equal, the route with the lowest IGP metric will be chosen.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.