In Cisco Catalyst switches, each switchport can be set to different VLAN Membership modes using the "switchport mode" command. This sets the port unconditionally.
The different modes include
"access" – Sets the port to access mode (static-access or dynamic-access). Thiss unconditionally sets the port as an "Access port" and a nontrunking, single VLAN interface. This disables "Dynamic Trunking Protocol (DTP)" on the switchport.
"trunk" – Set the port to trunk mode, as a trunking VLAN Layer 2 interface.
"dynamic auto" – Sets the interface to Dynamic trunking mode and runs "Dynamic Trunking Protocol(DTP)". It will automatically convert the link into a trunk if connected to a switchport with "mode dynamic desirable" or a switchport in "Trunk" mode.
"dynamic desirable" – This is the default mode a switchport is set. Sets the interface to Dynamic Trunking and runs DTP. It will form a trunk when connected to a switchport in "dynamic (auto or desirable)" or trunk mode.
The command syntax is
ciscoswitch(config-if)# switchport mode <access/trunk/dynamic[desirable/auto]>
For example, to set the port to Access mode
ciscoswitch(config-if)# switchport mode access
To set a port to Trunk but disable DTP
ciscoswitch(config-if)# switchport mode trunk
ciscoswitch(config-if)# switchport mode nonegotiate