1

I am currently taking a networking course and am bombarded with information which is different from 100's of sources and want to get some things straight.

The last 3 layers of the OSI mode (Network, Data link, and physical) run on every single host in a network. Let's say in a network there is a network switch (with 4 computers attached to that network switch using Ethernet) and that network switch is finally connected to a router.

  • If a computer connected to that network switch wants to send data to the Internet (via the router), the computer will first encapsulate the data into a frame since it knows that it is attached to a switch and switches can only forward frames (correct?). So this computer will only use protocols in the Data Link layers (and not the network and physical layer right?).
  • Then the switch will forward the frame to the router (where the data link protocol's on the router will unpack the frame) and then the network protocol's on the router will route the packet using the IP address? Now since the computer that sent the frame was attached to a switch is there an IP address in the frame sent to by the computer?

1 Answer 1

1

First, remember that the OSI model is just a conceptual model. It doesn't represent any software actually in use. The TCP/IP model is closer to what computers actually use, but it too is just a model.

All hosts have all the layers in whatever model you're using. Computers generate data from applications and that data is encapsulated in lower layers until it is sent out on the wire.

If a computer connected to that network switch wants to send data to the Internet (via the router), the computer will first encapsulate the data into a frame since it knows that it is attached to a switch and switches can only forward frames (correct?). So this computer will only use protocols in the Data Link layers (and not the network and physical layer right?).

No. The computer has no idea what it's connected to. As I said, computers generate data from applications and that data is encapsulated in lower layers until it is sent on the wire (or radio if wireless). This will happen regardless of whatever device is on the other end.

Then the switch will forward the frame to the router (where the data link protocol's on the router will unpack the frame) and then the network protocols on the router will route the packet using the IP address?

This part is essentially correct.

Now since the computer that sent the frame was attached to a switch is there an IP address in the frame sent to by the computer?

Assuming TCP/IP, the frame has encapsulated the network and upper layers. So the IP address is in the IP packet which is encapsulated inside the data-link layer (Ethernet).

4
  • Thank you for your answer. Just a quick clarification: When you say: "As I said, computers generate data from applications and that data is encapsulated in lower layers until it is sent on the wire (or radio if wireless). This will happen regardless of whatever device is on the other end." Doesn't that just mean that every single layer will attach some header or trailer to the data and if the packet arrives at a switch (the switch will only look at the data link layer header) or if it arrives at a router (the router will look at the network layer header)? Nov 6, 2016 at 19:41
  • To be more precise, the switch will look at the layer 2 header and forward it according to its table. The router will remove the layer 2 header, look at the layer 3 header, make a forwarding decision based on its routing table, then attach a new layer 2 header, and then forward the frame.
    – Ron Trunk
    Nov 6, 2016 at 20:15
  • The router will only attach a new layer 2 header if the packet has to be sent to another layer 2 domain (like Ethernet for example)? Nov 6, 2016 at 22:01
  • The only case where that doesn't happen is when the packet is addressed to the router itself.
    – Ron Trunk
    Nov 6, 2016 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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