What happens to frame when it reaches a switch or router?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







2















As I understand it, when one PC sends a frame to another PC through a switch, the frame remains unchanged. The switch receives it and sends the exact same frame. But what happens if we have two PCs connected to a router and we send something between them?










share|improve this question

























  • I don't see how " one PC sends frame to other PC through the switch" and "we have two PC's connected to the same switch, and send something between them" are different scenarios.

    – Jamie Hanrahan
    Mar 1 '17 at 20:53











  • Is your question supposed to be about Ethernet? Is your second scenario supposed to involve a router?

    – sawdust
    Mar 1 '17 at 20:58













  • Sorry, of course the second part concerns router. Edited.

    – dargemir
    Mar 1 '17 at 21:02








  • 1





    @sawdust Not to pick nits - oh, who am I kidding, I AM picking nits - but the router includes a switch. Technically a pure router would have just one port per subnet. The common "home NAT routers" have one "WAN" port and several "LAN" ports - there's a switch behind the latter. Traffic between the LAN ports doesn't pass through the router part at all, so, yeah, it acts just like a switch. :)

    – Jamie Hanrahan
    Mar 1 '17 at 21:22








  • 1





    And what if they are in other nets, like here: zapodaj.net/images/72df7cf02b691.jpg

    – dargemir
    Mar 1 '17 at 21:23


















2















As I understand it, when one PC sends a frame to another PC through a switch, the frame remains unchanged. The switch receives it and sends the exact same frame. But what happens if we have two PCs connected to a router and we send something between them?










share|improve this question

























  • I don't see how " one PC sends frame to other PC through the switch" and "we have two PC's connected to the same switch, and send something between them" are different scenarios.

    – Jamie Hanrahan
    Mar 1 '17 at 20:53











  • Is your question supposed to be about Ethernet? Is your second scenario supposed to involve a router?

    – sawdust
    Mar 1 '17 at 20:58













  • Sorry, of course the second part concerns router. Edited.

    – dargemir
    Mar 1 '17 at 21:02








  • 1





    @sawdust Not to pick nits - oh, who am I kidding, I AM picking nits - but the router includes a switch. Technically a pure router would have just one port per subnet. The common "home NAT routers" have one "WAN" port and several "LAN" ports - there's a switch behind the latter. Traffic between the LAN ports doesn't pass through the router part at all, so, yeah, it acts just like a switch. :)

    – Jamie Hanrahan
    Mar 1 '17 at 21:22








  • 1





    And what if they are in other nets, like here: zapodaj.net/images/72df7cf02b691.jpg

    – dargemir
    Mar 1 '17 at 21:23














2












2








2


1






As I understand it, when one PC sends a frame to another PC through a switch, the frame remains unchanged. The switch receives it and sends the exact same frame. But what happens if we have two PCs connected to a router and we send something between them?










share|improve this question
















As I understand it, when one PC sends a frame to another PC through a switch, the frame remains unchanged. The switch receives it and sends the exact same frame. But what happens if we have two PCs connected to a router and we send something between them?







router ethernet switch frame






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 4 '17 at 19:41









Twisty Impersonator

18.8k1468101




18.8k1468101










asked Mar 1 '17 at 20:49









dargemirdargemir

113




113













  • I don't see how " one PC sends frame to other PC through the switch" and "we have two PC's connected to the same switch, and send something between them" are different scenarios.

    – Jamie Hanrahan
    Mar 1 '17 at 20:53











  • Is your question supposed to be about Ethernet? Is your second scenario supposed to involve a router?

    – sawdust
    Mar 1 '17 at 20:58













  • Sorry, of course the second part concerns router. Edited.

    – dargemir
    Mar 1 '17 at 21:02








  • 1





    @sawdust Not to pick nits - oh, who am I kidding, I AM picking nits - but the router includes a switch. Technically a pure router would have just one port per subnet. The common "home NAT routers" have one "WAN" port and several "LAN" ports - there's a switch behind the latter. Traffic between the LAN ports doesn't pass through the router part at all, so, yeah, it acts just like a switch. :)

    – Jamie Hanrahan
    Mar 1 '17 at 21:22








  • 1





    And what if they are in other nets, like here: zapodaj.net/images/72df7cf02b691.jpg

    – dargemir
    Mar 1 '17 at 21:23



















  • I don't see how " one PC sends frame to other PC through the switch" and "we have two PC's connected to the same switch, and send something between them" are different scenarios.

    – Jamie Hanrahan
    Mar 1 '17 at 20:53











  • Is your question supposed to be about Ethernet? Is your second scenario supposed to involve a router?

    – sawdust
    Mar 1 '17 at 20:58













  • Sorry, of course the second part concerns router. Edited.

    – dargemir
    Mar 1 '17 at 21:02








  • 1





    @sawdust Not to pick nits - oh, who am I kidding, I AM picking nits - but the router includes a switch. Technically a pure router would have just one port per subnet. The common "home NAT routers" have one "WAN" port and several "LAN" ports - there's a switch behind the latter. Traffic between the LAN ports doesn't pass through the router part at all, so, yeah, it acts just like a switch. :)

    – Jamie Hanrahan
    Mar 1 '17 at 21:22








  • 1





    And what if they are in other nets, like here: zapodaj.net/images/72df7cf02b691.jpg

    – dargemir
    Mar 1 '17 at 21:23

















I don't see how " one PC sends frame to other PC through the switch" and "we have two PC's connected to the same switch, and send something between them" are different scenarios.

– Jamie Hanrahan
Mar 1 '17 at 20:53





I don't see how " one PC sends frame to other PC through the switch" and "we have two PC's connected to the same switch, and send something between them" are different scenarios.

– Jamie Hanrahan
Mar 1 '17 at 20:53













Is your question supposed to be about Ethernet? Is your second scenario supposed to involve a router?

– sawdust
Mar 1 '17 at 20:58







Is your question supposed to be about Ethernet? Is your second scenario supposed to involve a router?

– sawdust
Mar 1 '17 at 20:58















Sorry, of course the second part concerns router. Edited.

– dargemir
Mar 1 '17 at 21:02







Sorry, of course the second part concerns router. Edited.

– dargemir
Mar 1 '17 at 21:02






1




1





@sawdust Not to pick nits - oh, who am I kidding, I AM picking nits - but the router includes a switch. Technically a pure router would have just one port per subnet. The common "home NAT routers" have one "WAN" port and several "LAN" ports - there's a switch behind the latter. Traffic between the LAN ports doesn't pass through the router part at all, so, yeah, it acts just like a switch. :)

– Jamie Hanrahan
Mar 1 '17 at 21:22







@sawdust Not to pick nits - oh, who am I kidding, I AM picking nits - but the router includes a switch. Technically a pure router would have just one port per subnet. The common "home NAT routers" have one "WAN" port and several "LAN" ports - there's a switch behind the latter. Traffic between the LAN ports doesn't pass through the router part at all, so, yeah, it acts just like a switch. :)

– Jamie Hanrahan
Mar 1 '17 at 21:22






1




1





And what if they are in other nets, like here: zapodaj.net/images/72df7cf02b691.jpg

– dargemir
Mar 1 '17 at 21:23





And what if they are in other nets, like here: zapodaj.net/images/72df7cf02b691.jpg

– dargemir
Mar 1 '17 at 21:23










3 Answers
3






active

oldest

votes


















1















"As I understand it, when one PC sends a frame to another PC through a switch, the frame remains unchanged."




You are correct; switches do not modify the frames they forward in any way. This is known as transparent bridging as explained in this O'Reilly article titled Basic Switch Operation:




Ethernet switches are designed so that their operations are invisible to the devices on the network, which explains why this approach to linking networks is also called transparent bridging. “Transparent” means that when you connect a switch to an Ethernet system, no changes are made in the Ethernet frames that are bridged.







"But what happens if we have two PCs connected to a router and we send something between them?"




TL;DR



Any packet forwarded by a router will be modified. Required modifications include a new destination MAC address and a new Frame Check Sequence. But that's only a small part of what happens at the router...





Unlike switches, routers decide what to do with a packet based on its OSI Layer 3 destination address. In this case that is an Internet Protocol (IP) address. Therefore what happens to the packet depends on where the packet is headed. Let's use the image you referred to as an example:



enter image description here



Here we have a router with two interfaces: e1/1/1 (which I'll refer to as E1) and e1/1/2 (which I'll refer to as E2). Notice that the router's two interfaces are in separate subnets, which must always be the case for a router:




  • E1 is connected to subnetwork 10.0.0.0/24

  • E2 is connected to subnetwork 10.0.1.0/24


Now, suppose Computer A (with IP address 10.0.0.2/24 and therefore in subnetwork 10.0.0.0/24) sends a packet to destination IP address 10.0.1.2. Once that packet arrives at the router, the following happens:




  1. Packet arrives on interface E1

  2. Router determines the destination address is 10.0.1.2

  3. Router examines its routing table to determine where the packet should go

  4. The routing table indicates interface E2 is connected to subnetwork 10.0.0.0/24

  5. The router prepares the packet for transmission on interface E2. This requires modifying the packet in several ways. For example, the new packet will have:


    • The old destination Layer 2 (MAC) address replaced with a new destination address, which will be the broadcast address FF:FF:FF:FF:FF:FF for the first such packet sent on the interface

    • A new Frame Check Sequence (FCS) calculated and added to the packet



  6. The new packet is transmitted on interface E2


Once the packet is sent to the network segment connected to router interface E2 it is received by Computer B with the IP address 10.0.1.2.



Suppose Computer A sends a packet to the destination IP address 10.0.7.44. Once the packet reaches the router, the following occurs:




  1. Packet arrives on interface E1

  2. Router determines the destination address is 10.0.7.44

  3. Router examines its routing table to determine where the packet should go


Now what happens?



Well, if as shown in the graphic, the router truly only has the two interfaces, the router drops the packet because it doesn't have a valid route to the destination network.



In the real world, however, a router is likely to have at least one interface that is configured to be the default route or route of last resort. In the routing table, this is the interface with which network 0.0.0.0/0 is associated. If the router does not have a specific route to a valid network for the packet destined to 10.0.7.44, as its action of "last resort" it will transmit the packet on the interface associated with the default route.



The default route functionality is very important. Without it the router would be required to have a routing table entry for many (though not all) IP networks on the Internet. Such a table would be very large. Compared to a router with a default route, such a router would require:




  • More memory to store the routing table

  • More CPU time to examine the table (this is done for each incoming packet!)

  • Excessive and frequent routing table updates from many other routers on the Internet in order to keep its routing table accurate. Otherwise packets might be forwarded through an interface that in-fact no longer has connectivity to the destination network.






share|improve this answer

































    1














    Think of a frame as one of those plastic capsules that travel in plastic tubes (some drive-up bank windows used to have those). A packet is an envelope inside the capsule, and the data is inside the envelope.



    A switch is a place where a bunch of different tubes meet. It will look at the source address and destination address on the capsule, and based on that, send it through the appropriate tube to get where it's going.



    Routers care about the envelope, not the capsule. When a router receives a capsule, it basically opens the capsule and then discards it. It will then look at the envelope and figure out where it needs to go. The envelope might need to go to someone's desk. In that case, it would hand the envelope off to a different delivery system (protocol). Or it might decide that the envelope needs to go back into the tube system, in which case it would place it into a new capsule and send it on its way.



    That is, of course, very simplified, but hopefully it makes the picture a little clearer.






    share|improve this answer
























    • Nice analogy. What underlying difference do you have in mind between between the function of moving a capsule to another desk and putting it back into the tube system? On a minor note, switches don't care about a frame's source address.

      – Twisty Impersonator
      Mar 4 '17 at 21:15













    • One possible analogy is a cable modem. On the internal side, it uses ethernet to route frames on your internal LAN. On the external side, it uses DOCSIS, which is still layer 2, but a different protocol. And yes, switches DO care about the source address. That's how they learn which MAC addresses are on which ports.

      – Charles Burge
      Mar 4 '17 at 21:28











    • My bad on the switch's use of the source MAC address. I wouldn't call a cable modem a router. A true router is a OSI layer 3 device with the purpose of "routing" packets between multiple layer 3 networks. But the translation of packets between different physical network architectures is not a feature of a standalone router. Due to the combination of multiple networking capabilities into a single device, some consider a cable modem to be best described as a Residential Gateway.

      – Twisty Impersonator
      Mar 4 '17 at 22:27











    • Actually a cable modem is a router in a true sense of the word. That's why it has an internal IP address and an external IP address. It routes packets between your home LAN and the cable company's network.

      – Charles Burge
      Mar 4 '17 at 22:34













    • So does a typical wireless router, but no one would call that a true router.

      – Twisty Impersonator
      Mar 4 '17 at 22:38



















    0














    A router is basically a switch with additional NAT translation to be able to distinquish between inbound and outbound traffic.



    When the internet is involved, and thus NAT is used, port forwarding rules determine what happens with a packet (frame). If its only local, the entire NAT is not used, and thus only the internal switch is used. As such the exact same happens as with a regular switch, the packet remains unchanged.






    share|improve this answer
























    • And it the PCs belongs to other nets? zapodaj.net/images/72df7cf02b691.jpg

      – dargemir
      Mar 1 '17 at 21:49











    • As stated in my answer, it becomes NAT translation, so portforwarding rules determine where the packet goes.

      – LPChip
      Mar 2 '17 at 11:16












    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',
    autoActivateHeartbeat: false,
    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%2f1184191%2fwhat-happens-to-frame-when-it-reaches-a-switch-or-router%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1















    "As I understand it, when one PC sends a frame to another PC through a switch, the frame remains unchanged."




    You are correct; switches do not modify the frames they forward in any way. This is known as transparent bridging as explained in this O'Reilly article titled Basic Switch Operation:




    Ethernet switches are designed so that their operations are invisible to the devices on the network, which explains why this approach to linking networks is also called transparent bridging. “Transparent” means that when you connect a switch to an Ethernet system, no changes are made in the Ethernet frames that are bridged.







    "But what happens if we have two PCs connected to a router and we send something between them?"




    TL;DR



    Any packet forwarded by a router will be modified. Required modifications include a new destination MAC address and a new Frame Check Sequence. But that's only a small part of what happens at the router...





    Unlike switches, routers decide what to do with a packet based on its OSI Layer 3 destination address. In this case that is an Internet Protocol (IP) address. Therefore what happens to the packet depends on where the packet is headed. Let's use the image you referred to as an example:



    enter image description here



    Here we have a router with two interfaces: e1/1/1 (which I'll refer to as E1) and e1/1/2 (which I'll refer to as E2). Notice that the router's two interfaces are in separate subnets, which must always be the case for a router:




    • E1 is connected to subnetwork 10.0.0.0/24

    • E2 is connected to subnetwork 10.0.1.0/24


    Now, suppose Computer A (with IP address 10.0.0.2/24 and therefore in subnetwork 10.0.0.0/24) sends a packet to destination IP address 10.0.1.2. Once that packet arrives at the router, the following happens:




    1. Packet arrives on interface E1

    2. Router determines the destination address is 10.0.1.2

    3. Router examines its routing table to determine where the packet should go

    4. The routing table indicates interface E2 is connected to subnetwork 10.0.0.0/24

    5. The router prepares the packet for transmission on interface E2. This requires modifying the packet in several ways. For example, the new packet will have:


      • The old destination Layer 2 (MAC) address replaced with a new destination address, which will be the broadcast address FF:FF:FF:FF:FF:FF for the first such packet sent on the interface

      • A new Frame Check Sequence (FCS) calculated and added to the packet



    6. The new packet is transmitted on interface E2


    Once the packet is sent to the network segment connected to router interface E2 it is received by Computer B with the IP address 10.0.1.2.



    Suppose Computer A sends a packet to the destination IP address 10.0.7.44. Once the packet reaches the router, the following occurs:




    1. Packet arrives on interface E1

    2. Router determines the destination address is 10.0.7.44

    3. Router examines its routing table to determine where the packet should go


    Now what happens?



    Well, if as shown in the graphic, the router truly only has the two interfaces, the router drops the packet because it doesn't have a valid route to the destination network.



    In the real world, however, a router is likely to have at least one interface that is configured to be the default route or route of last resort. In the routing table, this is the interface with which network 0.0.0.0/0 is associated. If the router does not have a specific route to a valid network for the packet destined to 10.0.7.44, as its action of "last resort" it will transmit the packet on the interface associated with the default route.



    The default route functionality is very important. Without it the router would be required to have a routing table entry for many (though not all) IP networks on the Internet. Such a table would be very large. Compared to a router with a default route, such a router would require:




    • More memory to store the routing table

    • More CPU time to examine the table (this is done for each incoming packet!)

    • Excessive and frequent routing table updates from many other routers on the Internet in order to keep its routing table accurate. Otherwise packets might be forwarded through an interface that in-fact no longer has connectivity to the destination network.






    share|improve this answer






























      1















      "As I understand it, when one PC sends a frame to another PC through a switch, the frame remains unchanged."




      You are correct; switches do not modify the frames they forward in any way. This is known as transparent bridging as explained in this O'Reilly article titled Basic Switch Operation:




      Ethernet switches are designed so that their operations are invisible to the devices on the network, which explains why this approach to linking networks is also called transparent bridging. “Transparent” means that when you connect a switch to an Ethernet system, no changes are made in the Ethernet frames that are bridged.







      "But what happens if we have two PCs connected to a router and we send something between them?"




      TL;DR



      Any packet forwarded by a router will be modified. Required modifications include a new destination MAC address and a new Frame Check Sequence. But that's only a small part of what happens at the router...





      Unlike switches, routers decide what to do with a packet based on its OSI Layer 3 destination address. In this case that is an Internet Protocol (IP) address. Therefore what happens to the packet depends on where the packet is headed. Let's use the image you referred to as an example:



      enter image description here



      Here we have a router with two interfaces: e1/1/1 (which I'll refer to as E1) and e1/1/2 (which I'll refer to as E2). Notice that the router's two interfaces are in separate subnets, which must always be the case for a router:




      • E1 is connected to subnetwork 10.0.0.0/24

      • E2 is connected to subnetwork 10.0.1.0/24


      Now, suppose Computer A (with IP address 10.0.0.2/24 and therefore in subnetwork 10.0.0.0/24) sends a packet to destination IP address 10.0.1.2. Once that packet arrives at the router, the following happens:




      1. Packet arrives on interface E1

      2. Router determines the destination address is 10.0.1.2

      3. Router examines its routing table to determine where the packet should go

      4. The routing table indicates interface E2 is connected to subnetwork 10.0.0.0/24

      5. The router prepares the packet for transmission on interface E2. This requires modifying the packet in several ways. For example, the new packet will have:


        • The old destination Layer 2 (MAC) address replaced with a new destination address, which will be the broadcast address FF:FF:FF:FF:FF:FF for the first such packet sent on the interface

        • A new Frame Check Sequence (FCS) calculated and added to the packet



      6. The new packet is transmitted on interface E2


      Once the packet is sent to the network segment connected to router interface E2 it is received by Computer B with the IP address 10.0.1.2.



      Suppose Computer A sends a packet to the destination IP address 10.0.7.44. Once the packet reaches the router, the following occurs:




      1. Packet arrives on interface E1

      2. Router determines the destination address is 10.0.7.44

      3. Router examines its routing table to determine where the packet should go


      Now what happens?



      Well, if as shown in the graphic, the router truly only has the two interfaces, the router drops the packet because it doesn't have a valid route to the destination network.



      In the real world, however, a router is likely to have at least one interface that is configured to be the default route or route of last resort. In the routing table, this is the interface with which network 0.0.0.0/0 is associated. If the router does not have a specific route to a valid network for the packet destined to 10.0.7.44, as its action of "last resort" it will transmit the packet on the interface associated with the default route.



      The default route functionality is very important. Without it the router would be required to have a routing table entry for many (though not all) IP networks on the Internet. Such a table would be very large. Compared to a router with a default route, such a router would require:




      • More memory to store the routing table

      • More CPU time to examine the table (this is done for each incoming packet!)

      • Excessive and frequent routing table updates from many other routers on the Internet in order to keep its routing table accurate. Otherwise packets might be forwarded through an interface that in-fact no longer has connectivity to the destination network.






      share|improve this answer




























        1












        1








        1








        "As I understand it, when one PC sends a frame to another PC through a switch, the frame remains unchanged."




        You are correct; switches do not modify the frames they forward in any way. This is known as transparent bridging as explained in this O'Reilly article titled Basic Switch Operation:




        Ethernet switches are designed so that their operations are invisible to the devices on the network, which explains why this approach to linking networks is also called transparent bridging. “Transparent” means that when you connect a switch to an Ethernet system, no changes are made in the Ethernet frames that are bridged.







        "But what happens if we have two PCs connected to a router and we send something between them?"




        TL;DR



        Any packet forwarded by a router will be modified. Required modifications include a new destination MAC address and a new Frame Check Sequence. But that's only a small part of what happens at the router...





        Unlike switches, routers decide what to do with a packet based on its OSI Layer 3 destination address. In this case that is an Internet Protocol (IP) address. Therefore what happens to the packet depends on where the packet is headed. Let's use the image you referred to as an example:



        enter image description here



        Here we have a router with two interfaces: e1/1/1 (which I'll refer to as E1) and e1/1/2 (which I'll refer to as E2). Notice that the router's two interfaces are in separate subnets, which must always be the case for a router:




        • E1 is connected to subnetwork 10.0.0.0/24

        • E2 is connected to subnetwork 10.0.1.0/24


        Now, suppose Computer A (with IP address 10.0.0.2/24 and therefore in subnetwork 10.0.0.0/24) sends a packet to destination IP address 10.0.1.2. Once that packet arrives at the router, the following happens:




        1. Packet arrives on interface E1

        2. Router determines the destination address is 10.0.1.2

        3. Router examines its routing table to determine where the packet should go

        4. The routing table indicates interface E2 is connected to subnetwork 10.0.0.0/24

        5. The router prepares the packet for transmission on interface E2. This requires modifying the packet in several ways. For example, the new packet will have:


          • The old destination Layer 2 (MAC) address replaced with a new destination address, which will be the broadcast address FF:FF:FF:FF:FF:FF for the first such packet sent on the interface

          • A new Frame Check Sequence (FCS) calculated and added to the packet



        6. The new packet is transmitted on interface E2


        Once the packet is sent to the network segment connected to router interface E2 it is received by Computer B with the IP address 10.0.1.2.



        Suppose Computer A sends a packet to the destination IP address 10.0.7.44. Once the packet reaches the router, the following occurs:




        1. Packet arrives on interface E1

        2. Router determines the destination address is 10.0.7.44

        3. Router examines its routing table to determine where the packet should go


        Now what happens?



        Well, if as shown in the graphic, the router truly only has the two interfaces, the router drops the packet because it doesn't have a valid route to the destination network.



        In the real world, however, a router is likely to have at least one interface that is configured to be the default route or route of last resort. In the routing table, this is the interface with which network 0.0.0.0/0 is associated. If the router does not have a specific route to a valid network for the packet destined to 10.0.7.44, as its action of "last resort" it will transmit the packet on the interface associated with the default route.



        The default route functionality is very important. Without it the router would be required to have a routing table entry for many (though not all) IP networks on the Internet. Such a table would be very large. Compared to a router with a default route, such a router would require:




        • More memory to store the routing table

        • More CPU time to examine the table (this is done for each incoming packet!)

        • Excessive and frequent routing table updates from many other routers on the Internet in order to keep its routing table accurate. Otherwise packets might be forwarded through an interface that in-fact no longer has connectivity to the destination network.






        share|improve this answer
















        "As I understand it, when one PC sends a frame to another PC through a switch, the frame remains unchanged."




        You are correct; switches do not modify the frames they forward in any way. This is known as transparent bridging as explained in this O'Reilly article titled Basic Switch Operation:




        Ethernet switches are designed so that their operations are invisible to the devices on the network, which explains why this approach to linking networks is also called transparent bridging. “Transparent” means that when you connect a switch to an Ethernet system, no changes are made in the Ethernet frames that are bridged.







        "But what happens if we have two PCs connected to a router and we send something between them?"




        TL;DR



        Any packet forwarded by a router will be modified. Required modifications include a new destination MAC address and a new Frame Check Sequence. But that's only a small part of what happens at the router...





        Unlike switches, routers decide what to do with a packet based on its OSI Layer 3 destination address. In this case that is an Internet Protocol (IP) address. Therefore what happens to the packet depends on where the packet is headed. Let's use the image you referred to as an example:



        enter image description here



        Here we have a router with two interfaces: e1/1/1 (which I'll refer to as E1) and e1/1/2 (which I'll refer to as E2). Notice that the router's two interfaces are in separate subnets, which must always be the case for a router:




        • E1 is connected to subnetwork 10.0.0.0/24

        • E2 is connected to subnetwork 10.0.1.0/24


        Now, suppose Computer A (with IP address 10.0.0.2/24 and therefore in subnetwork 10.0.0.0/24) sends a packet to destination IP address 10.0.1.2. Once that packet arrives at the router, the following happens:




        1. Packet arrives on interface E1

        2. Router determines the destination address is 10.0.1.2

        3. Router examines its routing table to determine where the packet should go

        4. The routing table indicates interface E2 is connected to subnetwork 10.0.0.0/24

        5. The router prepares the packet for transmission on interface E2. This requires modifying the packet in several ways. For example, the new packet will have:


          • The old destination Layer 2 (MAC) address replaced with a new destination address, which will be the broadcast address FF:FF:FF:FF:FF:FF for the first such packet sent on the interface

          • A new Frame Check Sequence (FCS) calculated and added to the packet



        6. The new packet is transmitted on interface E2


        Once the packet is sent to the network segment connected to router interface E2 it is received by Computer B with the IP address 10.0.1.2.



        Suppose Computer A sends a packet to the destination IP address 10.0.7.44. Once the packet reaches the router, the following occurs:




        1. Packet arrives on interface E1

        2. Router determines the destination address is 10.0.7.44

        3. Router examines its routing table to determine where the packet should go


        Now what happens?



        Well, if as shown in the graphic, the router truly only has the two interfaces, the router drops the packet because it doesn't have a valid route to the destination network.



        In the real world, however, a router is likely to have at least one interface that is configured to be the default route or route of last resort. In the routing table, this is the interface with which network 0.0.0.0/0 is associated. If the router does not have a specific route to a valid network for the packet destined to 10.0.7.44, as its action of "last resort" it will transmit the packet on the interface associated with the default route.



        The default route functionality is very important. Without it the router would be required to have a routing table entry for many (though not all) IP networks on the Internet. Such a table would be very large. Compared to a router with a default route, such a router would require:




        • More memory to store the routing table

        • More CPU time to examine the table (this is done for each incoming packet!)

        • Excessive and frequent routing table updates from many other routers on the Internet in order to keep its routing table accurate. Otherwise packets might be forwarded through an interface that in-fact no longer has connectivity to the destination network.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 4 '17 at 20:19

























        answered Mar 4 '17 at 19:40









        Twisty ImpersonatorTwisty Impersonator

        18.8k1468101




        18.8k1468101

























            1














            Think of a frame as one of those plastic capsules that travel in plastic tubes (some drive-up bank windows used to have those). A packet is an envelope inside the capsule, and the data is inside the envelope.



            A switch is a place where a bunch of different tubes meet. It will look at the source address and destination address on the capsule, and based on that, send it through the appropriate tube to get where it's going.



            Routers care about the envelope, not the capsule. When a router receives a capsule, it basically opens the capsule and then discards it. It will then look at the envelope and figure out where it needs to go. The envelope might need to go to someone's desk. In that case, it would hand the envelope off to a different delivery system (protocol). Or it might decide that the envelope needs to go back into the tube system, in which case it would place it into a new capsule and send it on its way.



            That is, of course, very simplified, but hopefully it makes the picture a little clearer.






            share|improve this answer
























            • Nice analogy. What underlying difference do you have in mind between between the function of moving a capsule to another desk and putting it back into the tube system? On a minor note, switches don't care about a frame's source address.

              – Twisty Impersonator
              Mar 4 '17 at 21:15













            • One possible analogy is a cable modem. On the internal side, it uses ethernet to route frames on your internal LAN. On the external side, it uses DOCSIS, which is still layer 2, but a different protocol. And yes, switches DO care about the source address. That's how they learn which MAC addresses are on which ports.

              – Charles Burge
              Mar 4 '17 at 21:28











            • My bad on the switch's use of the source MAC address. I wouldn't call a cable modem a router. A true router is a OSI layer 3 device with the purpose of "routing" packets between multiple layer 3 networks. But the translation of packets between different physical network architectures is not a feature of a standalone router. Due to the combination of multiple networking capabilities into a single device, some consider a cable modem to be best described as a Residential Gateway.

              – Twisty Impersonator
              Mar 4 '17 at 22:27











            • Actually a cable modem is a router in a true sense of the word. That's why it has an internal IP address and an external IP address. It routes packets between your home LAN and the cable company's network.

              – Charles Burge
              Mar 4 '17 at 22:34













            • So does a typical wireless router, but no one would call that a true router.

              – Twisty Impersonator
              Mar 4 '17 at 22:38
















            1














            Think of a frame as one of those plastic capsules that travel in plastic tubes (some drive-up bank windows used to have those). A packet is an envelope inside the capsule, and the data is inside the envelope.



            A switch is a place where a bunch of different tubes meet. It will look at the source address and destination address on the capsule, and based on that, send it through the appropriate tube to get where it's going.



            Routers care about the envelope, not the capsule. When a router receives a capsule, it basically opens the capsule and then discards it. It will then look at the envelope and figure out where it needs to go. The envelope might need to go to someone's desk. In that case, it would hand the envelope off to a different delivery system (protocol). Or it might decide that the envelope needs to go back into the tube system, in which case it would place it into a new capsule and send it on its way.



            That is, of course, very simplified, but hopefully it makes the picture a little clearer.






            share|improve this answer
























            • Nice analogy. What underlying difference do you have in mind between between the function of moving a capsule to another desk and putting it back into the tube system? On a minor note, switches don't care about a frame's source address.

              – Twisty Impersonator
              Mar 4 '17 at 21:15













            • One possible analogy is a cable modem. On the internal side, it uses ethernet to route frames on your internal LAN. On the external side, it uses DOCSIS, which is still layer 2, but a different protocol. And yes, switches DO care about the source address. That's how they learn which MAC addresses are on which ports.

              – Charles Burge
              Mar 4 '17 at 21:28











            • My bad on the switch's use of the source MAC address. I wouldn't call a cable modem a router. A true router is a OSI layer 3 device with the purpose of "routing" packets between multiple layer 3 networks. But the translation of packets between different physical network architectures is not a feature of a standalone router. Due to the combination of multiple networking capabilities into a single device, some consider a cable modem to be best described as a Residential Gateway.

              – Twisty Impersonator
              Mar 4 '17 at 22:27











            • Actually a cable modem is a router in a true sense of the word. That's why it has an internal IP address and an external IP address. It routes packets between your home LAN and the cable company's network.

              – Charles Burge
              Mar 4 '17 at 22:34













            • So does a typical wireless router, but no one would call that a true router.

              – Twisty Impersonator
              Mar 4 '17 at 22:38














            1












            1








            1







            Think of a frame as one of those plastic capsules that travel in plastic tubes (some drive-up bank windows used to have those). A packet is an envelope inside the capsule, and the data is inside the envelope.



            A switch is a place where a bunch of different tubes meet. It will look at the source address and destination address on the capsule, and based on that, send it through the appropriate tube to get where it's going.



            Routers care about the envelope, not the capsule. When a router receives a capsule, it basically opens the capsule and then discards it. It will then look at the envelope and figure out where it needs to go. The envelope might need to go to someone's desk. In that case, it would hand the envelope off to a different delivery system (protocol). Or it might decide that the envelope needs to go back into the tube system, in which case it would place it into a new capsule and send it on its way.



            That is, of course, very simplified, but hopefully it makes the picture a little clearer.






            share|improve this answer













            Think of a frame as one of those plastic capsules that travel in plastic tubes (some drive-up bank windows used to have those). A packet is an envelope inside the capsule, and the data is inside the envelope.



            A switch is a place where a bunch of different tubes meet. It will look at the source address and destination address on the capsule, and based on that, send it through the appropriate tube to get where it's going.



            Routers care about the envelope, not the capsule. When a router receives a capsule, it basically opens the capsule and then discards it. It will then look at the envelope and figure out where it needs to go. The envelope might need to go to someone's desk. In that case, it would hand the envelope off to a different delivery system (protocol). Or it might decide that the envelope needs to go back into the tube system, in which case it would place it into a new capsule and send it on its way.



            That is, of course, very simplified, but hopefully it makes the picture a little clearer.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 4 '17 at 20:30









            Charles BurgeCharles Burge

            1,6061413




            1,6061413













            • Nice analogy. What underlying difference do you have in mind between between the function of moving a capsule to another desk and putting it back into the tube system? On a minor note, switches don't care about a frame's source address.

              – Twisty Impersonator
              Mar 4 '17 at 21:15













            • One possible analogy is a cable modem. On the internal side, it uses ethernet to route frames on your internal LAN. On the external side, it uses DOCSIS, which is still layer 2, but a different protocol. And yes, switches DO care about the source address. That's how they learn which MAC addresses are on which ports.

              – Charles Burge
              Mar 4 '17 at 21:28











            • My bad on the switch's use of the source MAC address. I wouldn't call a cable modem a router. A true router is a OSI layer 3 device with the purpose of "routing" packets between multiple layer 3 networks. But the translation of packets between different physical network architectures is not a feature of a standalone router. Due to the combination of multiple networking capabilities into a single device, some consider a cable modem to be best described as a Residential Gateway.

              – Twisty Impersonator
              Mar 4 '17 at 22:27











            • Actually a cable modem is a router in a true sense of the word. That's why it has an internal IP address and an external IP address. It routes packets between your home LAN and the cable company's network.

              – Charles Burge
              Mar 4 '17 at 22:34













            • So does a typical wireless router, but no one would call that a true router.

              – Twisty Impersonator
              Mar 4 '17 at 22:38



















            • Nice analogy. What underlying difference do you have in mind between between the function of moving a capsule to another desk and putting it back into the tube system? On a minor note, switches don't care about a frame's source address.

              – Twisty Impersonator
              Mar 4 '17 at 21:15













            • One possible analogy is a cable modem. On the internal side, it uses ethernet to route frames on your internal LAN. On the external side, it uses DOCSIS, which is still layer 2, but a different protocol. And yes, switches DO care about the source address. That's how they learn which MAC addresses are on which ports.

              – Charles Burge
              Mar 4 '17 at 21:28











            • My bad on the switch's use of the source MAC address. I wouldn't call a cable modem a router. A true router is a OSI layer 3 device with the purpose of "routing" packets between multiple layer 3 networks. But the translation of packets between different physical network architectures is not a feature of a standalone router. Due to the combination of multiple networking capabilities into a single device, some consider a cable modem to be best described as a Residential Gateway.

              – Twisty Impersonator
              Mar 4 '17 at 22:27











            • Actually a cable modem is a router in a true sense of the word. That's why it has an internal IP address and an external IP address. It routes packets between your home LAN and the cable company's network.

              – Charles Burge
              Mar 4 '17 at 22:34













            • So does a typical wireless router, but no one would call that a true router.

              – Twisty Impersonator
              Mar 4 '17 at 22:38

















            Nice analogy. What underlying difference do you have in mind between between the function of moving a capsule to another desk and putting it back into the tube system? On a minor note, switches don't care about a frame's source address.

            – Twisty Impersonator
            Mar 4 '17 at 21:15







            Nice analogy. What underlying difference do you have in mind between between the function of moving a capsule to another desk and putting it back into the tube system? On a minor note, switches don't care about a frame's source address.

            – Twisty Impersonator
            Mar 4 '17 at 21:15















            One possible analogy is a cable modem. On the internal side, it uses ethernet to route frames on your internal LAN. On the external side, it uses DOCSIS, which is still layer 2, but a different protocol. And yes, switches DO care about the source address. That's how they learn which MAC addresses are on which ports.

            – Charles Burge
            Mar 4 '17 at 21:28





            One possible analogy is a cable modem. On the internal side, it uses ethernet to route frames on your internal LAN. On the external side, it uses DOCSIS, which is still layer 2, but a different protocol. And yes, switches DO care about the source address. That's how they learn which MAC addresses are on which ports.

            – Charles Burge
            Mar 4 '17 at 21:28













            My bad on the switch's use of the source MAC address. I wouldn't call a cable modem a router. A true router is a OSI layer 3 device with the purpose of "routing" packets between multiple layer 3 networks. But the translation of packets between different physical network architectures is not a feature of a standalone router. Due to the combination of multiple networking capabilities into a single device, some consider a cable modem to be best described as a Residential Gateway.

            – Twisty Impersonator
            Mar 4 '17 at 22:27





            My bad on the switch's use of the source MAC address. I wouldn't call a cable modem a router. A true router is a OSI layer 3 device with the purpose of "routing" packets between multiple layer 3 networks. But the translation of packets between different physical network architectures is not a feature of a standalone router. Due to the combination of multiple networking capabilities into a single device, some consider a cable modem to be best described as a Residential Gateway.

            – Twisty Impersonator
            Mar 4 '17 at 22:27













            Actually a cable modem is a router in a true sense of the word. That's why it has an internal IP address and an external IP address. It routes packets between your home LAN and the cable company's network.

            – Charles Burge
            Mar 4 '17 at 22:34







            Actually a cable modem is a router in a true sense of the word. That's why it has an internal IP address and an external IP address. It routes packets between your home LAN and the cable company's network.

            – Charles Burge
            Mar 4 '17 at 22:34















            So does a typical wireless router, but no one would call that a true router.

            – Twisty Impersonator
            Mar 4 '17 at 22:38





            So does a typical wireless router, but no one would call that a true router.

            – Twisty Impersonator
            Mar 4 '17 at 22:38











            0














            A router is basically a switch with additional NAT translation to be able to distinquish between inbound and outbound traffic.



            When the internet is involved, and thus NAT is used, port forwarding rules determine what happens with a packet (frame). If its only local, the entire NAT is not used, and thus only the internal switch is used. As such the exact same happens as with a regular switch, the packet remains unchanged.






            share|improve this answer
























            • And it the PCs belongs to other nets? zapodaj.net/images/72df7cf02b691.jpg

              – dargemir
              Mar 1 '17 at 21:49











            • As stated in my answer, it becomes NAT translation, so portforwarding rules determine where the packet goes.

              – LPChip
              Mar 2 '17 at 11:16
















            0














            A router is basically a switch with additional NAT translation to be able to distinquish between inbound and outbound traffic.



            When the internet is involved, and thus NAT is used, port forwarding rules determine what happens with a packet (frame). If its only local, the entire NAT is not used, and thus only the internal switch is used. As such the exact same happens as with a regular switch, the packet remains unchanged.






            share|improve this answer
























            • And it the PCs belongs to other nets? zapodaj.net/images/72df7cf02b691.jpg

              – dargemir
              Mar 1 '17 at 21:49











            • As stated in my answer, it becomes NAT translation, so portforwarding rules determine where the packet goes.

              – LPChip
              Mar 2 '17 at 11:16














            0












            0








            0







            A router is basically a switch with additional NAT translation to be able to distinquish between inbound and outbound traffic.



            When the internet is involved, and thus NAT is used, port forwarding rules determine what happens with a packet (frame). If its only local, the entire NAT is not used, and thus only the internal switch is used. As such the exact same happens as with a regular switch, the packet remains unchanged.






            share|improve this answer













            A router is basically a switch with additional NAT translation to be able to distinquish between inbound and outbound traffic.



            When the internet is involved, and thus NAT is used, port forwarding rules determine what happens with a packet (frame). If its only local, the entire NAT is not used, and thus only the internal switch is used. As such the exact same happens as with a regular switch, the packet remains unchanged.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 1 '17 at 21:40









            LPChipLPChip

            36.8k55588




            36.8k55588













            • And it the PCs belongs to other nets? zapodaj.net/images/72df7cf02b691.jpg

              – dargemir
              Mar 1 '17 at 21:49











            • As stated in my answer, it becomes NAT translation, so portforwarding rules determine where the packet goes.

              – LPChip
              Mar 2 '17 at 11:16



















            • And it the PCs belongs to other nets? zapodaj.net/images/72df7cf02b691.jpg

              – dargemir
              Mar 1 '17 at 21:49











            • As stated in my answer, it becomes NAT translation, so portforwarding rules determine where the packet goes.

              – LPChip
              Mar 2 '17 at 11:16

















            And it the PCs belongs to other nets? zapodaj.net/images/72df7cf02b691.jpg

            – dargemir
            Mar 1 '17 at 21:49





            And it the PCs belongs to other nets? zapodaj.net/images/72df7cf02b691.jpg

            – dargemir
            Mar 1 '17 at 21:49













            As stated in my answer, it becomes NAT translation, so portforwarding rules determine where the packet goes.

            – LPChip
            Mar 2 '17 at 11:16





            As stated in my answer, it becomes NAT translation, so portforwarding rules determine where the packet goes.

            – LPChip
            Mar 2 '17 at 11:16


















            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1184191%2fwhat-happens-to-frame-when-it-reaches-a-switch-or-router%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

            Probability when a professor distributes a quiz and homework assignment to a class of n students.

            Aardman Animations

            Are they similar matrix