Difference between L2 Switch and L3 Switch
Layer 2 Switching Technology
Layer 2 switch belongs to the data link layer, it can automatically identify the MAC address in the packet and forward based on MAC address. Meanwhile it records the MAC address with the corresponding port in its own internal address table. The main process as follows:
(1) When a switch receives a packet from a port, it reads the source MAC address in the header, so that it knows where the machine is connected to the source MAC address.
(2) Read the destination MAC address in the header and look for the corresponding port in the address table.
(3) If there is a corresponding port to the destination MAC address, the packet is copied directly to this port.
(4) If can't find the corresponding ports in the table, the packet would be broadcast to all ports, when purpose machine response to the source machine, switch can learn and record the destination MAC address and corresponding port, it is no longer need to broadcast to all ports when transmitting data in the next time.
Through the over repeating above process, layer 2 switch sets up and maintain its own address table, then record and learn MAC address of the whole network system.
The following three points can be inferred from the working principle of the layer 2 switch:
(1) Due to switch is exchanging data for numbers of ports at the same time, it requires a wide exchange bandwidth, if there are an N - port layer 2 switch, the bandwidth of the each port is M, therefore total bandwidth is more than N * M, then the switch can achieve wire-speed switching.
(2) Learning MAC address of connected machine, write into address table, record the address table size (generally two kinds of representation: one is BEFFER RAM, the other one is for value of MAC table), the address table size affects switch’s access capacity.
(3) ASIC Chip(Application specific Integrated Circuit) is commonly used in a layer 2 switch, which is dedicated to processing packets, so the forward speed can be very fast. But each manufacturer adopt different ASIC model, it affects product performance directly. And the ONV (Model POE38036PFM) adopts the import stability aerospace grade chip, the product performance is self-evident.
The above three points are also the main technical parameters to judge the performance of layer 2 and layer 3 switches, so please pay attention to the comparison when selecting products.
Router is working on the third layer in OSI, that is network layer. Its working mode is similar with layer 2 switch’s. But working on the network layer, it determines that router and switch use different control information when transmitting packets, and different ways of implementing functionality. The working theory is that there is a table in the interior of a router, which is marked to guide the data to the destination. If there is a known destination for a packet in routing table, the packet would be forwarded with link layer information. But if there isn’t a known destination, then the router would loss the packet and feedback a message to the source address.
Routing technology virtually contains just 2 functions :Selecting the best route and data-packing forward. Different information will be recorded in the routing table and realize the best path of destination by router algorithm. After then the data-package will be sent directly by a simple forwarding mode. Meanwhile, the next router works under the same way till the date-package loading in the destination as a result.
There are also 2 ways of maintenance for router table , One is the update of router information which release partial information or entire information. The routers master topological structure of the whole network by learning each-other. This kind of routing protocol was named distance routing protocol; But another one is broadcast itself link status and master whole network’s routing information to get the best transmitting path. It was called link-status routing protocol.
As the router has to make lots of path calculation. Therefore the working capability was decided by the CPU
For sure. This judgment is just for middle or low router since the the high-end router usually use distributed processing system as their design
Layer 3 Switching Technology
What is layer 3 switching technology? In short, it is combination of layer 2 switching technology and layer 3 forwarding technology. After it solves the network segmentation of LAN, it must rely on the router to do management for subnet in the network. And it solves the network key point caused by the low speed and complexity of the traditional router. Here is a simple network to show the working process of a layer 3 switch.
A Simple Networking
Equipment A with IP ------ Layer 3 switch ------ Equipment B with IP
If there is data from A to B. And the destination IP is know. Then it gets the network address through subnet mask for A, and check if the destination IP is in the same network segment.
If it is in the same network segment, but users don’t know the MAC address that need to forward the data to, then users can send a ARP request by A, and B will feedback its MAC address. After that A uses this MAC to encapsulate the packet and send it to the switch. The switch would start with the layer 2 switching module, look up the MAC address table, and forward the packet to the corresponding port.
If it is not in the same network segment, in order to achieve communication between A and B, it forwards the first normal packet to a default gateway without corresponding MAC address in flow cache. The default gateway has been set in the operating system and correspond with layer 3 routing module. Therefore, the first record into MAC table is the MAC address of default gateway if the data are not in the same subnet.
And after receiving the packet by layer 3 module, users can check the operation status in routing table. It will build up a new frame head, of which the source MAC address is MAC address of default gateway, and the destination MAC address is MAC address of equipment B. It can establish corresponding relations between A and MAC address, forwarding port of B through a certain recognition mechanism. Also it will record into flow cache list, all the data from A to B will be operated through layer 2 switching module directly, namely is “A routing process, multi-times forwarding”.
The above is a simple summary of the work process of layer 3 switch, which shows the characteristics of layer 3 switch:
1. High-speed forwarding of data by combining hardware.
2. It is not a simple superposition of layer 2 switches and routers, layer 3 routing module is directly added in high-speed backplane bus of layer 2 switching and breaks through the rate limit of traditional router interface, the rate can reach to dozens of Gbit/s. With the switching capacity, these are two important parameters of the performance of layer 3 switches.
3. Most of the data, except the necessary routing operated by the routing software, are forwarded at high speed by layer 2 module. Routing software is mostly through efficient optimization, not a simple copy router.
Due to there isn’t much influences of broadcast in small scale LAN, it is widely use layer 2 switch.Fast switching function,multiple access port and cost effective price ensures layer 2 switch provide a perfect solution for small scale network system.
The most important function of the layer 3 switch is to speed up the rapid forwarding of data for large scale network. The routing function is also served for this purpose. If dividing large networks into small local area networks according to departments, regions and other factors, it will result in a large number of Internet visits, and the layer 2 switch can not handle with these large of visitors.
If simply want to use router, it will limit network speed and scae due to the limit of interface numbers and low-speed of router forwarding. Therefore it is better to use layer 3 switch with routing function and fast forwarding speed.