Port configurations on Cisco Catalyst switches

AID: 3600
  • Status: Published

3717 points

  • ByKvistofta
  • TypeTutorial
  • Posted on2010-08-20 at 13:45:51
Awards
  • Community Pick
I see many questions here on Experts Exchange regarding switch port configurations and trunks. This article is meant for beginners in the subject to help to get basic knowledge about Virtual Local Area Network (VLAN) and port-configurations in Cisco Catalyst switches.

An Ethernet-frame (packet) can be either tagged or untagged. The default is untagged. When a frame is tagged, an extra 802.1q header is placed first in each frame, containing a VLAN id, a number normally between 1 and 2004. Each VLAN is a separate broadcast domain and should use different IP network addressing. As you probably know, a switch cannot pass traffic between different VLANs.

A switch port can be configured either as an access port or as a trunk. An access port sends and receives traffic to/from one single VLAN, untagged. This is the normal thing for connecting PCs and other non trunk-aware equipment into a switch. The default configuration for a switch port is to be configured as an access port in VLAN 1. It looks like this:
Interface FastEthernet0/1
 switchport mode access (default, invisible)
 switchport access vlan 1 (default, invisible)
!
                                    
1:
2:
3:
4:

Select allOpen in new window



In case of connecting non trunk-aware equipment to another VLAN than default VLAN 1, this is specified with the switch port "access vlan" command which is now visible:
Interface FastEthernet0/1
 switchport mode access (default, invisible)
 switchport access vlan 2
!
                                    
1:
2:
3:
4:

Select allOpen in new window



To configure a trunk, change the switch mode to trunk. The default is to carry all VLANs.
Interface FastEthernet0/1
 switchport mode trunk
 switchport trunk allowed vlan 1-2004 (default, invisible)
!
                                    
1:
2:
3:
4:

Select allOpen in new window



To filter which VLANs should be available on the trunk, add the "allowed vlan" command:
Interface FastEthernet0/1
 switchport mode trunk
 switchport trunk allowed vlan 1,5-7,9
!
                                    
1:
2:
3:
4:

Select allOpen in new window



In case of reconfiguring a trunk port to an access port or vice versa there can be "unused" configuration lines left in the config. For example:
Interface FastEthernet0/1
 switchport mode trunk
 switchport trunk allowed vlan 1,5-7,9
 switchport access vlan 2 (not in use since the port is in trunk mode)
!
                                    
1:
2:
3:
4:
5:

Select allOpen in new window


or:
Interface FastEthernet0/1
 switchport mode access (default, invisible)
 switchport trunk allowed vlan 1,5-7,9 (not in use since the port is configured as an access port)
!
                                    
1:
2:
3:
4:

Select allOpen in new window



Do always first look in the port configuration if it is configured as an access port or a trunk port so that you know which of the other commands in the commands that are in use.

In case of a trunk port frames on all VLANs are sent as tagged, with the VLAN id attached to the frame. One exception for this is the "native VLAN". By default VLAN 1 is the native VLAN and is sent untagged. This can be changed with the "switch port trunk native vlan x" command. Obviously, though, there can only be one native VLAN configured on each port.
Interface FastEthernet0/1
 switchport mode trunk
 switchport trunk allowed vlan 1,5-7,9
 switchport trunk native vlan 6
!
                                    
1:
2:
3:
4:
5:

Select allOpen in new window



In the configuration above, frames from VLAN 1, 5, 7 and 9 are sent tagged with respective VLAN id while frames from VLAN 6 are sent without a tag.

Asked On
2010-08-20 at 13:45:51ID3600
Tags

cisco

,

switch

,

vlan

,

802.1q

,

trunk

,

tagged

,

untagged

,

native

Topic

Network Switches & Hubs

Views
2128

Comments

Add your Comment

Please Sign up or Log in to comment on this article.

Join Experts Exchange Today

Gain Access to all our Tech Resources

Get personalized answers

Ask unlimited questions

Access Proven Solutions

Search 3.2 million solutions

Read In-Depth How-To Guides

1000+ articles, demos, & tips

Watch Step by Step Tutorials

Learn direct from top tech pros

And Much More!

Your complete tech resource

See Plans and Pricing

30-day free trial. Register in 60 seconds.

Loading Advertisement...

Top Switches / Hubs Experts

  1. nazsky

    98,200

    Master

    0 points yesterday

    Profile
    Rank: Wizard
  2. TimotiSt

    74,882

    Master

    1,000 points yesterday

    Profile
    Rank: Master
  3. donjohnston

    74,477

    Master

    3,236 points yesterday

    Profile
    Rank: Genius
  4. eeRoot

    68,515

    Master

    0 points yesterday

    Profile
    Rank: Wizard
  5. giltjr

    43,400

    0 points yesterday

    Profile
    Rank: Genius
  6. Soulja

    41,765

    1,000 points yesterday

    Profile
    Rank: Genius
  7. mat1458

    40,360

    0 points yesterday

    Profile
    Rank: Master
  8. fgasimzade

    39,268

    0 points yesterday

    Profile
    Rank: Wizard
  9. Netty

    33,192

    0 points yesterday

    Profile
    Rank: Guru
  10. hanccocka

    31,488

    0 points yesterday

    Profile
    Rank: Genius
  11. RKinsp

    24,901

    0 points yesterday

    Profile
    Rank: Master
  12. jodylemoine

    20,900

    0 points yesterday

    Profile
    Rank: Sage
  13. craigbeck

    17,704

    0 points yesterday

    Profile
    Rank: Sage
  14. erniebeek

    17,336

    0 points yesterday

    Profile
    Rank: Genius
  15. mattvmotas

    17,225

    0 points yesterday

    Profile
    Rank: Sage
  16. Rick_O_Shay

    17,198

    0 points yesterday

    Profile
    Rank: Sage
  17. ikalmar

    16,244

    0 points yesterday

    Profile
    Rank: Genius
  18. ArneLovius

    16,132

    0 points yesterday

    Profile
    Rank: Wizard
  19. gsmartin

    14,001

    0 points yesterday

    Profile
    Rank: Master
  20. rigan123

    13,259

    0 points yesterday

    Profile
    Rank: Guru
  21. lrmoore

    11,882

    0 points yesterday

    Profile
    Rank: Savant
  22. Kvistofta

    11,358

    10 points yesterday

    Profile
    Rank: Sage
  23. jburgaard

    11,300

    0 points yesterday

    Profile
    Rank: Wizard
  24. agonza07

    10,907

    1,500 points yesterday

    Profile
    Rank: Master
  25. lruiz52

    10,500

    0 points yesterday

    Profile
    Rank: Guru

Hall Of Fame