Take the 2-minute tour ×
Network Engineering Stack Exchange is a question and answer site for network engineers. It's 100% free, no registration required.

Googling around to see if this setup on one port is correct (it doesn't look right to me), I'm not really seeing a straightforward answer.

There is an interface with the following configuration:

!
interface GigabitEthernet1/0/3
 description Uplink to Server Room
 switchport access vlan 100
 switchport mode trunk
!

That's been like that for some time, and no issues that I know of. The question is, if the port is in trunk mode as opposed to access mode, then does the switchport access vlan do anything at all?? Can it be safely removed without screwing up something else? What possible reason could those two commands be there in the first place for??

share|improve this question

3 Answers 3

up vote 4 down vote accepted

No this isn't doing anything. When the port is in trunk mode, then any "switchport access" statements are not used. The same is true with a port in access mode with any "switchport trunk" statements.

In this case, you should be able to safely remove it.

The purpose for this is usually in the use of DTP (dynamic trunking protocol). So you could configure a port as both a trunk (with "switchport trunk" statements) and an access port (with "switchport access" statements). When the link negotiates as a trunk, it will have the correct trunk configuration and if it doesn't negotiate as a trunk, it will have the correct access configuration.

When DTP is not used, there is little point to it. I personally have this configured on some of my lab ports, so I can just switch the switchport mode depending on what I am conneting on the ports.

Often in the wild, I have found this type of configuration where devices are staged using access ports and then never cleaned up when it is configured to use a trunk port when deployed.

share|improve this answer
    
Indeed. I have ports like that as well, so they can be switched between trunk and access without any other changes. However, it's very common to see access ports re-tasked for trunks without cleanup or proper configuration. (mode truck without additional configuration is a mess waiting to happen.) –  Ricky Beam May 16 at 16:31
    
Thanks for the explanation of why it might be configured as such. This particular setup has no DTP in use, so I've removed the access vlan statement and everything is still humming along. Thanks. –  PenguinCoder May 16 at 17:49

If you use the port as trunk you can safely remove the switchport access vlan 100 line.

If you set the "mode trunk" in fact the port act as a trunk, the "switchport access vlan 100" still in the configuration doesn't affect the operational mode of the port.

To view details on the operational mode of your port try:

show interfaces GigabitEthernet 1/0/3 switchport
share|improve this answer

Trunk ports pass all vlan data unless otherwise specified within the Switchport Mode Trunk command. So at this point, the switchport access command does nothing. If the user who configured this switch had the intention of limiting the data that passed through this trunk to only 1 vlan, he or she should have used Switchport Trunk Allowed Vlan 100

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.