Lab - Configuring VLANs and Trunking

Cisco Packet Tracer

Topology

Addressing Table

Device

Interface

IP Address

Subnet Mask

Default Gateway

S1

VLAN 99

192.168.1.11

255.255.255.0

N/A

S2

VLAN 99

192.168.1.12

255.255.255.0

N/A

PC-A

NIC

192.168.10.3

255.255.255.0

192.168.10.1

PC-B

NIC

192.168.10.4

255.255.255.0

192.168.10.1

PC-C

NIC

192.168.20.3

255.255.255.0

192.168.20.1

Step 1: Configure PC hosts.

  • Refer to the Addressing Table for PC host address information.

PC-A>ipconfig /all

FastEthernet0 Connection:(default port)

   Connection-specific DNS Suffix..: 
   Physical Address................: 00E0.8FB0.08DB
   Link-local IPv6 Address.........: FE80::2E0:8FFF:FEB0:8DB
   IP Address......................: 192.168.10.3
   Subnet Mask.....................: 255.255.255.0
   Default Gateway.................: 192.168.10.1
   DNS Servers.....................: 0.0.0.0
   DHCP Servers....................: 0.0.0.0
   DHCPv6 Client DUID..............: 00-01-00-01-54-DD-A8-05-00-E0-8F-B0-08-DB


PC-A>
PC-B>ipconfig /all

FastEthernet0 Connection:(default port)

   Connection-specific DNS Suffix..: 
   Physical Address................: 0010.11D7.D776
   Link-local IPv6 Address.........: FE80::210:11FF:FED7:D776
   IP Address......................: 192.168.10.4
   Subnet Mask.....................: 255.255.255.0
   Default Gateway.................: 192.168.10.1
   DNS Servers.....................: 0.0.0.0
   DHCP Servers....................: 0.0.0.0
   DHCPv6 Client DUID..............: 00-01-00-01-AC-D7-C1-A0-00-10-11-D7-D7-76


PC-B>
PC-C>ipconfig /all

FastEthernet0 Connection:(default port)

   Connection-specific DNS Suffix..: 
   Physical Address................: 0040.0B45.4742
   Link-local IPv6 Address.........: FE80::240:BFF:FE45:4742
   IP Address......................: 192.168.20.3
   Subnet Mask.....................: 255.255.255.0
   Default Gateway.................: 192.168.20.1
   DNS Servers.....................: 0.0.0.0
   DHCP Servers....................: 0.0.0.0
   DHCPv6 Client DUID..............: 00-01-00-01-2C-0B-54-4C-00-40-0B-45-47-42


PC-C>

Step 2: Create VLANs and Assign Switch Ports

  • Create VLANs on both switches.

S1(config)#vlan 10
S1(config-vlan)#name Student
S1(config-vlan)#exit
S1(config)#vlan 20
S1(config-vlan)#name Faculty
S1(config-vlan)#exit
S1(config)#vlan 99
S1(config-vlan)#name Management
S1(config-vlan)#end
S1#
S2(config)#vlan 10
S2(config-vlan)#name Student
S2(config-vlan)#exit
S2(config)#vlan 20
S2(config-vlan)#name Faculty
S2(config-vlan)#exit
S2(config)#vlan 99
S2(config-vlan)#name Management
S2(config-vlan)#end
S2#
  • Issue the show vlan command to view the list of VLANs on S1.

S1#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
10   Student                          active    
20   Faculty                          active    
99   Management                       active    
1002 fddi-default                     act/unsup 
1003 token-ring-default               act/unsup 
1004 fddinet-default                  act/unsup 
1005 trnet-default                    act/unsup 

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
99   enet  100099     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   
1004 fdnet 101004     1500  -      -      -        ieee -        0      0   
1005 trnet 101005     1500  -      -      -        ibm  -        0      0   

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------
S1#

What is the default VLAN? VLAN 1

What ports are assigned to the default VLAN? All switch ports are assigned to VLAN 1 by default.

Step 3: Assign VLANs to the correct switch interfaces.

  • Assign PC-A to the Student VLAN.

S1(config)#interface fastEthernet 0/6
S1(config-if)#switchport mode access 
S1(config-if)#switchport access vlan 10
  • Move the switch IP address VLAN 99.

S1(config)#interface vlan 1
S1(config-if)#no ip address 
S1(config-if)#exit
S1(config)#interface vlan 99
S1(config-if)#ip address 192.168.1.11 255.255.255.0
S1(config-if)#end
S1#
  • Issue the show vlan brief command and verify that the VLANs are assigned to the correct interfaces.

S1#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, 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
10   Student                          active    Fa0/6
20   Faculty                          active    
99   Management                       active    
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
S1#
  • Issue the show ip interfaces brief command.

S1#show ip interface brief 
Interface              IP-Address      OK? Method Status                Protocol
 
[ ... ]

Vlan1                  unassigned      YES manual administratively down down
 
Vlan99                 192.168.1.11    YES manual up                    down
S1#

What is the status of VLAN 99? Why? The status of VLAN 99 is up/down, because it has not been assigned to an active port yet.

  • Use the Topology to assign VLANs to the appropriate ports on S2.

S2(config)#interface fastEthernet 0/11
S2(config-if)#switchport mode access 
S2(config-if)#switchport access vlan 10
S2(config-if)#exit
S2(config)#interface fastEthernet 0/18
S2(config-if)#switchport mode access 
S2(config-if)#switchport access vlan 20
  • Configure an IP address for VLAN 99 on S2 according to the Addressing Table.

S2(config)#interface vlan 1
S2(config-if)#no ip address 
S2(config-if)#exit
S2(config)#interface vlan 99
S2(config-if)#ip address 192.168.1.12 255.255.255.0
S2(config-if)#end
S2#
  • Use the show vlan brief command to verify that the VLANs are assigned to the correct interfaces.

S2#show vlan brief 

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/12, Fa0/13
                                                Fa0/14, Fa0/15, Fa0/16, Fa0/17
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24, Gig0/1, Gig0/2
10   Student                          active    Fa0/11
20   Faculty                          active    Fa0/18
99   Management                       active    
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
S2#

Is PC-A able to ping PC-B? Why? No. Interface F0/1 is not assigned to VLAN 10, so VLAN 10 traffic will not be sent over it.

Is S1 able to ping S2? Why? No. The IP addresses for the switches now reside in VLAN 99. VLAN 99 traffic will not be sent over interface F0/1.

Step4: Maintain VLAN Port Assignments and the VLAN Database

  • On S1, assign interfaces F0/11 – 24 to VLAN 10.

S1(config)#interface range fastEthernet 0/11-24
S1(config-if-range)#switchport mode access 
S1(config-if-range)#switchport access vlan 10
S1(config-if-range)#end
S1#
  • Issue the show vlan brief command to verify VLAN assignments.

S1#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Gig0/1, Gig0/2
10   Student                          active    Fa0/6, 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
20   Faculty                          active    
99   Management                       active    
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
S1#
  • Reassign F0/11 and F0/21 to VLAN 20.

S1(config)#interface range fa0/11 , fa0/21
S1(config-if-range)#switchport mode access 
S1(config-if-range)#switchport access vlan 20
S1(config-if-range)#end
S1#
  • Verify that VLAN assignments are correct.

S1#show vlan brief 

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

Step 5: Remove a VLAN assignment from an interface.

  • Use the no switchport access vlan command to remove the VLAN 10 assignment to F0/24.

S1(config)#interface fastEthernet 0/24
S1(config-if)#no switchport access vlan 
S1(config-if)#end
S1#
  • Verify that the VLAN change was made.

S1#show vlan brief 

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

Which VLAN is F0/24 is now associated with? VLAN 1, the default VLAN.

Step 6: Remove a VLAN ID from the VLAN database.

  • Add VLAN 30 to interface F0/24 without issuing the VLAN command.

S1(config)#interface fastEthernet 0/24
S1(config-if)#switchport mode access 
S1(config-if)#switchport access vlan 30
% Access VLAN does not exist. Creating vlan 30
S1(config-if)#

Note: Current switch technology no longer requires that the vlan command be issued to add a VLAN to the database. By assigning an unknown VLAN to a port, the VLAN adds to the VLAN database.

  • Verify that the new VLAN is displayed in the VLAN table.

S1#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Gig0/1, Gig0/2
10   Student                          active    Fa0/6, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/22, Fa0/23
20   Faculty                          active    Fa0/11, Fa0/21
30   VLAN0030                         active    Fa0/24
99   Management                       active    
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
S1#
  • Use the no vlan 30 command to remove VLAN 30 from the VLAN database.

S1(config)#no vlan 30
  • Issue the show vlan brief command.

S1#show vlan brief 

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

After deleting VLAN 30, what VLAN is port F0/24 assigned to? What happens to the traffic destined to the host attached to F0/24? Port F0/24 is not assigned to any VLAN. This port will not transfer any traffic.

  • Issue the no switchport access vlan command on interface F0/24.

S1(config)#interface fastEthernet 0/24
S1(config-if)#no switchport access vlan 
S1(config-if)#end
S1#

Issue the show vlan brief command to determine the VLAN assignment for F0/24. To which VLAN is F0/24 assigned? VLAN 1

Note: Before removing a VLAN from the database, it is recommended that you reassign all the ports assigned to that VLAN.

Step 7: Configure an 802.1Q Trunk Between the Switches

  • Use DTP to initiate trunking on F0/1.

S1(config)#interface fastEthernet 0/1
S1(config-if)#switchport mode dynamic desirable 

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan99, changed state to up

S1(config-if)#
  • Issue the show vlan brief command on S1 and S2. Interface F0/1 is no longer assigned to VLAN 1. Trunked interfaces are not listed in the VLAN table.

S1#show vlan brief 

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/2, Fa0/3, Fa0/4, Fa0/5
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/24, Gig0/1, Gig0/2
10   Student                          active    Fa0/6, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/22, Fa0/23
20   Faculty                          active    Fa0/11, Fa0/21
99   Management                       active    
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    
S1#
  • Issue the show interfaces trunk command to view trunked interfaces. Notice that the mode on S1 is set to desirable, and the mode on S2 is set to auto.

S1#show interfaces trunk 
Port        Mode         Encapsulation  Status        Native vlan
Fa0/1       desirable    n-802.1q       trunking      1

Port        Vlans allowed on trunk
Fa0/1       1-1005

Port        Vlans allowed and active in management domain
Fa0/1       1,10,20,99

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       1,10,20,99
S1#

Note: By default, all VLANs are allowed on a trunk. The switchport trunk command allows you to control what VLANs have access to the trunk. For this lab, keep the default settings which allows all VLANs to traverse F0/1.

  • Can S1 ping S2?

S1#ping 192.168.1.12

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.12, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms

S1#
  • Can PC-A ping PC-B?

PC>ping 192.168.10.4

Pinging 192.168.10.4 with 32 bytes of data:

Reply from 192.168.10.4: bytes=32 time=1ms TTL=128
Reply from 192.168.10.4: bytes=32 time=0ms TTL=128
Reply from 192.168.10.4: bytes=32 time=0ms TTL=128
Reply from 192.168.10.4: bytes=32 time=0ms TTL=128

Ping statistics for 192.168.10.4:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms

PC>
  • Can PC-A ping PC-C?

PC>ping 192.168.20.3

Pinging 192.168.20.3 with 32 bytes of data:

Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.20.3:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

PC>

Step 8: Manually configure trunk interface F0/1.

  • Change the switchport mode on interface F0/1 to force trunking. Make sure to do this on both switches.

S1(config)#interface fastEthernet 0/1
S1(config-if)#switchport mode trunk 
  • Issue the show interfaces trunk command to view the trunk mode. Notice that the mode changed from desirable to on.

S1#show interfaces trunk 
Port        Mode         Encapsulation  Status        Native vlan
Fa0/1       on           802.1q         trunking      1

Port        Vlans allowed on trunk
Fa0/1       1-1005

Port        Vlans allowed and active in management domain
Fa0/1       1,10,20,99

Port        Vlans in spanning tree forwarding state and not pruned
Fa0/1       1,10,20,99
S1#

Why might you want to manually configure an interface to trunk mode instead of using DTP? Not all equipment uses DTP. Using the switchport mode trunk command ensures that the port will become a trunk no matter what type of equipment is connected to the other end of the link.

Step 9: Delete the VLAN Database

  • Determine if the VLAN database exists.Issue the show flash command to determine if a vlan.dat file exists in flash.

S1#show flash: 
Directory of flash:/

    1  -rw-     4414921          <no date>  c2960-lanbase-mz.122-25.FX.bin
    2  -rw-         736          <no date>  vlan.dat

64016384 bytes total (59600727 bytes free)
S1#

Note: If there is a vlan.dat file located in flash, then the VLAN database does not contain its default settings.

  • Delete the VLAN database.

S1#delete vlan.dat
Delete filename [vlan.dat]?
Delete flash:/vlan.dat? [confirm]

S1#
  • Issue the show flash command to verify that the vlan.dat file has been deleted.

S1#show flash: 
Directory of flash:/

    1  -rw-     4414921          <no date>  c2960-lanbase-mz.122-25.FX.bin

64016384 bytes total (59601463 bytes free)
S1#

To initialize a switch back to its default settings, what other commands are needed? To get a switch back to its default settings, the erase startup-config and reload commands need to be issued after the delete vlan.dat command.

Keywords:

erase startup-config , yaser rahmati , یاسر رحمتی , delete vlan.dat , reload , show flash: , DTP , show interfaces trunk , trunk , switchport mode trunk , 802.1q , vlan , show vlan brief , ping , no switchport access vlan , show vlan brief , ipconfig /all , Assign VLANs , show ip interface brief

Last updated