Switch – Does a Switch Understand Packets and Frame Terminology?

layer2layer3osiswitchswitching

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.

Best Answer

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.