Single-arm routing and three-layer switching technology
Single arm routing
Overview
Use when only a Layer 2 switch can be used to
achieve communication between different VLANs
operating
By dividing the physical interface of the router into multiple logical interfaces
, the gateway
PC1 and SW1 corresponding to a VLAN network segment of each sub-interface are connected as a host and a switch, so the access interface is used, and PC2 is the same; when data is accessed, it is labeled with Vlan. Take off the Vlan label when going out
Switch configuration
[SW1]i e0/0/1
[SW1-Ethernet0/0/1]p l a
//设置类型为access
[SW1-Ethernet0/0/1]p d v 1
[SW1]i e0/0/2
[SW1-Ethernet0/0/1]p l a
[SW1-Ethernet0/0/1]p d v 2
SW1 and R1 are connected as a switch and a router, so the trunk interface is used
Trunk function: check tags and transmit data
[SW1]i g0/0/1
[SW1-GigabitEthernet0/0/1]p l t
//设置类型为trunk
[SW1-GigabitEthernet0/0/1]p t a v a
//放行所有vlan
Router configuration
Option One
[R1]i g0/0/0.1
//建议子接口名与vlanID一致
[R1-GigabitEthernet0/0/0.1]un sh
//习惯性的开启端口
[R1-GigabitEthernet0/0/0.1]v d 1 d
[R1-GigabitEthernet0/0/0.1]i a 192.168.1.1 24
[R1]i g0/0/0.2
[R1-GigabitEthernet0/0/0.2]un sh
[R1-GigabitEthernet0/0/0.2]v d 2 d
[R1-GigabitEthernet0/0/0.2]i a 192.168.2.1 24
Option II
[R1]i g0/0/0.1
[R1-GigabitEthernet0/0/0.1]un sh
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 1
//和Access端口的功能相同
[R1-GigabitEthernet0/0/0.1]i a 192.168.1.1 24
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
//开启arp广播
[R1]i g0/0/0.2
[R1-GigabitEthernet0/0/0.2]un sh
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 2
[R1-GigabitEthernet0/0/0.2]i a 192.168.2.1 24
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
PC's IP address and gateway address configuration
Ping detection can be performed after setting
Layer 3 switching technology
Simpler and more efficient than single-arm routing.
Use three-layer switching technology to achieve inter
- Vlan communication. Three-layer switch (combination of switch and router)
Three-layer switching principle
Layer 3 switching = Layer 2 switching + Layer 3 forwarding
The forwarding process of CEF-based MLS is to send unicast data packets, re-encapsulate the data frame by looking up the FIB and adjacency table, and forward it from the corresponding port
operating
The three-layer switch cannot be configured in the physical interface, to create a virtual interface vlanif, and then configure the IP
Switch configuration
[SW1]v b 2 3
[SW1]int Vlanif 2
//尽量和vlan同名
[SW1-Vlanif2]ip add 192.168.1.1 24
//虚拟接口的IP为PC机的网关
[SW1]int Vlanif 3
[SW1-Vlanif2]ip add 192.168.2.1 24
[SW1]int g0/0/1
[SW1-GigabitEthernet0/0/1]p l a
[SW1-GigabitEthernet0/0/1]p d v 2
[SW1]int g0/0/2
[SW1-GigabitEthernet0/0/2]p l a
[SW1-GigabitEthernet0/0/2]p d v 3
PC's IP address and gateway address configuration