Showing posts with label Trunk. Show all posts
Showing posts with label Trunk. Show all posts

Tuesday, September 8, 2020

Native VLAN - Demo

 Usually, for a multi-VLAN network the PCs are connected to 'access' ports of the switch.  Instead of 'access' port, we use the combination of 'trunk' port and 'native-vlan'.

Trunk port - Port in switch where VLAN-tagged packets will pass through.
Native VLAN - Packets passing through the port that belongs to Native VLAN Id will have no-VLAN tagging.

Steps usually will be

  1. Create VLANs in the switch that will be used.(vlan x)
  2. Assign vlan id as Native VLAN to the port(switchport trunk native vlan x)
  3. Allow the same vlan id in the port(switchport trunk allowed vlan x)
  4. If there is a switch on the other side of the link, it should also have same native vlan id.  Else port will be blocked by STP.
We use the following topology:


VL20-1 and VL20-2 are separated by series of switches.  VL20-1, connected to Trunk port having native vlan 20.  VL20-2 is connected to access port of vlan 20.

VL30-1 and VL30-2, belonging to VLAN 30, separted by couple of switches.  VL30-1, connected to Trunk port having native vlan 30.  VL30-2 is connected to access port of vlan 30.

Lets go through the configurations of switches one by one. Starting with 

Switch4

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 20
Switch(config-vlan)#ex
Switch(config)#vlan 30
Switch(config-vlan)#ex
Switch(config)#int fa0/2
Switch(config-if)#switchport mode access 
Switch(config-if)#switchport access vlan 20
Switch(config-if)#no shut
Switch(config-if)#ex
Switch(config)#int fa0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 30
Switch(config-if)#ex
Switch(config)#int fa0/3
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 20,30
  • Creating VLAN (Lines 3 to 6)
  • Making Ports fa0/2 and fa0/1 as access ports to vlan 20 and 30 respectively(Lines 8 to 15)
  • Making Port fa0/3 as Trunk port allowing vlans 20 and 30(Lines 16 to 19)

Switch6

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
Switch(config)#vlan 20
Switch(config-vlan)#ex
Switch(config)#vlan 30
Switch(config-vlan)#ex
Switch(config)#int fa0/2
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 20
Switch(config-if)#ex
Switch(config)#int fa0/1
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 20,30
Switch(config-if)#ex
Switch(config)#int fa0/3
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk native vlan 30
Switch(config-if)#switchport trunk allowed vlan 30
  • Create VLANs 20 and 30, as both are used in this switch(Lines 1 to 4)
  • Make fa0/2 as Trunk to pass vlan 20 from Switch5(lines 5 to 9)
  • Make fa0/1 as Trunk to pass vlans 20 and 30 to and from Switch4 (Lines 10 to 14)
  • Make fa0/3 as Trunk, to allow vlan30 as Native vlan(equal to access port) (Lines 15 to 19)

Switch5

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
Switch#conf t
Switch(config)#vlan 20
Switch(config-vlan)#ex
Switch(config)#int fa0/3
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 20
Switch(config-if)#ex
Switch(config)#int fa0/1
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 20
Switch(config-if)#switchport trunk native vlan 20
Switch(config-if)#ex
  • Create VLAN 20, as it is the only VLAN used (Lines 2 to 3)
  • Make fa0/3 as Trunk to allow vlan 20 to other switches(Lines 4 to 8)
  • Make fa0/1 as Trunk to allow vlan 20 as Native vlan id(equal to access port) (Lines 9 to 14)

Testing

  • Configured VL20-1 and VL20-2 with IP address as 20.0.0.20/8 and 20.0.0.2/8 respectively.  Ping is successful.
  • Configured VL30-1 and VL30-2 with IP addresses 30.0.0.30/8 and 30.0.0.3/8 respectively.  Ping is successful

Sunday, March 24, 2019

Basic VLAN Operation

I am performing a basic operation of VLAN using Packet Tracer.

Topology
It resembles a use case scenario, where 2 PC's from Marketing and Finance are placed in two different buildings.  Each building will have a 3560 multi-layer switch.  A connection is laid between switches.  We need connectivity between MKT-1 and MKT-2.  Also between FIN-1 and FIN-2.

Task Breakdown
  1. Setting Devices
  2. Creating VLANs in Switch
  3. Access Mode Configuration in Switch
  4. Trunk Mode Configuration in Switch
  5. Validating
1. Setting Devices
  • Configure IP Address in PC: Click on PC. Config -> FastEthernet0 -> Static -> 172.1.0.1
  • Set hostname in Switch
IP Configuration on PC

Switch#configure t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname BLD-1
BLD-1(config)#

Similarly configure IP Addresses and hostnames for all PCs and Switches as mentioned in Topology diagram above.

2. Creating VLANs in Switch

On both BLD-1 and BLD-2 switches create VLANs 2 and 3 for Marketing and Finance respectively.

BLD-1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
BLD-1(config)#vlan 2
BLD-1(config-vlan)#name MKT
BLD-1(config-vlan)#exit
BLD-1(config)#vlan 3
BLD-1(config-vlan)#name FIN
BLD-1(config-vlan)#exit
BLD-1(config)#exit


Observe that 2 VLANs are created waiting for the ports to be assigned.

BLD-1#show vlan
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                Fa0/13, Fa0/14, Fa0/15, Fa0/16
                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20
                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24
                                                Gig0/1, Gig0/2
2    MKT                              active    
3    FIN                              active    
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active   

3. Access Mode Configuration in Switch
  • Fa0/1 of BLD-1 to VLAN 2(MKT)
  • Fa0/2 of BLD-1 to VLAN 3(FIN)
  • Fa0/1 of BLD-2 to VLAN 2(MKT)
  • Fa0/2 of BLD-2 to VLAN 3(FIN)
Now we have to assign ports of switches to VLANs 2 or 3 according to the PCs connected.  Here in our case:

BLD-1(config)#int fa0/1
BLD-1(config-if)#switchport access vlan 2
BLD-1(config-if)#switchport mode access
BLD-1(config-if)#exit
BLD-1(config)#int fa0/2
BLD-1(config-if)#switchport access vlan 3
BLD-1(config-if)#exit
BLD-1(config)#exit
Observe the Port assignments to VLAN

BLD-1# show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/3, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24, Gig0/1, Gig0/2
2    MKT                              active    Fa0/1
3    FIN                              active    Fa0/2
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

4. Trunk Mode Configuration in Switch

Interconnection of two Switches is through Gig0/1.  They have to pass traffic of VLANs 1 and 2 in it.  So, we make it Trunk mode with encapsulation IEEE Dot11q.

The configuration to be performed on both BLD-1 and BLD-2

BLD-1(config)#int gig0/1
BLD-1(config-if)#switchport trunk encapsulation dot1q
BLD-1(config-if)#switchport mode trunk
BLD-1(config-if)#exit
BLD-1(config)#exit

As Default VLAN 1 is already present in switch and we added VLAN 2 and 3, the resultant trunk port will pass all 3 VLANs traffic.

BLD-2#show int trunk
Port        Mode         Encapsulation  Status        Native vlan
Gig0/1      on           802.1q         trunking      1

Port        Vlans allowed on trunk
Gig0/1      1-1005

Port        Vlans allowed and active in management domain
Gig0/1      1,2,3

Port        Vlans in spanning tree forwarding state and not pruned
Gig0/1      1,2,3

5. Validating

To make sure our configuration works (without negative test cases involved), Following ping test should pass
  • MKT-1 (172.1.0.1) to MKT-2 (172.1.0.2)
  • FIN-1 (172.2.0.1) to FIN-2 (172.2.0.2)
Click FIN-1. Desktop -> Command Prompt