Menu

US Region

Grandmetric LLC
Lewes DE 19958
16192 Coastal Hwy USA
EIN: 98-1615498
+1 302 691 94 10
info@grandmetric.com

EMEA Region

GRANDMETRIC Sp. z o.o.
ul. Metalowa 5, 60-118 Poznań, Poland
NIP 7792433527
+48 61 271 04 43
info@grandmetric.com

UK

Grandmetric LTD
Office 584b
182-184 High Street North
London
E6 2JA
+44 20 3321 5276
info@grandmetric.com

  • en
  • pl
  • How does routing table work?

    How does routing table work?

    Date: 20.01.2018

    Author:


    In our last “explained” post How does router work you got familiarized with the way router works. Just to sum up:

    • Routers have interfaces which connect with other network devices
    • When a packet comes at an interface, router needs to find the right interface to send out the packet
    • The destination IP field of packet is checked against information stored in the router
    • If there is a match, the packet is sent out via the proper interface
    • this process is repeated along the way on each router

    Routing table

    In this post we are going to focus on the following process: “destination IP field of packet is checked against information stored in router”. The place where routing information is stored is called a routing table.  Routing table contains routing entries, that is list of destinations (often called: list of network prefixes or routes).

    How does routing table works

     

    When ROUTE LOOKUP is started:

    1. Having the destination IP of packet, routers always choose best matching ROUTING ENTRY. That means LONGEST PREFIX MATCH. This means that in our case entry: 192.168.1.20/32 is more accurate that 192.168.1.0/24 in the search for 192.168.1.20.
    2. Why this one is more accurate? Because 192.168.1.20/32 entry matches exactly 32 bits of our destination IP whereas 192.168.1.0/24 matches only 24 bits of our address. If you need to understand IP addressing, see our post about IP addressing, subnets and planning.

     

    longest prefix match

    Last but not least: how do routers learn the correct destinations ?

    There are two options :

    • We can tell the router explicitly how to route to destination: for example : if want to go to C, go via Router 2. This is so called STATIC ROUTING where the destinations are written to router’s configuration statically (by hand of network admin). On picture below, orange entries need to be provided to router by hand.

    static routing

     

    Now,  imagine that you need to configure all internet destinations, over 600 000 routes! Would we need to provide over 600K entries by hand? No way. There is smarter idea and is called:

    • DYNAMIC ROUTING. With dynamic routing we can configure the routers to learn the IP destinations from other routers which participate also in the same routing process.

    Example: Router 3 has Laptop C connected to it, so it advertises the C network address to it’s neighboring routers. Neighboring router Router 2 receives an advertisement and injects C prefix into its routing table and in turn sends the C network information to its respective neighbors (Router 1). In this way without human intervention whole network is able to learn the destinations and create routing topology.

    dynamic routing idea

    To get to know more about where to use static and where dynamic routing, read this post.

    To learn how to configure static routing read this design & config section.

    To learn about dynamic routing, read for example EIGRP section

    To see other posts on network and wireless fundamentals see our explained section.

    To subscribe to our mailing list for our online platform where you can learn all this visit GrandmetricWatch. We will let you know when it will be live.

    Author

    Marcin Bialy

    Marcin Biały is Network and Security Architect with over 14 years of experience, with Service Provider and Enterprise networking background. He used to work for large service providers, global vendors and integration services companies as Network Architect, Leading Architect and Techincal Solution Manager positions. He designed, implemented and supported dozens large scale projects and infrastructure migrations, solved hundreds of tickets and spent hours with CLI and GUI of many flavors. Marcin is also holding industry recognizable certificates such as CCNP, CCNA, CCSI #35269, FCNSP #7207, FCNSA and more.

    3 Comments
    Mark j Dunn
    20 September 2018 at 17:32

    Thanks for the posting. I have ran into some problems so I need to learn all about networking.

     
    VAKKU
    18 May 2019 at 17:42

    Nice and clear post. This helped me understand the difference better.
    Correct me if I’m wrong, but isn’t 20 in binary: 00010100. Host Space indicates 192.168.1.10 instead of 192.168.1.20

     
    Marcin Bialy
    29 May 2019 at 21:54

    Thanks, and You are right! Gratulations for your perceptiveness 🙂 00001010 is indeed 10 decimal

     

    Leave a Reply

    Your email address will not be published. Required fields are marked *


    Grandmetric