Vlan Tagging at Access Port in Switch
switchport trunk encapsulation dot1q
does not apply to access mode ports.
Vlan Tags are only pushed on the packet if it comes in untagged and egresses a trunk port; otherwise, the packet's vlan is simply tracked internally in the switch. Packets ingress to an access vlan port are tagged with that same vlan on the trunk port. The only exception is a packet that is on the trunk port's native vlan (default, vlan 1 on Cisco switches)
This answer on stackoverflow should clarify
The statement
switchport trunk encapsulation dot1q
is needed (on some) cisco switches to explicitly set the trunking mode as there are switches where ISL trunking is also available. On other (mostly smaller desktop) switches it produces an error (because dot1q is the only trunking mode there).
When you set the port to trunk mode with
switchport mode trunk
statements like
switchport trunk ....
comes to play
When the port is in access mode with:
switchport mode access
statements like
switchport access ...
comes to play.
One can easily check port settings with:
show running-config interface f0/1
EDIT: Beware as other vendors use different terminology.
On HP trunking = port aggregation.
On Cisco etherchannel = port aggregation.