≡ Menu

How to Create VLAN Trunking on Cisco Catalyst Switch

If you have multiple switches that are part of a stack, then any VLAN you create on the master switch is available on all the switches in the stack.

However, if you have multiple switches that are not part of stack, and if you need to use the same VLAN between these two switches, you need to use VLAN trunking.

This tutorial explains how to configure VLAN trunking between two different switches.

1. Connect the Switches

First, to use VLAN trunking, you need to physically connect the switches using ethernet cable. In this example, I’ve used an ethernet cable to connect from Switch1:port24 to Switch2:port24

Switch1:port24 —> Switch2:port24

Depending on your bandwidth requirement, you can choose to even use two ports for VLAN trunking. i.e You can use both port23 and port24 connected between Switch1 and Switch2 using two ethernet cables.

2. Switch1 – Specify spanning-tree

In this case, let us assume that you have a VLAN 140 on Switch1, which you can trunk on Switch2 also.

Login to Switch1, and specify the spanning-treen on this particular VLAN 140 as shown below.

switch1(config)# spanning-tree vlan 140 root primary

3. Switch1 – Add to a Channel Group

Next, put the Switch1:port24 on a particular cisco etherchannel group. In this example, it is added to channel-group number 2.

# interface g1/0/24

(config-if)# channel-group 2 mode passive
Creating a port-channel interface Port-channel 2

The following are valid channel-group mode. If you want to use LACP, you can use either active or passive, if LACP is supported on your switch.

  • active Enable LACP unconditionally
  • auto Enable PAgP only if a PAgP device is detected
  • desirable Enable PAgP unconditionally
  • on Enable Etherchannel only
  • passive Enable LACP only if a LACP device is detected

4. Switch1 – Enable Switchport Trunk

Next, Enable trunking on this particular port-channel as shown below. In this example, I’m allowing VLAN 140 to be used between these two switches. So, you have to use “switchport trunk allowed vlan” and specify the VLAN number as shown below.

# interface port-channel 2

(config-if)# switchport trunk encapsulated dot1q

(config-if)# switchhport mode trunk

(config-if)# switchport trunk allowed vlan 140

If you are planning to allow more than one VLAN using this trunk between these two switches, you need to “add” those as shown below. Please note that if you specify without “add”, it will delete previous configuration and allow only this VLAN. So, in the following example, apart from the existing vlan 140, it will also allow vlan 150.

(config-if)# switchport trunk allowed vlan add 150

5. Switch1 – View Summary

As you see below, it shows that there is only one channel-groups defined on this switch. The Group number is displayed in the last line (i.e group number 2). It also specifies what port on this switch is part of this channel-group. In this example, port 24 is part of channel-group 2.

# sh etherchannel summary
Number of channel-groups in use: 1
Number of aggregators:           1

Group  Port-channel  Protocol    Ports
------+-------------+-----------+-----------------------------------------------
2      Po2(SD)         LACP      Gi1/0/24(D)

You can also view the interface status, which will show that port 24 is on VLAN trunk. Apart from that, this will also show Po2 (which the port-channel 2) that we created above.

# sh interfaces status

6. Switch2 – Add to a Channel Group

Now, login to Switch2, and put the Switch2:port24 on the same cisco etherchannel group that you set for Switch1. In this example, it is added to channel-group number 2. Since I know this switch supports LACP protocol, I set the mode to active. If you are not sure, you can set it to passive.

# interface g1/0/24

(config-if)# channel-group 2 mode active
Creating a port-channel interface Port-channel 2

7. Switch2 – Enable Switchport Tunk

Next, Enable trunking on this particular port-channel as shown below. In this example, I’m allowing VLAN 140 to be used between these two switches. So, you have to use “switchport trunk allowed vlan” and specify the VLAN number as shown below.

# interface port-channel 2

(config-if)# switchport trunk encapsulated dot1q

(config-if)# switchhport mode trunk

(config-if)# switchport trunk allowed vlan 140

If you are planning to allow more than one VLAN, use “add” as shown below.

(config-if)# switchport trunk allowed vlan add 150

If you’ve added a vlan by mistake to the trunk, you can use “remove” as show below to delete it from the trunk.

(config-if)# switchport trunk allowed vlan remove 150

8. Switch2 – View Summary

As you see below, it shows that there is only one channel-groups defined on this switch. The Group number is displayed in the last line (i.e group number 2). It also specifies what port on this switch is part of this channel-group. In this example, port 24 is part of channel-group 2.

# sh etherchannel summary

You can also view the interface status, which will show that port 24 is on VLAN trunk. Apart from that, this will also show Po2 (which the port-channel 2) that we created above.

# sh interfaces status
...
Gi1/0/24           connected    trunk      a-full a-1000 10/100/1000BaseTX
Po2                connected    trunk      a-full a-1000
Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • John September 20, 2013, 8:16 am

    Can I use the same method for VLAN trunk between two cisco-switch-stack?

  • Biswajit September 23, 2013, 4:03 am

    I think L2 switches do not support EtherChannel !!!

  • Biswajit September 23, 2013, 4:06 am

    1. Create VLANs on switches.
    2. Add ports to respective VLANs.
    3. Configure the trunk ports.

  • Bill September 23, 2013, 9:48 pm

    Thank you! Very helpful to me!

  • Janci September 23, 2013, 10:55 pm

    Biswajit: L2 switch for example Cisco Catalyst 2960 have support EtherChannel.