7

I was a little confused between packet and frame. The confusion was based on, if a switch is a layer 2 device, how does it reads a packet from a layer 3 device, and where is the 'frame' thing which is understandable to a switch (or layer 2 device)?

From all the blogs and articles I read, I came to conclusion that when a host send out a packet to a switch, it only reads it up to the data link layer, and the process of putting that packet from ingress to egress port is where the frame terminology is used.

I am sorry if I haven't communicated my question thoroughly, but this is kind of messed up for me.

  • The layer 3 device puts all of its packets into layer 2 frames before it sends them. – user253751 Feb 13 '17 at 4:00
12

You need to understand the concept of layers.

An application will send data to the Transport Layer. The Transport Layer protocol will encapsulate the data inside headers for the Transport Layer protocol, and pass those to the Network Layer.

The Network Layer will encapsulate the datagrams it receives inside Network Layer headers, and those are called packets. The packets will be passed to the Data-Link Layer.

The Data-Link Layer will encapsulate the packets inside Data-Link Layer headers, and those are called frames.

Switches only look at the frames, and not at the packets. Routers strip off and discard the frame headers, and they only look at the packets.


For example:

An application on Host A sends data to an application on Host B, via TCP. The application on Host A will send the data to TCP, and TCP segments the data into TCP segments, each of which have a TCP header that includes the source and destination TCP addresses (ports).

TCP passes the segments to IP. IP will add the IP headers, creating IP packets, each of which contain the source and destination IP addresses.

IP passes the packets to ethernet. Ethernet will add the ethernet headers, creating ethernet frames, each of which will have the source and destination ethernet addresses (MAC addresses).

Ethernet will send the frames on the wire to an ethernet switch. The switch will inspect the frame headers, and it will switch the frames to the interface where it last saw the destination MAC address. If it doesn't have a destination interface, it will flood the frames to all interfaces except the one where it received the frame.

The switch doesn't know or care what Network Layer protocol is used because it knows nothing about Network Layer protocols.

When the destination host receives the frame, it reverses the process used to encapsulate the data, and the data end up in the destination application.

| improve this answer | |
  • This totally makes sense to me. Thanks for spending time over it. – Taha Feb 12 '17 at 19:22
  • 1
    Would it be correct to assume if the data is unencrypted, then in theory a rogue switch could be programmed to violate layer encapsulation, inspect packet contents and route accordingly? I.e. preferred content prioritization through an ISP. – Darren Ringer Feb 12 '17 at 23:00
  • 2
    @DarrenRinger That's called Deep Packet Inspection; and tools for doing so are readily available commercially for both benign and malign usages. – Dan Is Fiddling By Firelight Feb 12 '17 at 23:10
  • 1
    @DarrenRinger adding on Dan's answer - the switch is a device that can do a lot of things, including many actions based on deeper protocols. The point is that switching - the main task of switch - is (can be) done irrelevant of other layers and thus the switch can be swapped, reconfigured regardless of other layers. – Džuris Feb 12 '17 at 23:31
  • @DarrenRinger maybe check out the possibilites of a small business switch. For example, it can prioritize telephony over other uses. – Džuris Feb 12 '17 at 23:35
0

As Ron pointed out the switch encapsulates the data from the router. You can use this for your reference:

information generated at the application layer (for instance this web browser) is called data.

the transport layer encapsulates it and calls segment

At network layer it is a called a packet

A frame at the data link layer

and at the physical layer they are just bits transmitted through various mechanisms.

| improve this answer | |
-1

If it's a layer3 switch with IP routing enabled, it's effectively a router. Regarding a switch, it processes frames. That's it.

| improve this answer | |
  • Any feedback as to how I can improve this answer would be appreciated. Thanks in advance. – Ronnie Royston Sep 27 '17 at 3:25

Your Answer

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

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