How to Configure VLAN in Cisco Packet Tracer
How to Configure VLAN in Cisco Packet Tracer: This instructional exercise discloses how to make and allot VLAN, VLAN Membership (Static and Dynamic), Router on Stick and Spanning Tree Protocol (STP) in detail with down to earth models in parcel tracer. Figure out how to make and oversee VLAN in Cisco switch bit by bit.
Make a training lab in bundle tracer as appeared in the following the figure of download pre-made practice lab from the second piece of this instructional exercise,
By and by lab organize Office1 Switch is arranged as VTP Server. Office2 and Office3 switches are arranged as VTP customers. We just need to make VLANs in VTP Server. VTP Server will spread this data to all VTP customers naturally.
VLAN VLAN number command is used to create the VLAN.
Office 1 Switch
S1(config)#vlan 10 S1(config-vlan)#exit S1(config)#vlan 20 S1(config-vlan)#exit S1(config)#
Assigning VLAN Membership
VLAN can be assigned statically or dynamically. CCNA exam only includes static methods; therefore we will also use static methods to assign VLAN membership. switch port access VLAN [vlan number ] command is used to assign VLAN to the interface. The following commands will assign VLANs to the interfaces.
Office 1 Switch
S1(config)#interface fastEthernet 0/1 S1(config-if)#switchport access vlan 10 S1(config-if)#interface fastEthernet 0/2 S1(config-if)#switchport access vlan 20
Office 2 Switch
S2(config)#interface fastEthernet 0/1 S2(config-if)#switchport access vlan 10 S2(config-if)#interface fastEthernet 0/2 S2(config-if)#switchport access vlan 20
Office 3 Switch
S3(config)#interface fastEthernet 0/1 S3(config-if)#switchport access vlan 10 S3(config-if)#interface fastEthernet 0/2 S3(config-if)#switchport access vlan 20 We have effectively doled out VLAN enrollment. It's a great opportunity to test our setup. To test this design, we will utilize the ping order. ping order is utilized to test the network between two gadgets. According to our design, gadgets from the same VLAN can impart. Gadgets from various VLANs must not have the option to speak with one another without the switch.
Testing VLAN configuration
Access PC’s command prompt to test VLAN configuration. Double click PC-PT and click Command Prompt
We have two VLAN configurations VLAN 10 and VLAN 20. Let’s test VLAN 10 first. In VLAN 10 we have three PCs with IP addresses 10.0.0.2, 10.0.0.3 and 10.0.0.4. These PCs must be able to communicate with each other. At this point PCs from VLAN 10 should not be allowed to access PCs from VLAN 20. VLAN 20 also has three PCs 220.127.116.11, 18.104.22.168 and 22.214.171.124.
We have successfully implemented VLAN 10 now test VLAN 20.
Same as VLAN 10, PCs from VLAN 20 must be able to communicate with other PCs of the same VLAN while they should not be able to access VLAN 10.
Congratulations we have successfully achieved one more milestone of this article.
Configure Router on Stick
Typically routers are configured to receive data on one physical interface and forward that data from another physical interface based on its configuration. Each VLAN has a layer 3 address that should be configured as the default gateway address on all its devices. In our scenario, we reserved IP address 10.0.0.1 for VLAN 10 and 126.96.36.199 for VLAN 20.
With the default configuration, we need two physical interfaces on the router to make this intra VLAN communication. Due to the price of the router, it’s not a cost-effective solution to use a physical interface of the router for each VLAN. Usually, a router has one or two Ethernet interfaces. For example, if we have 50 VLANs, we would need nearly 25 routers in order to make intra VLANs communications. To deal with the situation we use Router on Stick.
A router on Stick is a router that supports trunk connection and has an ability to switch frames between the VLANs on this trunk connection. On this router, a single physical interface is sufficient to make communication between our both VLANs.
Access command prompt of Router
To configure Router on Stick we have to access the CLI prompt of Router. Click Router and Click CLI from menu items and Press Enter key to access the CLI
Run following commands in the same sequence to configure Router on Stick
Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#interface fastEthernet 0/0 Router(config-if)#no ip address Router(config-if)#no shutdown Router(config-if)#exit Router(config)#interface fastEthernet 0/0.10 Router(config-subif)#encapsulation dot1Q 10 Router(config-subif)#ip address 10.0.0.1 255.0.0.0 Router(config-subif)#exit Router(config)#interface fastEthernet 0/0.20 Router(config-subif)#encapsulation dot1Q 20 Router(config-subif)#ip address 188.8.131.52 255.0.0.0 Router(config-subif)#exit
In the above configuration, we broke up a single physical interface [FastEthernet 0/0] into two logical interfaces, known as sub-interfaces. The router supports up to 1000 interfaces including both physical and logical.
- By default interface, the link works as an access link. We need to change it into a trunk link. encapsulation commands specify the trunk type and associate VLAN with sub-interface.
- In the next step, we assigned the IP address to our sub-interface.
That’s all configuration we need to switch VLANs. Now we can test different VLAN communications. To test intra VLANs communication open command prompt of PC and ping the PC of other VLAN.
PC [10.0.0.3] from VLAN 10 can now access PC [184.108.40.206] from VLAN 20.
Spanning Tree Protocol (STP)
STP is a Layer 2 protocol, used for removing loops. For backup purposes, we typically create backup links for important resources. In our scenario, all offices have backup links that create loops in topology. STP automatically removes layer 2 loops. STP multicasts frame that contains information about switch interfaces. These frames are called BPDU (Bridge Protocol Data Units). The switch uses BPDUs to learn network topology. If it found any loop, it will automatically remove that. To remove the loop, STP disables port or ports that are causing it.
|Switch(config)#vtp password password||Set VTP password. Password is case sensitive|
|Switch#show vtp status||Display VTP status including general information|
|Switch#show vtp counters||Show VTP counters of switch|
|Switch(config-if) #switchport mode trunk||Change interface mode in Trunk|
|Switch(config)#vlan 10||Create VLAN and associate number ID 10 with it|
|Switch(config-vlan)#name Sales||Assign name to VLAN|
|Switch(config-vlan)#exit||Return in Global configuration mode from VLAN configuration mode|
|Switch(config)#interface fastethernet 0/1||Enter in interface configuration mode|
|Switch(config-if)#switchport mode access||Set interface link type to access link|
|Switch(config-if)#switchport access vlan 10||Assign this interface to VLAN 10|
|Switch#show vlan||Displays VLAN information|
|Switch#show vlan brief||Displays VLAN information in short|
|Switch#show vlan id 10||Displays information VLAN ID 10 only|
|Switch#show vlan name sales||Displays information about VLAN named sales only|
|Switch(config)#interface fastethernet 0/8||Enter in Interface configuration mode|
|Switch(config-if)#no switchport access vlan 10||Removes interface from VLAN 10 and reassigns it to the default VLAN – VLAN 1|
|Switch(config-if)#exit||Move back to Global configuration mode|
|Switch(config)#no vlan 10||Delete VLAN 10 from VLAN database|
|Switch#copy running-config startup-config||Saves the running configuration in NVRAM|
Use this configured topology for cross-checking if you are not getting the same output after following all steps.
This is about How to Configure VLAN in Cisco Packet Tracer
Thanks for reading! We hope you found this tutorial helpful and we would love to hear your feedback in the Comments section below. And show us what you’ve learned by sharing your projects with us.