What is a layer-2 switch? The operating skills and operating methods of L2 switches are found on some technical forums and blogs for your reference only.
In order to adapt to the challenges brought by the deepening of network applications, the scale and speed of the network are rapidly developing. The speed of the LAN has increased from 10 Mbit/s to 100 Mbit/s, at present, the Gigabit Ethernet technology has been widely used. In terms of network structure, it has also evolved from an earlier LAN with shared media to the current LAN.
The exchange LAN technology enables dedicated bandwidth to be exclusive to users, greatly improving the efficiency of LAN transmission. It can be said that in the network system integration technology, the first-layer interface and the second-layer exchange technology that are directly oriented to users have obtained satisfactory answers.
However, as the core of the network, the router technology that acts as the interconnection between networks has no qualitative breakthrough. In this case, a new routing technology came into being. This is the layer-3 switching technology: it is a router because it can operate on the layer-3 of the network protocol, it is a type of routing that understands devices and can act as a route decision;
It is a switch because it is very fast and almost achieves the second-layer switching speed. Who are the advantages and disadvantages of layer-2 switches, layer-3 switches, and routers? To answer this question, let's start with the working principles of these three technologies:
A layer-2 switch is a device at the data link layer. It can read the MAC address information in the data packet and exchange it based on the MAC address. There is an address table inside the vswitch, which indicates the relationship between the MAC address and the vswitch port.
When a vswitch receives a packet from a port, it first reads the source MAC address from the packet header so that it knows the port on which the machine with the source MAC address is connected, it then reads the target MAC address in the header and finds the corresponding port in the address table.
If the table has a port corresponding to the destination MAC address, the data packet is copied directly to the port. If the corresponding port cannot be found in the table, the data packet is broadcast to all ports, when the target machine responds to the source machine, the switch can learn which port the destination MAC address corresponds to. The next time data is transmitted, it no longer needs to broadcast all ports.
The second-layer switch creates and maintains its own address table. Because L2 switches generally have a wide switching bus bandwidth, they can exchange data for many ports at the same time. If a L2 Switch has N ports, and the bandwidth of each port is M, and the bus bandwidth of the switch exceeds N × M, the switch can achieve line rate switching. The L2 Switch does not limit the broadcast packets. It copies the broadcast packets to all ports.
Layer-2 switches generally contain Application specific Integrated Circuit chips used to process data packet forwarding, so the forwarding speed can be very fast, A device with layer-3 switching is a layer-2 switch with layer-3 routing, but it is an organic combination of the two, it is not simply to overlay the hardware and software of the router device on the LAN switch.
From the hardware point of view, the interface modules of the second layer switch exchange data through the High-Speed Backplane/bus speed up to dozens of Gbit/s). In the third layer switch, the router-related layer-3 Routing hardware module is also inserted on the high-speed backplane/bus.
- Describes how to configure a backbone switch.
- How the Cisco 1800 vswitch works and its skills
- What is the strength of a Cisco switch?
- What is the difference between a smart switch and a HUB?
- Differences between common switches and hubs
This method enables the routing module to exchange data with other modules to be routed at a high speed, thus breaking the speed limit of the traditional external router interface. In terms of software, layer-3 switches also have significant initiatives, which define traditional software-based router software.
The practice is:
For packet forwarding, such as IP/IPX packet forwarding, these regular processes are implemented through hardware at a high speed. For layer-3 routing software, such as route information update, route table maintenance, route calculation, and route determination, Use optimized and efficient software.
Assume that two machines that use the IP protocol communicate with each other through the layer-3 Switch. Machine A knows the destination IP address when sending the message, but does not know the MAC address required to send the message on the LAN. Use address resolution ARP) to determine the target MAC address.
Machine A compares its IP address with the target IP address, extracts the network address from the subnet mask configured in its software, and determines whether the target machine is in the same subnet as itself. If the destination machine B and machine A are in the same subnet, A broadcasts an ARP request.
B returns its MAC address. A obtains the MAC address of the target machine B, caches the address, and uses the MAC address to package and forward data, the second layer switch module finds the MAC address table and determines to send data packets to the destination port. If two machines are not in the same subnet, if machine A needs to communicate with machine C, machine A must send an ARP packet to the "Default Gateway, the IP address of the "Default Gateway" has been set in the system software.
This IP address actually corresponds to the layer-3 Switch module of the layer-3 switch. Therefore, when sending an ARP request to the IP address of the "Default Gateway" from machine A, if the layer-3 Switch module obtains the MAC address of the target machine C during the previous communication, then the MAC address of C is sent to machine;
Otherwise, the layer-3 Switch module broadcasts an ARP request to the target machine based on the route information. The target machine C obtains this ARP request and replies its MAC address to the layer-3 Switch module, the layer-3 Switch module saves the address and replies to the sender machine. Later, when data packets are forwarded between A and C, they are encapsulated with the MAC address of the destination machine. The data forwarding process is all forwarded to the second layer for exchange, enabling high-speed information exchange. The so-called one-time routing and multiple exchanges.