Connect a Switch to a VLAN (Cisco)

Problem

Connect a switch to an already existing VLAN

tl;dr

Create a VLAN on the switch with the same VLAN ID/number as the one you wish to connect to:

conf t
vlan 100
name marketing

Create a trunk interface on both switches:

int fa0/32
description VLAN-trunk
switchport mode trunk
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 100
switchport nonegotiate

Solution

If you wish to span a VLAN over more than one switch, you need to do two things: a) connect the switches together, and b) make the interface connecting them a trunk.

Add the VLAN to the switch

When you are adding a switch to an already existing VLAN, the first step is the same as when creating a new VLAN:

conf t
vlan 100
name marketing

This adds VLAN 100 to the switch with the name marketing.

Create the trunk port

Assuming the switches are already wired together and connected on port 32, you will need to run the following commands (from configuration mode) on both switches:

int fa0/32
switchport mode trunk
switchport trunk encapsulation dot1q

This will allow the switch interface to carry traffic from all VLANs configured on the switch. However, best practices also suggest limiting traffic only to the configured VLANs, so run the following set of commands (while still in interface configuration):

switchport trunk allowed vlan 100
switchport nonegotiate

You may also wish to add a description to the trunk port so you know what it is used for and don't accidentally overwrite it:

description VLAN-trunk

Hosts on both switches should now be able to access the VLAN!

Save the configuration

Don't forget to exit configuration mode and save your changes!

end
wr


Was this article helpful?

mood_bad Dislike 0
mood Like 3
visibility Views: 4150