Relation between routing table and forwarding table network layer











up vote
0
down vote

favorite












In certain routing algorithms such as the distance vector algorithm, the shortest path to the next router is determined.



The forwarding table on the other hand, tells us which router interface to forward to based on the longest - prefix match in the IP address to router interface.



Since the routing tables of each router contains the distance vectors, which tell us the shortest distance to all the other routers in the network (stable state).



Based on this i have a few questions.



1) Since the routing tables contain the shortest distance to the next hop router, why is there a need for a forwarding table to tell us which router interface to forward to ? How to reconcile the two concepts together ? or am i missing something



2) Routing algorithms need to determine the shortest route for a packet from a client to reach a server for example, does that mean that everytime a TCP connection is made to different servers, the shortest route is determined by looking at routers routing table. How exactly does that happen ? I am only aware that routers store the distance vectors of all routers in the network which is the shortest distance to all the routers in that network. How do they use that information to determine the shortest path for the packet ?



Hope my question is clear.










share|improve this question


























    up vote
    0
    down vote

    favorite












    In certain routing algorithms such as the distance vector algorithm, the shortest path to the next router is determined.



    The forwarding table on the other hand, tells us which router interface to forward to based on the longest - prefix match in the IP address to router interface.



    Since the routing tables of each router contains the distance vectors, which tell us the shortest distance to all the other routers in the network (stable state).



    Based on this i have a few questions.



    1) Since the routing tables contain the shortest distance to the next hop router, why is there a need for a forwarding table to tell us which router interface to forward to ? How to reconcile the two concepts together ? or am i missing something



    2) Routing algorithms need to determine the shortest route for a packet from a client to reach a server for example, does that mean that everytime a TCP connection is made to different servers, the shortest route is determined by looking at routers routing table. How exactly does that happen ? I am only aware that routers store the distance vectors of all routers in the network which is the shortest distance to all the routers in that network. How do they use that information to determine the shortest path for the packet ?



    Hope my question is clear.










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      In certain routing algorithms such as the distance vector algorithm, the shortest path to the next router is determined.



      The forwarding table on the other hand, tells us which router interface to forward to based on the longest - prefix match in the IP address to router interface.



      Since the routing tables of each router contains the distance vectors, which tell us the shortest distance to all the other routers in the network (stable state).



      Based on this i have a few questions.



      1) Since the routing tables contain the shortest distance to the next hop router, why is there a need for a forwarding table to tell us which router interface to forward to ? How to reconcile the two concepts together ? or am i missing something



      2) Routing algorithms need to determine the shortest route for a packet from a client to reach a server for example, does that mean that everytime a TCP connection is made to different servers, the shortest route is determined by looking at routers routing table. How exactly does that happen ? I am only aware that routers store the distance vectors of all routers in the network which is the shortest distance to all the routers in that network. How do they use that information to determine the shortest path for the packet ?



      Hope my question is clear.










      share|improve this question













      In certain routing algorithms such as the distance vector algorithm, the shortest path to the next router is determined.



      The forwarding table on the other hand, tells us which router interface to forward to based on the longest - prefix match in the IP address to router interface.



      Since the routing tables of each router contains the distance vectors, which tell us the shortest distance to all the other routers in the network (stable state).



      Based on this i have a few questions.



      1) Since the routing tables contain the shortest distance to the next hop router, why is there a need for a forwarding table to tell us which router interface to forward to ? How to reconcile the two concepts together ? or am i missing something



      2) Routing algorithms need to determine the shortest route for a packet from a client to reach a server for example, does that mean that everytime a TCP connection is made to different servers, the shortest route is determined by looking at routers routing table. How exactly does that happen ? I am only aware that routers store the distance vectors of all routers in the network which is the shortest distance to all the routers in that network. How do they use that information to determine the shortest path for the packet ?



      Hope my question is clear.







      networking router routing






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 at 9:44









      calveeen

      556




      556






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          There are two things that can be called "forwarding tables": a L2 switch's MAC→port mapping, and a L3 router's FIB. Based on the rest of your question, I'll assume you're actually asking about the latter. (If you really meant the former, see @harrymc's answer instead.)




          1) Since the routing tables contain the shortest distance to the next hop router, why is there a need for a forwarding table to tell us which router interface to forward to ? How to reconcile the two concepts together ? or am i missing something




          Routing protocols are usually described as having two databases:




          • The 'RIB' (routing information base) contains input used by the routing protocol to make decisions – e.g. it stores all candidate routes, distance vectors, link states, whatever. In BGP it would contain all route advertisements received from other BGP peers. RIB entries might not yet have direct associations between a route and its interface.


          • The 'FIB' (forwarding information base) is the result of the routing algorithm's decisions. It has only the specific routes that the algorithm has chosen, along with the resolved gateway addresses and devices. Basically it's the "routing table" that you know from Linux/BSD.



          The RIB is kept internally by the routing protocol daemons, while the FIB is exported into the operating system's routing table (or into hardware-accelerated routing/forwarding chips). In other words, what you see by running ip route on Linux is actually the FIB.



          The separation exists as an optimization, because determining the best path is not fast; it might take quite a lot of CPU and memory (and it's not as simple as always using the "shortest" path).



          However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet.




          2) Routing algorithms need to determine the shortest route for a packet from a client to reach a server for example, does that mean that everytime a TCP connection is made to different servers, the shortest route is determined by looking at routers routing table.




          No. As mentioned above, the "best" routes are precomputed whenever there's a change to the network topology. They are then loaded into the FIB so that individual connections only need to do a fast "longest prefix match" lookup.



          The Internet is a packet-switched network, which means the route lookup isn't just done when a TCP connection is made – it's also done for every single packet later on. (And yes, this means even existing TCP connections can suddenly begin taking a different path than before.) This is in contrast with circuit-switched networks.




          How exactly does that happen ? I am only aware that routers store the distance vectors of all routers in the network which is the shortest distance to all the routers in that network. How do they use that information to determine the shortest path for the packet ?




          For the mechanisms determining the shortest path in general, Dijkstra's algorithm is a good start. It's the basis of OSPF and several other protocols.



          That said, each routing protocol does it differently. BGP has its own rules, OSPF and IS-IS have their own, RIP and Babel have their own. (Some protocols are distance-vector, some are link-state, some are both at once. For example, OSPF is link-state within an area, but distance-vector between areas.) A router will even have global rules telling it to prefer OSPF routes over RIP, RIP over BGP, and so on.



          Note that not all routers even run an automatic routing protocol at all. It's entirely possible for all routes in the FIB to be entered manually by the administrator.






          share|improve this answer























          • "However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet." Can i check my understanding on this. When a IP packet reaches the default gateway router, does it know all the routers that it will already hop to ? Or does it only know the next hop router for every router it reaches ? I think it is the latter ?
            – calveeen
            Nov 22 at 15:48










          • Because there are so many servers on the internet, all the routing and stuff are precomputed already for all these servers ?
            – calveeen
            Nov 22 at 15:49










          • @calveeen: Plain IP routers only choose the immediate next hop and cannot control anything that happens beyond that. (There are exceptions, such as MPLS networks, but that's not really IP anymore.)
            – grawity
            Nov 22 at 16:06










          • Okay so the exchanging of distance vectors (routing protocols) contained in the RIB help to determine the FIB which is basically the longest prefix match. And the routes to all servers are precomputed already so the routers just have to forward to the next router based on the dst IP address of the ip packet ?
            – calveeen
            Nov 22 at 16:09












          • Thank you for the answering my question and also thank you for the way u organized your answer
            – calveeen
            Nov 22 at 16:11




















          up vote
          1
          down vote













          They definitely don't keep the same informations.



          Routing table is a Layer 3 table which states that for X.X.X.X/Y IP destination,
          go through z.z.z.z router.

          Forwarding table is a Layer 2 table which states for communicating with
          z.z.z.z router, send packets to MAC Address aa:bb:cc:dd:ee:ff.



          For example, the forwarding table might say that a packet bound to a destination
          in 192.168.1.0/24 should be sent out of physical port ethernet1/2.



          In your local network, you use the forwarding table to get the other hosts'
          MAC addresses and send them the packets. Your network device will have broadcast
          an arp whohas ip z.z.z.z packet at Layer 2 to get the relevant MAC address.



          To communicate with a host in a different subnet, you should route it through
          a router within your local network. The routing table will tell which IP this
          router has, so which router you reach is done using the forwarding mechanism.



          In other words, the routing table contains all the routes a node is willing
          to keep, and the information there is being used by the routing protocols.
          The forwarding table is used by the hardware to physically move the packets
          in and out of interfaces.
          The hardware can keep forwarding based on the forwarding contents,
          while the routing table is still being updated.






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1377524%2frelation-between-routing-table-and-forwarding-table-network-layer%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            There are two things that can be called "forwarding tables": a L2 switch's MAC→port mapping, and a L3 router's FIB. Based on the rest of your question, I'll assume you're actually asking about the latter. (If you really meant the former, see @harrymc's answer instead.)




            1) Since the routing tables contain the shortest distance to the next hop router, why is there a need for a forwarding table to tell us which router interface to forward to ? How to reconcile the two concepts together ? or am i missing something




            Routing protocols are usually described as having two databases:




            • The 'RIB' (routing information base) contains input used by the routing protocol to make decisions – e.g. it stores all candidate routes, distance vectors, link states, whatever. In BGP it would contain all route advertisements received from other BGP peers. RIB entries might not yet have direct associations between a route and its interface.


            • The 'FIB' (forwarding information base) is the result of the routing algorithm's decisions. It has only the specific routes that the algorithm has chosen, along with the resolved gateway addresses and devices. Basically it's the "routing table" that you know from Linux/BSD.



            The RIB is kept internally by the routing protocol daemons, while the FIB is exported into the operating system's routing table (or into hardware-accelerated routing/forwarding chips). In other words, what you see by running ip route on Linux is actually the FIB.



            The separation exists as an optimization, because determining the best path is not fast; it might take quite a lot of CPU and memory (and it's not as simple as always using the "shortest" path).



            However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet.




            2) Routing algorithms need to determine the shortest route for a packet from a client to reach a server for example, does that mean that everytime a TCP connection is made to different servers, the shortest route is determined by looking at routers routing table.




            No. As mentioned above, the "best" routes are precomputed whenever there's a change to the network topology. They are then loaded into the FIB so that individual connections only need to do a fast "longest prefix match" lookup.



            The Internet is a packet-switched network, which means the route lookup isn't just done when a TCP connection is made – it's also done for every single packet later on. (And yes, this means even existing TCP connections can suddenly begin taking a different path than before.) This is in contrast with circuit-switched networks.




            How exactly does that happen ? I am only aware that routers store the distance vectors of all routers in the network which is the shortest distance to all the routers in that network. How do they use that information to determine the shortest path for the packet ?




            For the mechanisms determining the shortest path in general, Dijkstra's algorithm is a good start. It's the basis of OSPF and several other protocols.



            That said, each routing protocol does it differently. BGP has its own rules, OSPF and IS-IS have their own, RIP and Babel have their own. (Some protocols are distance-vector, some are link-state, some are both at once. For example, OSPF is link-state within an area, but distance-vector between areas.) A router will even have global rules telling it to prefer OSPF routes over RIP, RIP over BGP, and so on.



            Note that not all routers even run an automatic routing protocol at all. It's entirely possible for all routes in the FIB to be entered manually by the administrator.






            share|improve this answer























            • "However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet." Can i check my understanding on this. When a IP packet reaches the default gateway router, does it know all the routers that it will already hop to ? Or does it only know the next hop router for every router it reaches ? I think it is the latter ?
              – calveeen
              Nov 22 at 15:48










            • Because there are so many servers on the internet, all the routing and stuff are precomputed already for all these servers ?
              – calveeen
              Nov 22 at 15:49










            • @calveeen: Plain IP routers only choose the immediate next hop and cannot control anything that happens beyond that. (There are exceptions, such as MPLS networks, but that's not really IP anymore.)
              – grawity
              Nov 22 at 16:06










            • Okay so the exchanging of distance vectors (routing protocols) contained in the RIB help to determine the FIB which is basically the longest prefix match. And the routes to all servers are precomputed already so the routers just have to forward to the next router based on the dst IP address of the ip packet ?
              – calveeen
              Nov 22 at 16:09












            • Thank you for the answering my question and also thank you for the way u organized your answer
              – calveeen
              Nov 22 at 16:11

















            up vote
            1
            down vote



            accepted










            There are two things that can be called "forwarding tables": a L2 switch's MAC→port mapping, and a L3 router's FIB. Based on the rest of your question, I'll assume you're actually asking about the latter. (If you really meant the former, see @harrymc's answer instead.)




            1) Since the routing tables contain the shortest distance to the next hop router, why is there a need for a forwarding table to tell us which router interface to forward to ? How to reconcile the two concepts together ? or am i missing something




            Routing protocols are usually described as having two databases:




            • The 'RIB' (routing information base) contains input used by the routing protocol to make decisions – e.g. it stores all candidate routes, distance vectors, link states, whatever. In BGP it would contain all route advertisements received from other BGP peers. RIB entries might not yet have direct associations between a route and its interface.


            • The 'FIB' (forwarding information base) is the result of the routing algorithm's decisions. It has only the specific routes that the algorithm has chosen, along with the resolved gateway addresses and devices. Basically it's the "routing table" that you know from Linux/BSD.



            The RIB is kept internally by the routing protocol daemons, while the FIB is exported into the operating system's routing table (or into hardware-accelerated routing/forwarding chips). In other words, what you see by running ip route on Linux is actually the FIB.



            The separation exists as an optimization, because determining the best path is not fast; it might take quite a lot of CPU and memory (and it's not as simple as always using the "shortest" path).



            However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet.




            2) Routing algorithms need to determine the shortest route for a packet from a client to reach a server for example, does that mean that everytime a TCP connection is made to different servers, the shortest route is determined by looking at routers routing table.




            No. As mentioned above, the "best" routes are precomputed whenever there's a change to the network topology. They are then loaded into the FIB so that individual connections only need to do a fast "longest prefix match" lookup.



            The Internet is a packet-switched network, which means the route lookup isn't just done when a TCP connection is made – it's also done for every single packet later on. (And yes, this means even existing TCP connections can suddenly begin taking a different path than before.) This is in contrast with circuit-switched networks.




            How exactly does that happen ? I am only aware that routers store the distance vectors of all routers in the network which is the shortest distance to all the routers in that network. How do they use that information to determine the shortest path for the packet ?




            For the mechanisms determining the shortest path in general, Dijkstra's algorithm is a good start. It's the basis of OSPF and several other protocols.



            That said, each routing protocol does it differently. BGP has its own rules, OSPF and IS-IS have their own, RIP and Babel have their own. (Some protocols are distance-vector, some are link-state, some are both at once. For example, OSPF is link-state within an area, but distance-vector between areas.) A router will even have global rules telling it to prefer OSPF routes over RIP, RIP over BGP, and so on.



            Note that not all routers even run an automatic routing protocol at all. It's entirely possible for all routes in the FIB to be entered manually by the administrator.






            share|improve this answer























            • "However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet." Can i check my understanding on this. When a IP packet reaches the default gateway router, does it know all the routers that it will already hop to ? Or does it only know the next hop router for every router it reaches ? I think it is the latter ?
              – calveeen
              Nov 22 at 15:48










            • Because there are so many servers on the internet, all the routing and stuff are precomputed already for all these servers ?
              – calveeen
              Nov 22 at 15:49










            • @calveeen: Plain IP routers only choose the immediate next hop and cannot control anything that happens beyond that. (There are exceptions, such as MPLS networks, but that's not really IP anymore.)
              – grawity
              Nov 22 at 16:06










            • Okay so the exchanging of distance vectors (routing protocols) contained in the RIB help to determine the FIB which is basically the longest prefix match. And the routes to all servers are precomputed already so the routers just have to forward to the next router based on the dst IP address of the ip packet ?
              – calveeen
              Nov 22 at 16:09












            • Thank you for the answering my question and also thank you for the way u organized your answer
              – calveeen
              Nov 22 at 16:11















            up vote
            1
            down vote



            accepted







            up vote
            1
            down vote



            accepted






            There are two things that can be called "forwarding tables": a L2 switch's MAC→port mapping, and a L3 router's FIB. Based on the rest of your question, I'll assume you're actually asking about the latter. (If you really meant the former, see @harrymc's answer instead.)




            1) Since the routing tables contain the shortest distance to the next hop router, why is there a need for a forwarding table to tell us which router interface to forward to ? How to reconcile the two concepts together ? or am i missing something




            Routing protocols are usually described as having two databases:




            • The 'RIB' (routing information base) contains input used by the routing protocol to make decisions – e.g. it stores all candidate routes, distance vectors, link states, whatever. In BGP it would contain all route advertisements received from other BGP peers. RIB entries might not yet have direct associations between a route and its interface.


            • The 'FIB' (forwarding information base) is the result of the routing algorithm's decisions. It has only the specific routes that the algorithm has chosen, along with the resolved gateway addresses and devices. Basically it's the "routing table" that you know from Linux/BSD.



            The RIB is kept internally by the routing protocol daemons, while the FIB is exported into the operating system's routing table (or into hardware-accelerated routing/forwarding chips). In other words, what you see by running ip route on Linux is actually the FIB.



            The separation exists as an optimization, because determining the best path is not fast; it might take quite a lot of CPU and memory (and it's not as simple as always using the "shortest" path).



            However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet.




            2) Routing algorithms need to determine the shortest route for a packet from a client to reach a server for example, does that mean that everytime a TCP connection is made to different servers, the shortest route is determined by looking at routers routing table.




            No. As mentioned above, the "best" routes are precomputed whenever there's a change to the network topology. They are then loaded into the FIB so that individual connections only need to do a fast "longest prefix match" lookup.



            The Internet is a packet-switched network, which means the route lookup isn't just done when a TCP connection is made – it's also done for every single packet later on. (And yes, this means even existing TCP connections can suddenly begin taking a different path than before.) This is in contrast with circuit-switched networks.




            How exactly does that happen ? I am only aware that routers store the distance vectors of all routers in the network which is the shortest distance to all the routers in that network. How do they use that information to determine the shortest path for the packet ?




            For the mechanisms determining the shortest path in general, Dijkstra's algorithm is a good start. It's the basis of OSPF and several other protocols.



            That said, each routing protocol does it differently. BGP has its own rules, OSPF and IS-IS have their own, RIP and Babel have their own. (Some protocols are distance-vector, some are link-state, some are both at once. For example, OSPF is link-state within an area, but distance-vector between areas.) A router will even have global rules telling it to prefer OSPF routes over RIP, RIP over BGP, and so on.



            Note that not all routers even run an automatic routing protocol at all. It's entirely possible for all routes in the FIB to be entered manually by the administrator.






            share|improve this answer














            There are two things that can be called "forwarding tables": a L2 switch's MAC→port mapping, and a L3 router's FIB. Based on the rest of your question, I'll assume you're actually asking about the latter. (If you really meant the former, see @harrymc's answer instead.)




            1) Since the routing tables contain the shortest distance to the next hop router, why is there a need for a forwarding table to tell us which router interface to forward to ? How to reconcile the two concepts together ? or am i missing something




            Routing protocols are usually described as having two databases:




            • The 'RIB' (routing information base) contains input used by the routing protocol to make decisions – e.g. it stores all candidate routes, distance vectors, link states, whatever. In BGP it would contain all route advertisements received from other BGP peers. RIB entries might not yet have direct associations between a route and its interface.


            • The 'FIB' (forwarding information base) is the result of the routing algorithm's decisions. It has only the specific routes that the algorithm has chosen, along with the resolved gateway addresses and devices. Basically it's the "routing table" that you know from Linux/BSD.



            The RIB is kept internally by the routing protocol daemons, while the FIB is exported into the operating system's routing table (or into hardware-accelerated routing/forwarding chips). In other words, what you see by running ip route on Linux is actually the FIB.



            The separation exists as an optimization, because determining the best path is not fast; it might take quite a lot of CPU and memory (and it's not as simple as always using the "shortest" path).



            However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet.




            2) Routing algorithms need to determine the shortest route for a packet from a client to reach a server for example, does that mean that everytime a TCP connection is made to different servers, the shortest route is determined by looking at routers routing table.




            No. As mentioned above, the "best" routes are precomputed whenever there's a change to the network topology. They are then loaded into the FIB so that individual connections only need to do a fast "longest prefix match" lookup.



            The Internet is a packet-switched network, which means the route lookup isn't just done when a TCP connection is made – it's also done for every single packet later on. (And yes, this means even existing TCP connections can suddenly begin taking a different path than before.) This is in contrast with circuit-switched networks.




            How exactly does that happen ? I am only aware that routers store the distance vectors of all routers in the network which is the shortest distance to all the routers in that network. How do they use that information to determine the shortest path for the packet ?




            For the mechanisms determining the shortest path in general, Dijkstra's algorithm is a good start. It's the basis of OSPF and several other protocols.



            That said, each routing protocol does it differently. BGP has its own rules, OSPF and IS-IS have their own, RIP and Babel have their own. (Some protocols are distance-vector, some are link-state, some are both at once. For example, OSPF is link-state within an area, but distance-vector between areas.) A router will even have global rules telling it to prefer OSPF routes over RIP, RIP over BGP, and so on.



            Note that not all routers even run an automatic routing protocol at all. It's entirely possible for all routes in the FIB to be entered manually by the administrator.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 22 at 13:44

























            answered Nov 22 at 13:24









            grawity

            229k35482542




            229k35482542












            • "However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet." Can i check my understanding on this. When a IP packet reaches the default gateway router, does it know all the routers that it will already hop to ? Or does it only know the next hop router for every router it reaches ? I think it is the latter ?
              – calveeen
              Nov 22 at 15:48










            • Because there are so many servers on the internet, all the routing and stuff are precomputed already for all these servers ?
              – calveeen
              Nov 22 at 15:49










            • @calveeen: Plain IP routers only choose the immediate next hop and cannot control anything that happens beyond that. (There are exceptions, such as MPLS networks, but that's not really IP anymore.)
              – grawity
              Nov 22 at 16:06










            • Okay so the exchanging of distance vectors (routing protocols) contained in the RIB help to determine the FIB which is basically the longest prefix match. And the routes to all servers are precomputed already so the routers just have to forward to the next router based on the dst IP address of the ip packet ?
              – calveeen
              Nov 22 at 16:09












            • Thank you for the answering my question and also thank you for the way u organized your answer
              – calveeen
              Nov 22 at 16:11




















            • "However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet." Can i check my understanding on this. When a IP packet reaches the default gateway router, does it know all the routers that it will already hop to ? Or does it only know the next hop router for every router it reaches ? I think it is the latter ?
              – calveeen
              Nov 22 at 15:48










            • Because there are so many servers on the internet, all the routing and stuff are precomputed already for all these servers ?
              – calveeen
              Nov 22 at 15:49










            • @calveeen: Plain IP routers only choose the immediate next hop and cannot control anything that happens beyond that. (There are exceptions, such as MPLS networks, but that's not really IP anymore.)
              – grawity
              Nov 22 at 16:06










            • Okay so the exchanging of distance vectors (routing protocols) contained in the RIB help to determine the FIB which is basically the longest prefix match. And the routes to all servers are precomputed already so the routers just have to forward to the next router based on the dst IP address of the ip packet ?
              – calveeen
              Nov 22 at 16:09












            • Thank you for the answering my question and also thank you for the way u organized your answer
              – calveeen
              Nov 22 at 16:11


















            "However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet." Can i check my understanding on this. When a IP packet reaches the default gateway router, does it know all the routers that it will already hop to ? Or does it only know the next hop router for every router it reaches ? I think it is the latter ?
            – calveeen
            Nov 22 at 15:48




            "However, instead of trying to calculate the shortest route for on every packet, it only needs to be done when the RIB contents actually change – so the routes are precomputed and put into the FIB, which only needs to do the single final step of looking up the longest matching prefix for each packet." Can i check my understanding on this. When a IP packet reaches the default gateway router, does it know all the routers that it will already hop to ? Or does it only know the next hop router for every router it reaches ? I think it is the latter ?
            – calveeen
            Nov 22 at 15:48












            Because there are so many servers on the internet, all the routing and stuff are precomputed already for all these servers ?
            – calveeen
            Nov 22 at 15:49




            Because there are so many servers on the internet, all the routing and stuff are precomputed already for all these servers ?
            – calveeen
            Nov 22 at 15:49












            @calveeen: Plain IP routers only choose the immediate next hop and cannot control anything that happens beyond that. (There are exceptions, such as MPLS networks, but that's not really IP anymore.)
            – grawity
            Nov 22 at 16:06




            @calveeen: Plain IP routers only choose the immediate next hop and cannot control anything that happens beyond that. (There are exceptions, such as MPLS networks, but that's not really IP anymore.)
            – grawity
            Nov 22 at 16:06












            Okay so the exchanging of distance vectors (routing protocols) contained in the RIB help to determine the FIB which is basically the longest prefix match. And the routes to all servers are precomputed already so the routers just have to forward to the next router based on the dst IP address of the ip packet ?
            – calveeen
            Nov 22 at 16:09






            Okay so the exchanging of distance vectors (routing protocols) contained in the RIB help to determine the FIB which is basically the longest prefix match. And the routes to all servers are precomputed already so the routers just have to forward to the next router based on the dst IP address of the ip packet ?
            – calveeen
            Nov 22 at 16:09














            Thank you for the answering my question and also thank you for the way u organized your answer
            – calveeen
            Nov 22 at 16:11






            Thank you for the answering my question and also thank you for the way u organized your answer
            – calveeen
            Nov 22 at 16:11














            up vote
            1
            down vote













            They definitely don't keep the same informations.



            Routing table is a Layer 3 table which states that for X.X.X.X/Y IP destination,
            go through z.z.z.z router.

            Forwarding table is a Layer 2 table which states for communicating with
            z.z.z.z router, send packets to MAC Address aa:bb:cc:dd:ee:ff.



            For example, the forwarding table might say that a packet bound to a destination
            in 192.168.1.0/24 should be sent out of physical port ethernet1/2.



            In your local network, you use the forwarding table to get the other hosts'
            MAC addresses and send them the packets. Your network device will have broadcast
            an arp whohas ip z.z.z.z packet at Layer 2 to get the relevant MAC address.



            To communicate with a host in a different subnet, you should route it through
            a router within your local network. The routing table will tell which IP this
            router has, so which router you reach is done using the forwarding mechanism.



            In other words, the routing table contains all the routes a node is willing
            to keep, and the information there is being used by the routing protocols.
            The forwarding table is used by the hardware to physically move the packets
            in and out of interfaces.
            The hardware can keep forwarding based on the forwarding contents,
            while the routing table is still being updated.






            share|improve this answer

























              up vote
              1
              down vote













              They definitely don't keep the same informations.



              Routing table is a Layer 3 table which states that for X.X.X.X/Y IP destination,
              go through z.z.z.z router.

              Forwarding table is a Layer 2 table which states for communicating with
              z.z.z.z router, send packets to MAC Address aa:bb:cc:dd:ee:ff.



              For example, the forwarding table might say that a packet bound to a destination
              in 192.168.1.0/24 should be sent out of physical port ethernet1/2.



              In your local network, you use the forwarding table to get the other hosts'
              MAC addresses and send them the packets. Your network device will have broadcast
              an arp whohas ip z.z.z.z packet at Layer 2 to get the relevant MAC address.



              To communicate with a host in a different subnet, you should route it through
              a router within your local network. The routing table will tell which IP this
              router has, so which router you reach is done using the forwarding mechanism.



              In other words, the routing table contains all the routes a node is willing
              to keep, and the information there is being used by the routing protocols.
              The forwarding table is used by the hardware to physically move the packets
              in and out of interfaces.
              The hardware can keep forwarding based on the forwarding contents,
              while the routing table is still being updated.






              share|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote









                They definitely don't keep the same informations.



                Routing table is a Layer 3 table which states that for X.X.X.X/Y IP destination,
                go through z.z.z.z router.

                Forwarding table is a Layer 2 table which states for communicating with
                z.z.z.z router, send packets to MAC Address aa:bb:cc:dd:ee:ff.



                For example, the forwarding table might say that a packet bound to a destination
                in 192.168.1.0/24 should be sent out of physical port ethernet1/2.



                In your local network, you use the forwarding table to get the other hosts'
                MAC addresses and send them the packets. Your network device will have broadcast
                an arp whohas ip z.z.z.z packet at Layer 2 to get the relevant MAC address.



                To communicate with a host in a different subnet, you should route it through
                a router within your local network. The routing table will tell which IP this
                router has, so which router you reach is done using the forwarding mechanism.



                In other words, the routing table contains all the routes a node is willing
                to keep, and the information there is being used by the routing protocols.
                The forwarding table is used by the hardware to physically move the packets
                in and out of interfaces.
                The hardware can keep forwarding based on the forwarding contents,
                while the routing table is still being updated.






                share|improve this answer












                They definitely don't keep the same informations.



                Routing table is a Layer 3 table which states that for X.X.X.X/Y IP destination,
                go through z.z.z.z router.

                Forwarding table is a Layer 2 table which states for communicating with
                z.z.z.z router, send packets to MAC Address aa:bb:cc:dd:ee:ff.



                For example, the forwarding table might say that a packet bound to a destination
                in 192.168.1.0/24 should be sent out of physical port ethernet1/2.



                In your local network, you use the forwarding table to get the other hosts'
                MAC addresses and send them the packets. Your network device will have broadcast
                an arp whohas ip z.z.z.z packet at Layer 2 to get the relevant MAC address.



                To communicate with a host in a different subnet, you should route it through
                a router within your local network. The routing table will tell which IP this
                router has, so which router you reach is done using the forwarding mechanism.



                In other words, the routing table contains all the routes a node is willing
                to keep, and the information there is being used by the routing protocols.
                The forwarding table is used by the hardware to physically move the packets
                in and out of interfaces.
                The hardware can keep forwarding based on the forwarding contents,
                while the routing table is still being updated.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 22 at 10:31









                harrymc

                249k10257550




                249k10257550






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1377524%2frelation-between-routing-table-and-forwarding-table-network-layer%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    AnyDesk - Fatal Program Failure

                    How to calibrate 16:9 built-in touch-screen to a 4:3 resolution?

                    QoS: MAC-Priority for clients behind a repeater