cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
618
Views
4
Helpful
4
Replies

Switchport Access and Switchport Trunk in a single port

pinoybot
Level 1
Level 1

Hello Gurus,

I encountered a really confusing config/problem.

interface GigabitEthernet1/0/5
switchport access vlan 5
switchport trunk native vlan 5
switchport mode trunk
spanning-tree portfast

I noticed that this config is sitting on one of the switch and I'm totally confused. 
Why in the world there's an access setting and a trunk. The port is a trunk right now, and the (virtual) host connected to this port has a 10.10.5.5 address (10.10.5.0/24). Everytime I change the IP to a different subnet/vlan example vlan 10 (10.10.10.0/24), I'd encounter an error....

10.10.5.5 works / 10.10.10.5 fails


To try fixing the problem, I've added this line:

switchport trunk allowed vlan 10 (I can try adding vlan 5, but I wanted to understand what's happening first)

Once I add this line the port stopped working.

I don't really know why it's even working right now. I understand it will work on vlan 5 because it's my 10.10.5.0/24 subnet, but the port is a trunk (can somebody help me understand this pleaseee).

Last one, is this line even necessary? 
switchport trunk native vlan 5

Any comment will be much appreciated. Thank you all!


 

 

4 Replies 4

balaji.bandi
Hall of Fame
Hall of Fame

if this is trunk you need to remove below line :

switchport access vlan 5

 

add 5 and 10 VLAN in the Trunk for this to work as expected :

switchport trunk allowed vlan 5,10

If you are using native vlan other than 1, then you need vlan 5 as native vlan

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Technically this is a misconfiguration. But it does not have any impact on switch operation. I have seen this type of situation on many switches but not any problem when it is configured. A switch port can not be both an access port and a trunk port. When a switch port has both config statements as access and trunk it operates as trunk and ignores the access port configuration. If you want to clean it up remove the access vlan 5 statement. But if you just let it continue as it it will work just fine.

HTH

Rick

Switchport mode trunk 

This will override any access mode config'

And you config native vlan 5 and you dont config any allow.

So the port will allow all vlans' and native is vlan 5.

If your device now connect and send non tag frame the SW assume it vlan 5 and assign IP from vlan 5 pool.

Joseph W. Doherty
Hall of Fame
Hall of Fame

As already described by others, you can have a port configured as an access port AND trunk port, and if so, port operates as a trunk port.

From what you posted, at least in regard to VLAN 5, port would operate very much the same way as access port VLAN 5 OR trunk port with VLAN 5 being native VLAN.

As to the unexpected issues you describe, cannot say for sure what the cause is because what you describe doing is not detailed.

Review Cisco Networking for a $25 gift card