VLANThe typical configuration process is as follows:
Networking Diagram
Figure 1-1 port-based VLAN networking
Application Requirements
As shown in Figure 1-1, Switch A and Switch B connect Host1/Host2 and Server1/Server2 used by different departments.
To ensure data isolation between departments, you must divide Host1 and Server1 into VLAN100 and Host2 into VLAN200. Set the description characters for the two VLANs to "Dept1" and "Dept2" respectively ".
Configure the VLAN Interface on SwitchA to forward data sent from Host1 to server2.
Applicable products and versions
Table 1-1 configure the relationship between applicable products and software and hardware versions
Configuration process and Explanation
Configure Switch
- # Create a VLAN100 and configure the VLAN100 description string as "Dept1". Add the port GigabitEthernet1/0/1 to the VLAN100.
-
- <SwitchA> system-view
-
- [SwitchA] vlan 100
-
- [SwitchA-vlan100] description Dept1
-
- [SwitchA-vlan100] port GigabitEthernet 1/0/1
-
- [SwitchA-vlan100] quit
-
- # Create a VLAN200 and configure the VLAN200 description string as "Dept2 ".
-
- [SwitchA] vlan 200
-
- [SwitchA-vlan200] description Dept2
-
- [SwitchA-vlan200] quit
-
- # Create VLAN100 and VLAN200 interfaces. The IP addresses are configured as 192.168.1.1 and 192.168.2.1 respectively to forward packets sent from Host1 to server2.
-
- [SwitchA] interface Vlan-interface 100
-
- [SwitchA-Vlan-interface100] ip address 192.168.1.1 24
-
- [SwitchA-Vlan-interface100] quit
-
- [SwitchA] interface Vlan-interface 200
-
- [SwitchA-Vlan-interface200] ip address 192.168.2.1 24
Configure Switch B
- # Create a VLAN100 and configure the VLAN100 description string as "Dept1". Add the port GigabitEthernet1/0/13 to the VLAN100.
-
- <SwitchB> system-view
-
- [SwitchB] vlan 100
-
- [SwitchB-vlan100] description Dept1
-
- [SwitchB-vlan100] port GigabitEthernet 1/0/13
-
- [SwitchB-vlan100] quit
-
- # Create a VLAN200 and configure the VLAN200 description string as "Dept2". Add the ports GigabitEthernet1/0/11 and GigabitEthernet1/0/12 to the VLAN200.
-
- [SwitchB] vlan 200
-
- [SwitchB-vlan200] description Dept2
-
- [SwotchB-vlan200] port GigabitEthernet1/0/11 GigabitEthernet 1/0/12
-
- [SwitchB-vlan200] quit
Configure the link between Switch A and Switch B
Because the links between Switch A and Switch B need to transmit data from both VLAN100 and VLAN200 at the same time, you can configure the ports at both ends as the Trunk port and allow packets from the two VLANs to pass through.
- # Configure the GigabitEthernet1/0/2 port of Switch.
-
- [SwitchA] interface GigabitEthernet 1/0/2
-
- [SwitchA-GigabitEthernet1/0/2] port link-type trunk
-
- [SwitchA-GigabitEthernet1/0/2] port trunk permit vlan 100 200
-
- # Configure the GigabitEthernet1/0/10 port of Switch B.
-
- [SwitchB] interface GigabitEthernet 1/0/10
-
- [SwitchB-GigabitEthernet1/0/10] port link-type trunk
-
- [SwitchB-GigabitEthernet1/0/10] port trunk permit vlan 100 200
Complete Configuration
Configurations on SwitchA
- #
- vlan 100
- description dept1
- #
- vlan 200
- description dept2
- #
- interface Vlan-interface 100
- ip address 192.168.1.1 255.255.255.0
- #
- interface Vlan-interface 200
- ip address 192.168.2.1 255.255.255.0
- #
- interface GigabitEthernet1/0/1
- port access vlan 100
- #
- interface GigabitEthernet1/0/2
- port link-type trunk
- port trunk permit vlan 1 100 200
Configurations on SwitchB
- #
- vlan 100
- description dept1
- #
- vlan 200
- description dept2
- #
- interface GigabitEthernet1/0/10
- port link-type trunk
- port trunk permit vlan 1 100 200
- #
- interface GigabitEthernet1/0/11
- port access vlan 100
- #
- interface GigabitEthernet1/0/12
- port access vlan 200
- #
- interface GigabitEthernet1/0/13
- port access vlan 100
The typical VLAN configuration process is over here. I hope you have mastered it. We will continue to introduce you to relevant knowledge in future articles.