SoFunction
Updated on 2025-04-11

A typical Ethernet network establishes multiple VLAN instances

The so-called typical LAN refers to a core switch with a layer three switching function connected to several branch switches (not necessarily with layer three switching capabilities). We assume that the core switch name is: com; the branch switch is: par1, par2, and par3, respectively, and is connected to the core switch through the optical module of port 1; and assume that the vlan names are counter, market, and management...

Work needs to be done:
1. Set vtp domain (set on core and branch switches)
2. Configure relay (set on core and branch switches)
3. Create a vlan (set on server)
4. Transfer the switch port into vlan
5. Configure three-layer exchange

1. Set vtp domain. vtp domain is called the administrative domain.
All switches that exchange vtp update information must be configured as the same management domain. If all switches are connected by trunk lines, then as long as a management domain is set up on the core switch, all switches on the network are added to the domain, so that all switches in the management domain can understand each other's vlan list.
com#vlan database Enter vlan configuration mode
com(vlan)#vtp domain com Set vtp management domain name com
com(vlan)#vtp server Set the switch to server mode
par1#vlan database Enter vlan configuration mode
par1(vlan)#vtp domain com Set vtp management domain name com
par1(vlan)#vtp client Set the switch to client mode
par2#vlan database Enter vlan configuration mode
par2(vlan)#vtp domain com Set vtp management domain name com
par2(vlan)#vtp client Set the switch to client mode
par3#vlan database Enter vlan configuration mode
par3(vlan)#vtp domain com Set vtp management domain name com
par3(vlan)#vtp client Set the switch to client mode
Note: Setting the core switch to server mode here means that the vlan and other configuration parameters for the entire vtp domain are allowed to be created, modified, and deleted on the switch, and synchronized the latest vlan information passed by other switches in this vtp domain; client mode means that the switch cannot create, delete, and modify the vlan configuration, nor can it store the vlan configuration in NVRAM, but the vlan information passed by other switches in this vtp domain can be synchronized.

2. Configure relay In order to ensure that the management domain can cover all branch switches, relay must be configured.
Cisco switches can support any medium as a trunk, and their unique isl tags can be used in order to achieve relays. isl (inter-switch link) is a protocol that passes multiple VLAN information and VLAN data flows between switches, between switches and routers, and between switches and servers. By configuring the isl encapsulation on the ports directly connected to the switch, VLAN allocation and configuration of the entire network can be performed across the switch.
The configuration on the core switch side is as follows:
com(config)#interface gigabitethernet 2/1
com(config-if)#switchport
com(config-if)#switchport trunk encapsulation isl Configure the relay protocol
com(config-if)#switchport mode trunk
com(config)#interface gigabitethernet 2/2
com(config-if)#switchport
com(config-if)#switchport trunk encapsulation isl Configure the relay protocol
com(config-if)#switchport mode trunk
com(config)#interface gigabitethernet 2/3
com(config-if)#switchport
com(config-if)#switchport trunk encapsulation isl Configure the relay protocol
com(config-if)#switchport mode trunk
The configuration on the branch switch side is as follows:
par1(config)#interface gigabitethernet 0/1
par1(config-if)#switchport mode trunk
par2(config)#interface gigabitethernet 0/1
par2(config-if)#switchport mode trunk
par3(config)#interface gigabitethernet 0/1
par3(config-if)#switchport mode trunk
At this time, the management domain has been set up.
3. Create a vlan Once the management domain is established, you can create a vlan.
com(vlan)#vlan 10 name counter Created a vlan numbered 10 and named counter
com(vlan)#vlan 11 name market Created a vlan numbered 11 and named market
com(vlan)#vlan 12 name managing created a vlan numbered 12 and named managing

Note that the vlan here is established on the core switch. In fact, as long as the vlan is established on any switch in the management domain with a server attribute, it will notify all switches in the entire management domain through vtp. However, if you want to divide the specific switch port into a vlan, you must set it on the switch to which the port belongs.

4. Transfer the switch port into vlan
For example, to place port 1 of the branch switches in par1, par2, par3... into counter vlan, port 2 into market vlan, and port 3 into managing vlan...
par1(config)#interface fastethernet 0/1 Configure port 1
par1(config-if)#switchport access vlan 10 Attribution counter vlan
par1(config)#interface fastethernet 0/2 Configure port 2
par1(config-if)#switchport access vlan 11 Attribution market vlan
par1(config)#interface fastethernet 0/3 Configure port 3
par1(config-if)#switchport access vlan 12 Attribution managing vlan
par2(config)#interface fastethernet 0/1 Configure port 1
par2(config-if)#switchport access vlan 10 Attribution counter vlan
par2(config)#interface fastethernet 0/2 Configure port 2
par2(config-if)#switchport access vlan 11 Attribution market vlan
par2(config)#interface fastethernet 0/3 Configure port 3
par2(config-if)#switchport access vlan 12 Attribution managing vlan
par3(config)#interface fastethernet 0/1 Configure port 1
par3(config-if)#switchport access vlan 10 Attribution counter vlan
par3(config)#interface fastethernet 0/2 Configure port 2
par3(config-if)#switchport access vlan 11 Attribution market vlan
par3(config)#interface fastethernet 0/3 Configure port 3
par3(config-if)#switchport access vlan 12 Attribution managing vlan

5. Configure three-layer exchange
At this point, vlan has been basically divided. However, how to implement layer three (network layer) exchange between vlans? At this time, each vlan needs to be assigned a network (IP) address. There are two situations for assigning IP addresses to vlan. One is to assign static IP addresses to all nodes in vlan; the other is to assign dynamic IP addresses to all nodes in vlan. The following are the two situations.
Assume that the interface IP address assigned to the vlan counter is 172.16.58.1/24, and the network address is: 172.16.58.0.
The interface IP address assigned by vlan market is 172.16.59.1/24, and the network address is: 172.16.59.0.
vlan managing allocated interface IP address is 172.16.60.1/24, and network address is 172.16.60.0
……
If the IP address is dynamically allocated, then the IP address of the DHCP server on the network is 172.16.1.11.
(1) Assign static IP addresses to all nodes of vlan.
First, set the interface IP addresses of each vlan on the core switch. The core switch treats vlan as an interface, just like on a router, as shown below:
com(config)#interface vlan 10
com(config-if)#ip address 172.16.58.1 255.255.255.0 vlan10 interface ip
com(config)#interface vlan 11
com(config-if)#ip address 172.16.59.1 255.255.255.0 vlan11 interface ip
com(config)#interface vlan 12
com(config-if)#ip address 172.16.60.1 255.255.255.0 vlan12 interface ip
Then, set the IP address that is consistent with the network address of the vlan on each computer connected to the vlan, and set the default gateway to the interface address of the vlan. In this way, all vlans can also visit each other.
(2) Assign dynamic IP addresses to all nodes of vlan.
First, set the interface IP addresses of each vlan and the IP addresses of the same DHCP server on the core switch, as shown below:
com(config)#interface vlan 10
com(config-if)#ip address 172.16.58.1 255.255.255.0 vlan10 interface ip
com(config-if)#ip helper-address 172.16.1.11 dhcp server ip
com(config)#interface vlan 11
com(config-if)#ip address 172.16.59.1 255.255.255.0 vlan11 interface ip
com(config-if)#ip helper-address 172.16.1.11 dhcp server ip
com(config)#interface vlan 12
com(config-if)#ip address 172.16.60.1 255.255.255.0 vlan12 interface ip
com(config-if)#ip helper-address 172.16.1.11 dhcp server ip
Then set the scopes of network addresses of 172.16.58.0, 172.16.59.0, and 172.16.60.0 on the dhcp server, and set the "router" option of these scopes to the corresponding interface IP address of the vlan. In this way, all vlans can be visited together.
Finally, set the network settings on each computer connected to the VLAN, and set the IP address option to automatically obtain. Article entry: csh     Editor in charge: csh     Editor in charge: csh