Got it

Ethernet switching - The working mechanism of a layer 3 switch

Latest reply: Nov 24, 2021 07:13:11 459 16 13 0 1

Hi,

In the current live network environment, we can always see that it is the core switch that processing the data forwarding. You might be curious about that, isn't the switch forwarding Layer 2 data packets? Why are switches used at the core layer to forward data packets? Can the switch also handle IP packets? In this chapter, we will give you a detailed introduction to the working mechanism of the three-layer exchange.

As mentioned above, switches can be divided into layer 2 switches and layer 3 switches, and Layer 3 switches can also forward IP packets based on the routing table, the same as routers. Is the working mechanism the same as that of routers? Obviously, the answer is no. Before comparing the forwarding process of the two in detail, let's briefly introduce the forwarding process of the three-layer switch, so that everyone can understand the forwarding process of the data packet in the layer 3 switches in more detail. For the forwarding of Layer 2 packets in the same network segment, the processing mechanism of the Layer 3 switch is the same as that of the Layer 2 switch, which is based on the destination MAC address. We will skip that part in this chapter. We are mainly concerned about the layer 3 IP packet forwarding across the network segment.

Brief architecture of the layer 3 switch

Figure 1: Brief architecture of the layer 3 switch

ASIC: Charge in layer 2 and layer 3 forwarding functions, including the MAC address table for layer 3 forwarding and the layer 3 forwarding table for IP forwarding;

CPU: Used for forwarding control. It mainly maintains software entries (including software routing tables, software ARP tables, etc.), and configures the ASIC's hardware layer 3 forwarding table according to the forwarding information of the software entries. Of course, the CPU itself can also complete the software three-layer forwarding.

Brief architecture of the layer 3 switch

Figure 2PC A and PC B communicate across network segments

Assuming that PC A wants to communicate with PC B that is not on the same network segment, we will introduce the entire communication process in detail as follows:

  1. PC A realizes that PC B is not in the same network segment as itself, and it will send an ARP request message to request the MAC address of the gateway, that is, the MAC address of the switch.

  2. After receiving the ARP request, the switch responds with an ARP reply message to PC A. At the same time, it will also record the MAC address and IP address of PC A in the ARP table.

  3. PC A encapsulates the data packet (source IP: PC A, destination IP: PCB, source MAC: PC A, destination MAC: switch) and sends it to the switch.

  4. After the switch receives the modified message, it looks up the source MAC of the message and the VLAN where the port is located to update the MAC address table and then looks up the MAC table according to the destination MAC and VLAN number for forwarding (this is a layer 2 forwarding mechanism). But the switch discovers that the destination MAC is the MAC table of its own Layer 3 interface, and the switch realizes that this packet is either sent to itself or needs to be forwarded at Layer 3. Therefore, the switch searches for the three-layer table entry of the switching chip according to the destination IP. Since notable entry has been created before, the search fails. Then, the switch sends the message to the CPU for processing.

  5. The CPU searches the routing table according to the destination IP of the message, finds the matching item (if there is no match, the message will be discarded), and continues to look up the software ARP table, but the corresponding entry is not found.

  6. The switch sends ARP request packets on all interfaces of the VLAN corresponding to the destination IP, requesting the MAC address of the destination IP.

  7. PC B responds to the ARP reply message after receiving the request. After the switch learns the MAC, it will also record the corresponding data and send the message from PC A to PC B to complete the transfer from PC A to PC B. Communication.

From PC B to PC A, since the forwarding entry has been established on the switch, subsequent messages will not be sent to the CPU, and the table lookup and forwarding process will be completed directly on the forwarding chip.

It can be known from the above process that ASIC plays an extremely important role in the forwarding process of the layer 3 switches. It can realize fast forwarding after establishing the layer 3 forwarding entry after the first communication process, thereby eliminating the need for continuous lookup of the routing table. The mechanism not only speeds up the forwarding process but also saves the occupation of system CPU resources. This is also a huge difference compared to router layer three forwardings.

Back to the question at the beginning of this chapter, why the core device of the network is often the core switch because the destination IP address of the devices in the same network to exchange data with each other is very limited, when the establishment of the layer 3 forwarding table is completed, the core switch Data will be forwarded very efficiently. For data accessing the Internet, routers will have better processing capabilities than Layer 3 switches due to the vastly different destination addresses.


The post is synchronized to: HCIA - Datacom class notes

andersoncf1
MVE Author Created Jul 17, 2021 17:05:15

Well done! Thanks for sharing knowledge with us.
View more
  • x
  • convention:

Good share
View more
  • x
  • convention:

IndianKid
Moderator Author Created Jul 18, 2021 05:59:55

Well done! Thanks for sharing knowledge with us.
View more
  • x
  • convention:

Very good one
View more
  • x
  • convention:

Thank you for sharing and keep up the good work!
View more
  • x
  • convention:

The working mechanism of a layer 3 switch is well explained Ethernet switching - The working mechanism of a layer 3 switch-4235199-1
View more
  • x
  • convention:

Interesting to know, learned
View more
  • x
  • convention:

zaheernew
MVE Author Created Oct 20, 2021 09:33:06

Ethernet switching - The working mechanism of a layer 3 switch-4235295-1
View more
  • x
  • convention:

Intresting
View more
  • x
  • convention:

12
Back to list

Comment

You need to log in to comment to the post Login | Register
Comment

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " User Agreement."

My Followers

Login and enjoy all the member benefits

Login

Block
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Reminder
Please bind your phone number to obtain invitation bonus.