VLAN intercommunication is achieved through layer-3 switching. Generally, routers are rarely used within an enterprise network. In a production environment, inter-VLAN communication is mainly implemented through layer-3 switching. A layer-3 Switch provides the network layer function to enable VLAN mutual access. It uses the routing function of the layer-3 Switch to identify the IP address of the data packet and find the route table for Route Selection and forwarding. For cross-VLAN routing in a layer-3 Switch, SVI (Switch Virtual Interface) is required. SVI refers to the Virtual Interface created for the VLAN in the Switch and configures the IP address. SVI is an IP interface that connects two-layer VLANs. One SVI can only be associated with one VLAN. The tutorial topology www.2cto.com is similar to the above, except that the 2811 router is replaced with a 3560 layer-3 switch.
PC0 is connected to port f0/1 of the 2960 switch, IP Address: 192.168.1.10, default gateway 192.168.1.254, which belongs to VLAN 10, PC1 is connected to port f0/13 of the 2960 switch, IP Address: 192.168.2.10, default gateway 192.168.2.254, it belongs to VLAN 20. The f0/24 port of the 2960 switch is connected to the f0/1 port of the 3560 L3 switch and is set to the trunk mode. PC0 and PC1 belong to different VLANs. data communication between them must first be transmitted to the layer-3 Switch through the trunk link, and then forwarded to different VLANs by the layer-3 switch.
1. configure a Cisco 2960 Switch to create a VLAN: Switch # vlan databaseSwitch (vlan) # vlan 10 name vlan10Switch (vlan) # vlan 20 name vlan 20 Switch (vlan) # exit allocate port (group port f0/1-f0/12 to vlan10, and port f0/13-f0/23 to vlan20): Switch (config) # int range f0/1-12 www.2cto.com Switch (config-if-range) # switchport mode accessSwitch (config-if-range) # switchport access vlan 10 Switch (config-if-range) # exitSwitch (config) # int range f0/13-23Switch (config-if-range) # switchport mode accessSwitch (config-if-range) # switchport access vlan 20 Switch (config-if-range) # exit to set trunkSwitch (config) # int f0/24 Switch (config-if) # switchport mode trunkSwitch (config-if) # exit
2. Configure the Cisco 3560 Switch to create a VLAN with the same ID: Switch # vlan databaseSwitch (vlan) # vlan 10 name vlan10Switch (vlan) # vlan 20 name vlan20Switch (vlan) # exit and then set the SVI Switch virtual interface to set the IP address for each VLAN: Switch # conf tSwitch (config) # int vlan 10 Switch (config-if) # ip address 192.168.1.254 255.255.255.0Switch (config-if) # no shutdown www.2cto.com Switch (config-if) # exitSwitch (config) # int vlan 20 Switch (config-if) # ip address 192.168.2.254 255.255.255.0Switch (config-if) # no shutdownSwitch (config-if) # exit
Finally, a very important Command needs to be executed: Switch (config) # ip routing. This command is used to enable the routing function of a layer-3 Switch. Otherwise, a layer-3 Switch can only use its layer-2 function. 3. Set the corresponding IP addresses for the two PCs in the PC test. Use the ping command to test the IP addresses. The ping command can be used to verify that the VLANs can communicate with each other.
Author yttitan