Switchport Access Mode vs Trunk Mode
A port by default is in access mode and that port carries traffic only for the VLAN to which it is assigned. .In a single VLAN, the access port is a user port that disables port trunk mode and to converts the link into nontrunk, it negotiates with the connected devices. It belongs only to access VLANs that are configured. Assign the port or range of ports into access ports use the switchport access vlan command.
Switch> enable
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch (config) #interface fa0/12
Switch (config-if) #switchport mode access
Switch (config-if) #switchport access vlan 1
Switch (config-if) #end
Switch#
A port can carry traffic for multiple
VLANs in a trunk mode. The trunking port negotiates trunking with the other end
of the port link. The port is configured to permanent trunk mode and with the
connected device; it negotiates on the other side to convert the link to trunk
mode. The encapsulation must be chosen if there are multiple trunk
encapsulations available.
Access Mode vs Trunk Mode |
Switch> enable
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch (config) #hostname SW1
SW1 (config) #end
SW1#show
VLAN
Show VLANs |
SW1# vlan database
VLAN Database |
SW1 (vlan) #vlan 2
SW1 (vlan) #vlan 2 name IT
VLAN
2 added:
Name: IT
SW1 (vlan) #vlan 3 name Business
VLAN
3 added:
Name: Business
SW1 (vlan) #vlan 4 name Urdu
VLAN
4 added:
Name: Urdu
SW1 (vlan) #exit
APPLY
completed.
Exiting...
SW1#
SW1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW1
(config) #interface range fa0/1-2
SW1 (config-if-range) #switchport mode access
SW1 (config-if-range) #switchport access vlan 2
SW1 (config-if-range) #exit
SW1
(config) #interface range fa0/3-4
SW1 (config-if-range) #switchport mode access
SW1 (config-if-range) #switchport access vlan 3
SW1 (config-if-range) #exit
SW1
(config) #interface range fa0/5-6
SW1 (config-if-range) #switchport mode access
SW1 (config-if-range) #switchport access vlan 4
SW1 (config-if-range) #end
SW1#show vlan
Access VLAN |
Switch> enable
Switch# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch (config) #hostname SW2
SW1 (config) #end
SW2#show
vlan
Show VLAN |
SW2# vlan database
VLAN Database |
SW2 (vlan) #vlan 2
SW2 (vlan) #vlan 2 name IT
VLAN
2 added:
Name: IT
SW2 (vlan) #vlan 3 name Business
VLAN
3 added:
Name: Business
SW2 (vlan) #vlan 4 name Urdu
VLAN
4 added:
Name: Urdu
SW2 (vlan) #exit
APPLY
completed.
Exiting...
SW2#
SW1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW2
(config) #interface range fa0/1-2
SW2 (config-if-range) #switchport mode access
SW2 (config-if-range) #switchport access vlan 2
SW2 (config-if-range) #exit
SW2
(config) #interface range fa0/3-4
SW2 (config-if-range) #switchport mode access
SW2 (config-if-range) #switchport access vlan 3
SW2 (config-if-range) #exit
SW2
(config) #interface range fa0/5-6
SW2 (config-if-range) #switchport mode access
SW2 (config-if-range) #switchport access vlan 4
SW2 (config-if-range) #end
SW2#show vlan
Access VLAN |
After making both
switches trunk only the specific same VLAN on both switches will communicate with
each other. For example, IT VLAN 2 will
only communicate on the other switch VLAN
2 name IT, and other VLAN will communicate as like this and so on.
SW1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW1 (config) #interface
fastEthernet 0/24
SW1 (config-if) #switchport mode trunk
SW1 (config-if) #
Trunk Mode Status |
SW1 (config-if) #end
SW1#
SW2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW2
(config) #interface fastEthernet 0/24
SW2 (config-if) #switchport
mode trunk
SW2 (config-if) #end
SW2#
SW1#show
interfaces trunk
Trunk Mode Interfaces Status |
SW2#show
interfaces trunk
Trunk Mode Interfaces Status |
PC>ping
192.168.1.7
Successful Ping Verification |
PC>ping
192.168.1.8
Successful Ping Verification |
PC>ping
192.168.1.7
Successful Ping Verification |
PC>ping
192.168.1.8
Successful Ping Verification |
PC>ping
192.168.1.9
Unsuccessful Ping Verification |
Note: The ping was not successful because the
destination address was not listed in the same VLAN so, the ping can be
successful in the same VLAN like IT VLAN PCs can communicate with each
other on both switches, and Business LAN
PCs can communicate with each other on both switches and Urdu VLAN PCs can.
Ping other VLAN PCs of Switch to Switch 2 VLAN
PCs same as above ping mentioned.
SW1# show
running-config
Show Running-Config |
Show Running-Config |
Search Tags
- How do I know if my port is trunk or access?
- Trunk port vs access port
- What is the difference between Switchport mode access and trunk?
0 Comments