In a local area network, we use VLAN to group different users, departments, and areas with different purposes. One VLAN distinguishes a group of users for easy management and use. What is VLAN?VLAN technology can logically divide a physical LAN into multiple broadcast domains, each of which is called a virtual LAN (VLAN). Each host can only belong to one VLAN, and hosts belonging to the same VLAN communicate directly through Layer 2. VLAN division is not to completely isolate communication, but to reduce the scope of broadcast domain propagation, filter redundant packets, and improve network transmission efficiency. How to achieve host communication between different VLANs?VLAN isolation of Layer 2 networks must be implemented through Layer 3 network devices. These devices perform routing and forwarding operations for traffic between different VLANs based on IP addresses, which is called inter-VLAN routing. What are the methods for implementing inter-VLAN routing?Three inter-VLAN routing methods are introduced in the order of time and technology development. The first type: traditional inter-VLAN routingThe role of a router is to forward data packets between different networks, and VLAN is to divide different LANs on one or a group of switches and isolate them into different network segments. Therefore, it is natural that communications between different VLANs require routers to forward. Different VLANs are connected to different router interfaces, and one router interface is connected to the switch port of one VLAN. Assume that both the PC and the router have ARP cache tables of all devices in the same network segment, and the MAC address table of the switch also has the MAC address information of each device. Then when PC1 sends data to PC5, the whole process is as follows:
The switch checks the destination MAC address of the data frame and forwards the data frame to PC5 based on the destination MAC address. How do hosts in the same VLAN communicate with each other?When PC1 sends data to PC2, since the destination IP address is in the same network segment as PC1, PC1 will use PC2's MAC address as the destination MAC address to encapsulate the data frame; the switch will also directly forward the data frame to PC2 through PC2's port. If PC1 and PC3 in different VLANs communicate, will the switch forward the message sent by PC1 directly to PC3 based on the MAC address? The MAC address table not only records the correspondence between the switch port and the MAC address, but also includes the VLAN of the port. The switch will not forward data frames from ports of different VLANs by querying the MAC address table. Traditional inter-VLAN routing experimentExperimental topology diagramInterface ListExperimental requirements
Experimental procedures
Experimental SummaryBefore configuring the network, sort out the interface list, interface IP address table and VLAN division table to facilitate device configuration. The second type: single-arm routingRouters are used to connect heterogeneous networks, and their characteristics are that they have different types of physical interfaces and a small number of interfaces; switches are used to build local area networks, and their characteristics are that they have a small number of physical interface types and a large number of interfaces. In actual network environments, a large number of VLANs will be created on a switch, and each VLAN uses a router interface as the default gateway, so the router interface is not enough. In order to save the router interface, use one interface to connect to the switch. No matter which VLAN the traffic is from, it will enter and exit the router through this one interface, thus realizing traffic forwarding between all VLANs. This method is called one-arm routing. The physical topology diagram above may not be very clear. You can better understand the principle by looking at the logical topology diagram of one-arm routing below.
Can a router interface act like multiple interfaces and carry traffic from multiple different VLANs at the same time? The router provides a logical interface called a sub-interface. As the name implies, a sub-interface logically divides a router physical interface into multiple logical sub-interfaces to meet the need to connect multiple networks with one physical interface. One-arm routing experimentExperimental topology diagramInterface ListThe traditional multiple router interfaces for inter-VLAN routing are transformed into one router interface for one-arm routing, which is used to connect to the switch. The configuration of other interfaces remains unchanged. Experimental requirements
Experimental procedures
The third type: three-layer switching technologyFrom the perspective of traffic flow, single-arm routing is a long-term solution. The port traffic of two different VLANs on the switch cannot be directly forwarded through the switch, but needs to go around the router. This is because the layer 2 switch does not have the layer 3 forwarding capability and cannot view its own routing table based on the destination IP address of the data packet; the layer 2 switch cannot become the gateway of the connected host, and a router is required to act as the gateway. Then, a device that adds special routing and forwarding hardware to the traditional Ethernet switch appeared. This type of device not only has the functions of a traditional layer 2 switch, but can also route data packets through ASIC (application-specific integrated circuit). This switch that integrates the layer 3 packet forwarding function is called a layer 3 switch. A layer 3 switch can isolate terminals in different VLANs and provide inter-VLAN routing for these terminals, eliminating the need for routers to forward traffic between different VLANs. To implement inter-VLAN routing, each VLAN needs to be assigned an independent Layer 3 interface as a gateway. The Layer 3 switch does not use a Layer 3 physical interface to connect each VLAN, but instead creates a virtual VLAN interface and assigns a virtual Layer 3 interface to each VLAN. Virtual VLAN interfaces are created by Layer 3 switches, so Layer 3 switches will act as direct interfaces and fill their networks into the routing table as direct routes. At the same time, the virtual VLAN interface and the physical Layer 2 port in the corresponding VLAN are in the same subnet, acting as the gateway of this VLAN. The forwarding efficiency and scalability of a three-layer switch are far better than that of a single-arm router to implement inter-VLAN routing, and its management and configuration are also simpler. Currently, this solution has become the first choice for implementing inter-VLAN routing. Three-layer switch experimentExperimental topology diagramInterface ListExperimental procedures
Can a Layer 3 switch replace a router?The routing function of a Layer 3 switch is usually relatively simple, mainly connecting to a LAN, and contains a large number of Ethernet interfaces. Its main purpose is to provide fast data exchange functions to meet the application characteristics of frequent data exchange in the LAN. Routers are different. They are designed to meet different types of network connections, such as the connection between a LAN and a WAN, and the connection between networks with different protocols. Its main function is routing and forwarding, solving network connections with various complex paths. It is not only applicable to LANs with the same protocol, but also to LANs and WANs with different protocols. It has the functions of selecting the best route, load sharing, link backup, and exchanging routing information with other networks. Therefore, there is an essential difference between a layer 3 switch and a router, and a layer 3 switch cannot completely replace the work of a router. |
<<: If you write CRUD every day, it’s time to connect the system to the API gateway!
>>: Ten times faster than 5G? What is the future of 10G network?
[[418257]] The advent of the cloud-native era has...
In order to help more ICT industry practitioners ...
2020-12-31 09:392020 is a year of vigorous constr...
The recent WannaCry ransomware cyberattack target...
LiCloud.io has started a new September promotion,...
[51CTO.com original article] Many people compare ...
Kvmla has launched a year-end and 2024 New Year p...
Wi-Fi 6 (802.11ax) is here, and more and more wir...
RackNerd has released several promotional package...
Today I want to talk to you about the topic of ga...
A friend talked about cluster servers. I recently...
First of all, I want to emphasize that the TCP/IP...
edgeNAT has released a Double 12 discount plan, v...
At present, the number of 4G users in my country ...