VLAN stands for Virtual Local Area Network and it is used to logically divide a LAN into multiple segments. VLAN Trunk helps you to allow communication between two or more VLAN with the same name. I have already explained the basics of VLAN and it’s important commands in my previous post. This post is all about how to configure VLAN Trunk and its important command.
Before configuring VLAN Trunk, we have to set up the network. Such as assigning IP Address to all the available PCs, creating VLAN and assigned name. We are going to configure VLAN Trunk according to the below-given diagram.
How to configure VLAN Trunk
Let’s configure VLAN Trunk in switch 1
(Note: Text in blue are the output, text in black are the command we have used and text in green are the definition of command)
Switch>en (Enabling privileges mode)
Switch#conf t (Enabling configuration mode)
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10 (Creating VLAN)
Switch(config-vlan)#name production (Assigning VLAN name)
Switch(config-vlan)#vlan 20 (Creating VLAN)
Switch(config-vlan)#name sales (Assigning VLAN name)
Switch(config-vlan)#exit
Switch(config)#int f0/1 (Selecting fast ethernet port 1)
Switch(config-if)#switchport access vlan 10 (Adding port 1 to VLAN 10)
Switch(config-if)#int f0/2 (Selecting fast ethernet port 2)
Switch(config-if)#switchport access vlan 20 (Adding port 2 to VLAN 20)
Switch(config-if)#int f0/3 (Selecting fast ethernet port 3)
Switch(config-if)#switchport mode trunk (Configuring the port as Trunk. This port is connected to another switch)
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
Switch(config-if)#exit
Switch(config)#exit
Switch#
%SYS-5-CONFIG_I: Configured from console by console
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#do copy run start (Save Router configuration)
Destination filename [startup-config]?
Building configuration…
[OK]
Switch(config)#
Let’s configure VLAN Trunk in switch 2
Follow the same steps and run the same command on switch 2.
Now, try to ping PC in VLAN 10 on switch 1 to PC in VLAN 10 on switch 2 and ping PC in VLAN 20 on switch 1 to PC in VLAN 20 on switch 2. They must be able to ping. You can also configure the network in such a way that two different VLAN can communicate with each but for that, you need a layer 3 device such as a router. and this process is called inter VLAN routing.
Download the packet tracer project on VLAN Trunk