Trunking: VLAN trunking from the ground up
To understand Trunking, We need to understand VLANs. VLANs were created to solve some problems that accompanied the expansion of Ethernet LAN networks
A switch simply serves the purpose of connecting devices together into a LAN, which works well for small offices.
However, as an organization expand, different departments might need to be physically separated into separate LANs i.e. each department given its own switch, then interconnected by mesh or a central switch.
This separation and interconnection creates problems such as:
- One huge broadcast domain. e.g. broadcast messages meant for a certain department/LAN floods out to all departments
- Zero confidentiality between departments
- Constant rewiring when users move to different departments
- Expensive networking cabling
So how are VLANs useful:
Instead of the switch a user was connected to determining which LAN they belonged to, VLANs allowed administrators to organize devices into logical groups. This made it possible for devices plugged to different switches, offices, or floors to be grouped into the same LAN, regardless of their physical location.
Example on a single switch — — Same switch, different VLANs
Port 1 → Finance → VLAN 10
Port 2 → HR → VLAN 20
Port 3 → Finance → VLAN 10
Port 4 → Engineering → VLAN 30
Switchports on switches in different rooms can also be configured to belong in the same VLAN e.g. A member of the Finance department may move and resume on a PC on opposite sides of the building, with the new PC assigned to a port on a different switch, yet remain in the same VLAN.
To implement VLANs and enhance network security and segmentation
Firstly, we need to configure as many VLANs as needed on each switch
Suppose we need 3 VLANs, what we need to do is to configure 3 VLANs on all switches.
VLAN 10 — — — — HR
VLAN 20 — — — — Marketing
VLAN 30 — — — — Sales
To do this, we access the CLI of each switch via the console port and type in certain commands
1. enable to enter the privilege exec mode
2. Configure terminal to enter the global configuration mode of the switch
3. vlan 10 to create a vlan with the ID 10,
command 3 gives entry into the vlan configuration submode and creates a VLAN of the specified ID
4. name HR, to name it
5. vlan 20 — — to create a VLAN with ID 20 and switch to it’s configuration
6. name Marketing — — — to name it
Get Daniel Kayode’s stories in your inbox
Join Medium for free to get updates from this writer.
7. vlan 30 — — to create a VLAN with ID 30
8. name Sales — — — to name it.
Now repeat for all other switches in the interconnection
Cisco understands a task such as VLAN creation is very repetitive. Hence, once you’re in one VLAN configuration mode on a particular switch, denoted by (config-vlan)# you are allowed to create and configure multiple VLANs consecutively without needing to use the exit command before moving to the next VLAN.
To view and verify our vlan configurations, we need to exit into the monitoring modes. then run;
show vlan brief
This displays all configured vlans with the assigned name and id.
Here’s an helpful table to know which mode you’re in
We have only successfully configured the VLANs on each switch, we need to assign switch ports to them.
On switch1, navigate from the user exec mode to global configuration mode, to enter Interface Configuration mode
run:
interface FastEthernet0/1(or whichever port you want to configure first)
Note: The interface does not need to have a device connected. You can configure both occupied and vacant interfaces. This command moves us into interface configuration submode and also selects the interface to configure. And we have to determine which mode we want the switchport of the interface to be, some of the options are access, trunk, dynamic auto etc. To choose access, which provides access to one VLAN per port
run;
2. switchport mode access
then finally we assign a VLAN to the switchport by running
3. switchport access vlan 10
4. exit
and repeat for all other interfaces, specifying which VLAN vlan-id you want to assign to the switchport
After assigning switchports to VLANs, we need to configure a means for VLAN traffic to be forwarded out of the switch
VLAN traffic can be forwarded using a separate cable for each VLAN. For example, if Fa0/4 on Switch 1 is in access mode and belongs to VLAN 10, VLAN 10 traffic from other ports on Switch 1 can be forwarded through Fa0/4
However, this approach requires a separate physical connection for each VLAN. A better approach is trunking.
A switchport configured into trunk mode can carry traffic for multiple VLANs between switches over a single physical cable.
To configure a trunk,
- Select an interface which traffic from all other port flow out of by running;
interface fa0/24
2. Select the switchport mode by running
switchport mode trunk
3. Select the vlans allowed in the trunk.
switchport trunk allowed vlan 10,20,30
The trunk link now allows VLAN 10, VLAN 20, and VLAN 30 traffic to travel between the two switches over a single physical cable. This eliminates the need for a separate physical connection for each VLAN while keeping the VLANs logically separated across the switches.
Congratulations youngin, You have successfully created VLANs and configured a trunk link to carry them between switches, all in one Lab.





