8

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??

5 Answers 5

17

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.

8
  • 1
    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
    Commented May 16, 2014 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. Commented May 16, 2014 at 17:49
  • @YLearn Auto-to-auto doesn't become trunk it means any chance to became access
    – Trojan
    Commented Oct 9, 2014 at 13:11
  • @Trojan, could you clarify your comment? Specifically, what do you mean "auto-to-auto" and "it means any chance to became access"? If you are referring to the configuration of DTP, that wasn't within the scope of the question or answer, but yes in DTP auto-auto will not negotiate as a trunk. Typically if someone were to be using DTP, they would configure the ports to be in desirable mode.
    – YLearn
    Commented Oct 9, 2014 at 14:54
  • 1
    @Trojan, when you use DTP, the port is in access mode by default, and only becomes trunk when negotiated. So an auto-auto link wouldn't negotiate as a trunk and would run as an access port.
    – YLearn
    Commented Oct 10, 2014 at 2:09
6

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
2

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

1

It can be removed, although I would recommend specifying a native vlan and an encapsulation protocol on both sides of the link to keep it proper and error free!

0

I agree with all answers up there. In addition, you can do "show vlan brief" to see if interface GigabitEthernet1/0/3 is on vlan 100.

You wouldn't see that. Because of "switchport mode trunk" config on the port. So negotiation is not working on the port.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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