cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
81874
Views
92
Helpful
30
Replies

Can switch port be "access" and "trunk" at a time?

Ashok Basapure
Level 1
Level 1

We have following config on one of corporate switch.
Is it Ok to configure access and trunk on same switch port?

Below is the config.

interface GigabitEthernet0/3
 switchport access vlan 166
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 16,58,59,160-163,166,204
 switchport mode trunk
 speed 1000
 spanning-tree portfast
end

 

30 Replies 30

Hello Inayath,

Thanks for detailed information.

 Above cnofiguration was pre-configured and it is production. While troubleshooting for slowness issue I obsereved that server is connected to this switch port and we saw above config on the port.

Thanks

Ashok

Ashok

 

Almost certainly the configuration of the interface with both access port characteristics and trunk characteristics is not causing the slowness issue. While you might want to remove the extra commands as a matter of good management (simplified config is almost always better) they are not impacting performance of the interface. And while have both access port and trunk port config on the interface may be somewhat confusing for humans reading the config there is not an impact of the switch of having these.

 

HTH

 

Rick

HTH

Rick

Hi Richard,

What need to be configured on a switch  to connect a Server to it?

Which one is better to configure in switch port? Access or Trunk?

Kindly advise?

If that configured as Access port will it cause flapping?

Thanks

"What need to be configured on a switch  to connect a Server to it?"

It depends on the server.

Some servers running VMware ESX-i may need to be Trunk ports as they host multiple virtual machines so the network cards are capable of tagging frames. Stand alone servers running a single operating system can be access ports in whichever Vlan their IP address is part of.

"Which one is better to configure in switch port? Access or Trunk?"

Its not a case of which one is better, its dependent on the requirements. An Access Port is a single vlan, designed for end hosts like servers, PC's, printers etc. A Trunk Port is designed to pass traffic for multiple vlans, usually a connection between Layer 2 switches.

"If that configured as Access port will it cause flapping? 

Not sure what you mean by this, the original post was about having a port configured as a Trunk  and an Access Port. If your question is related to this then no, it will not cause flapping. The port has been statically configured as a Trunk so that is what it will be, the Access commands are redundant. 

Hi Thank you.

               You made me clear on Access or Trunk ,depends requirement.

Clarify me the below also,

Switches only send/Receive BPDU as I knew it before.

So a server connected to a switch port ,will that port receive BPDU from server?

switch port           connected to              receive BPDU

Access                 Server                         Yes/No

Trunk                     Server                         Yes/No

or it's depends on any protocols ?

Thankyou

No, a server will not send a BPDU.

BPDU's are only sent by devices which are STP capable, which servers are not.

I would recommend having a read of the Cisco Press CCNA R&S book, its very detailed and will clear up and confusion you have. 

> No, a server will not send a BPDU.

This assumption is not always valid. A VM-host could run a virtual switch that speaks Spanning-Tree. Perhaps not that common, but possible.

Fair point, I guess my reply was based on the fact that by default a server would not send a BPDU.

The poster was asking about the difference between an Access and a Trunk port so I didn't want to confuse him/her by going into detail about a configuration which is not very common. 

Hi vasanth77

An access port receives untagged traffic and assigns a specific vlan to ALL traffic flowing over that port.  Access ports are best when attaching a host directly to a switch.  They are nice because not all hosts have the ability to do 802.1q vlan tagging, and it saves configuring vlan tagging on every host.

Trunking ports receive vlan tagged traffic (with one exception) and allows for forwarding of traffic from multiple vlans.  Vlan tagging must be done at the host however.  

The exception is the switchport trunk native vlan xxxx where "xxxx" is the vlan number.  The switchport trunk native command allows for untagged traffic to be assigned a vlan tag as if it were connected to an access port.  By default, the native vlan is vlan 1.

I would use access ports unless you need to forward traffic from multiple vlans over a single port. ESXi uplinks are a good example of a scenario where trunking will likely need to be configured.  When interconnecting multiple switches or connecting a router to the switch, you'll probably also want to configure trunking.

Hope this helps!

Tagir Temirgaliyev
Spotlight
Spotlight

please copy paste here

sh interface GigabitEthernet0/3  switc

sh run all | b interface GigabitEthernet0/3

Hello ttemirgaliyev,

Below are the details.

sw27#sh int gi0/3 switc
Name: Gi0/3
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 166
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: enabled
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk Native VLAN tagging: enabled
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk associations: none
Administrative private-vlan trunk mappings: none
Operational private-vlan: none
Trunking VLANs Enabled: 16,58,59,160-163,166,204
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL

Protected: false
Unknown unicast blocked: disabled
Unknown multicast blocked: disabled
Appliance trust: none
sw27#


sw27#sh run | begin interface GigabitEthernet0/3
interface GigabitEthernet0/3
 switchport access vlan 166
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 16,58,59,160-163,166,204
 switchport mode trunk
 speed 1000
 spanning-tree portfast
!

sw27#

okay to summarize you are seeing slowness issue accesing the server connected to this port on this switch.

 

Few things to check:

1- how many servers are connected to this device?.

2- Are all servers having this issue or only 1 server?

3- What do you mean by slow access to the server( I mean application issue or Server pinging to any other network)?

4- Can you check if the interface status:

show int g0/3

show int g0/3 counters errors /details

show queuing interface G0/3

show counter int g0/3

show proc cpu sorted | ex 0.00

 

Regards

Inayath

I notice in the configuration that you are setting the speed of the port but not the duplex. That sometimes results in the interface operating in half duplex mode, which can certainly cause performance problems. What does the output of show interface say about duplex? I would suggest that if you are going to hard code speed that you also hard code the duplex.

 

HTH

 

Rick

HTH

Rick

Hello,

I have little similar problem with access ports ant trunks.

The problem is that one port is sometimes used as acces port with vlan 60 and sometimes is used to connect different pc with trunk enabled vith vlan 70. The goal use port one case in access mode and in the other case as trunk port.

The configuration of port

 

interface GigabitEthernet1/0/10
  switchport access vlan 60
  switchport trunk allowed vlan 70
  switchport mode trunk
end

 

Thx for help.

Sameh Hamdy
Cisco Employee
Cisco Employee

It's ok to configure the port in trunk and access but that doesn't mean the port will be working as a trunk and access at the same time. since  "switchport mode trunk" cmd is issued then the switchport will be negotiated as a trunk and the cmd  switchport access vlan 166 will have no effect.

Also it's not recommended to configure port fast feature for a trunk as it may cause loops when used on trunks between switches.

If this trunk is going to a pc or end user then the command that willwork with the trunk is the 'spanning-tree portfast trunk'

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card