Layer-3 switching for communication between different VLANs

Source: Internet
Author: User

Layer-3 switches use hardware to exchange and route data packets. To process high-level information about data packets in hardware, CISCO switches use a traditional MLS (multi-layer switching) architecture or a CEF (fast forward)-based MLS architecture.

1. Traditional MLS

MLS enables ASIC (application-specific integrated circuit) to be routed to data packets for layer-2 rewriting. layer-2 rewriting includes rewriting of source and target MAC addresses, and the cyclic redundancy check code (CRC) after re-calculation ).

When using traditional MLS, the switch forwards the first data packet in the data stream to the layer-3 engine, which processes the data packet in software exchange mode. After routing the first data packet in the data stream, the layer-3 engine processes the program of the hardware switching component to select a route for the subsequent data packets.

2. CEF-based MLS

CEF is a topology-based forwarding model that can add all routing selection information to the forwarding information database (FIB) in advance. In this way, the vswitch can quickly find the route selection information.

The CEF mainly contains the following two information tables for forwarding.

Forwarding information library (FIB): CEF uses FIB to make forwarding decisions based on the target IP address prefix. FIB is similar to the image of a route table that contains the forwarded information. When the network topology changes, the route table is updated, and the FIB changes accordingly. FIB contains the next hop address, which is obtained based on the information in the route table. When the CEF-based MLS is used, the layer-3 engine and hardware switching component maintain a FIB.

In the network, if two nodes have only one hop on the data link layer, they are adjacent to each other. In addition to FIB, CEF also uses the adjacent relational table to Store Layer 2 Compilation information. Each FIB entry's adjacent relational table contains the corresponding Layer 2 address. Like FIB, when the CEF-based MLS is used, the layer-3 engine and hardware switching components maintain an adjacent table.

3. Introduction of virtual Interfaces

You may not be aware that VLAN1 in a vswitch is actually a virtual interface. By default, all interfaces belong to this VLAN. Therefore, no matter which port is connected to the vswitch, The vswitch can be remotely connected, the premise is to configure a password for the IP address. From this point, we can analyze that we only need to enable the relevant VLAN on the layer-3 Switch and configure the IP address, which belongs to the gateway of all hosts in the VLAN.


Layer-3 switching Configuration

1. Enable the routing function

Switch (config) # ip routing

2. Create a VLAN and configure the IP address

For example, create vlan 10 and vlan 20 on layer-3 switches and configure IP addresses to implement communication between different VLANs.

The topology is as follows:

650) this. length = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/005S25496-0.jpg "title =" 1.jpg" width = "500" height = "472" border = "0" hspace = "0" vspace = "0" style = "width: 500px; height: 472px; "/>

The configuration of layer-3 Switch1 is as follows:

Switch1 (config) # valn 10

Switch1 (config-vlan) # ip add 192.168.1.1 255.255.255.0

Switch1 (config-vlan) # no sh

Switch1 (config-vlan) # exit

Switch1 (config) # valn 20

Switch1 (config-vlan) # ip add 192.168.2.1 255.255.255.0

Switch1 (config-vlan) # no sh

Switch1 (config-vlan) # exit

Switch1 (config) # int range f0/0-1

Switch1 (config-if-range) # switchport trunk encapsulation dot1q

Switch1 (config-if-range) # switchport mode trunk

Switch1 (config-if-range) # no sh

Note: the link between layer-3 switching and layer-2 switching is a relay link, and the corresponding interface should be set to trunk

The configurations of the L2 Switch Switch2 are as follows:

Switch2 (config) # valn 10

Switch2 (config-vlan) # exit

Switch2 (config) # int f0/1

Switch2 (config-if) # switchport access vlan 10

Switch2 (config-if) # no sh

Switch2 (config) # int f0/0

Switch2 (config-if) # switchport trunk encapsulation dot1q

Switch2 (config-if) # switchport mode trunk

Switch2 (config-if) # no sh

The configurations of the L2 Switch Switch3 are as follows:

Switch3 (config) # valn 20

Switch3 (config-vlan) # exit

Switch3 (config) # int f0/1

Switch3 (config-if) # switchport access vlan 20

Switch3 (config-if) # no sh

Switch3 (config) # int f0/0

Switch3 (config-if) # switchport trunk encapsulation dot1q

Switch3 (config-if) # switchport mode trunk

Switch3 (config-if) # no sh


In this case, you only need to configure the corresponding IP address and gateway for PC1 and PC2 to communicate with each other.

Note: To configure an IP address for an interface of layer-3 switching, you must first enter this interface and then no switchport.

Switport (config-if) # no switchport



This article is from the "initialize" blog, please be sure to keep this source http://cshbk.blog.51cto.com/5685776/1246773

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.