HCIA Inter-VLAN Communication and Layer 3 Switching

1. Foreword

Earlier we talked about the use of routers to achieve inter-VLAN communication, which is divided into single-arm routing and multi-arm routing. The role of routers is actually to achieve cross-network interaction. For the same VLAN network, devices with different network segments still need to use router to exchange its data. The coincidence of this matter is that generally we configure the subnet of the same VLAN as the same network segment, so the router just realizes the communication between VLANs, but in essence the router is still used between subnets (different network segments) intercommunication.

For a network composed of switches, if the router is only used for communication across VLANs (cross-network segments), it still feels a bit wasteful, so there is a so-called three-layer switching, which is to implement functions similar to routers inside the switch. Real routers are a little different.

Layer 2 and layer 3 switching

In the network shown in the figure below, PC1 and PC2, PC3 and PC4 can communicate with each other, but PC1 and PC3 cannot communicate with each other. The reason is that apart from the limitation of VLAN, they are not in the same network segment and cannot communicate. For PC1, when its target IP is not in its network segment, it can only seek help from the gateway, that is, throw the data to the gateway. Therefore, the three-layer switching is to open a gateway on the switch. This gateway can receive the data of PC1 and forward it to the gateway 2 of the target network segment. After receiving the data, the gateway 2 forwards it to the target IP. The process is the same as for routers.

 

We can configure Layer 3 switching in LSW2, the configuration content is as follows:

system-view #Enter system view

interface Vlanif 10 #Create a virtual interface

ip address 192.168.1.254 24 #Configure as the IP of the gateway

quit

interface Vlanif 30 #Create a virtual interface

ip address 192.168.3.254 24 #Configure as gateway IP

After configuration, we can check the routing table on the switch, and we can see that the routes of the 192.168.1.0 and 192.168.3.0 network segments have appeared, and because they are all on the same switch, they are directly connected routes.

 

In this way, we realize the communication between VLAN10 and VLAN30 by using Layer 3 switching. The communication process is shown in the figure below. Simply put, it actually replaces the function of the router.

 

Through packet capture, we can also find that after VLANIF is configured, LSW2 will respond to ARP packets, and will also actively send ARP packets to find the target IP, which would only be forwarded before.

3. Limitations of Layer 3 Switching

In fact, it can be seen from the name VLANIF that Layer 3 switching is essentially used for intercommunication between VLANs. It is not a router. For example, it can only be limited to the internal routing of a single switch and cannot cross switches.

In the network shown in the figure below, after we change VLANIF30 to LSW3, since VLANIF10 and VLANIF30 can’t really write a route, when PC1 sends data to its gateway (VLANIF10), the gateway cannot find the route of the target network segment. So the data will be discarded at the gateway.

 

4. Review

The VLANIF mentioned in this article is actually a function used to replace the router to realize the intercommunication between VLANs. I think it still needs to be distinguished from the routing port of the switch. In some places, the routing port of the switch is also called Layer 3 switching, which I feel a little bit That's ridiculous, if a switch is equipped with a routing port, it is a real routing function, just like some routers also have a switching port.

Guess you like

Origin blog.csdn.net/weixin_40402375/article/details/127836941