Switchport Access Mode vs Trunk Mode

Switchport Access Mode vs Trunk Mode

What is Access 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#

What is Trunk Mode

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.

Creating VLANs on Switches

Access Mode vs Trunk Mode
Access Mode vs Trunk Mode


Switch 1

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

VLANs
Show VLANs

SW1# vlan database

VLAN
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#

Configuring Access VLAN on Switch 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
Access VLAN


Switch 2

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

VLAN
Show VLAN

SW2# vlan database

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#

Configuring Access VLAN on Switch 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
Access VLAN


Make both Switches as a Trunk

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.

Switch 1

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
Trunk Mode Status

SW1 (config-if) #end

SW1#

Switch 2

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#

Trunk Mode Status

SW1#show interfaces trunk

Trunk Mode
Trunk Mode Interfaces Status

SW2#show interfaces trunk

Trunk Mode
Trunk Mode Interfaces Status


Ping Verification PC 1, PC 2 to PC 7, PC 8

PC 1

PC>ping 192.168.1.7

Ping Verification
Successful Ping Verification

PC>ping 192.168.1.8

Ping Verification
Successful Ping Verification

PC 2

PC>ping 192.168.1.7

Ping Verification
Successful Ping Verification

PC>ping 192.168.1.8

Ping Verification
Successful Ping Verification

Ping to Other VLANs PCs

PC 1

PC>ping 192.168.1.9

Ping Verification
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

Running-Config
Show Running-Config
Running-Config
Show Running-Config


Search Tags

  1. How do I know if my port is trunk or access?
  2. Trunk port vs access port
  3. What is the difference between Switchport mode access and trunk?

Get Packet Tracer Lab

Post a Comment

0 Comments