Vlans & Trunkports

Configure 2 Switches with Vlan 3 and 4 Using GNS & CISCO IOSVL2

In GNS3 create new Project and configure the following:

Switch 1 Hostname  SW001

8 VPCS on Vlan 3 – Description Payroll
5 VPCS on Vlan 4 – Description Accounting
Switch 1 (Trunk port) Uplink  to SW002 (Trunk Port)
Configure Trunk Ports / Uplink to allow Vlan3 and Vlan 4
All VPCs on VLAN 3 on Switch SW001 must be able to communicate with allVPCS on VLAN 3 on SW002 .

All VPCs on VLAN 4 on Switch SW001 must be able to communicate with all VPCS on VLAN 4 on SW002 

Switch 2 Hostname SW002

8 VPCS on Vlan 3 – Description Accounting
5 VPCS on Vlan 4 – Description Payroll
1 Uplink to to SW001
Configure Trunk Port / Uplink to allow Vlan3 and Vlan 4
All VPCs on VLAN 3 on Switch SW002 must be able to communicate with all VPCS on VLAN 3 on SW001
All VPCs on VLAN 4 on Switch SW002 must be able to communicate with all VPCS on VLAN 4 on SW001

Setup your Virtual PCs and Virtual Switches in GNS3, ash shown below. Tip: Run all your VPCs and Switches within GNS3 VM 

Robert-Welsh-CCNA-Lab1

Now Create 2 Switches with the Hostnames – Select Cisco IOSvL2 – Drag and drop them to the project area.

SW001

#en
#configure terminal
#hostname SW001
#exit
#copy running-config startup-config

SW002

#en
#configure terminal
#hostname SW002
#exit
#copy running-config startup-config

Now Create VLAN 3 and 4 Interfaces on both Switches

SW001

Interface VLAN 3 10.1.1.253 255.255.255.0
Interface VLAN 4 10.2.2.252 255.255.255.0

SW001#en
SW001#configure terminal
SW001#interface vlan 3
SW001#ip address 10.1.1.253 255.255.255.0
SW001#description payroll
SW001#no shutdown
SW001#copy running-config startup-config
SW001#exit
SW001#exit
SW001#copy running-config startup-config
SW001#show interface vlan 3

Output
Vlan3 is down, line protocol is down
Hardware is Ethernet SVI, address is 0c3a.7fd5.8003 (bia 0c3a.7fd5.8003)
Description: Payroll
Internet address is 10.1.1.253/24

SW001#configure terminal
SW001#interface vlan 4
SW001#ip address 10.1.1.252 255.255.255.0
SW001#description accounting
SW001#no shutdown
SW001#do copy running-config startup-config
SW001#exit
SW001#exit
SW001#copy running-config startup-config
SW001#show interface vlan 4

Output
Vlan4 is down, line protocol is down
Hardware is Ethernet SVI, address is 0c3a.7fd5.8004 (bia 0c3a.7fd5.8004)
Description: Accounting
Internet address is 10.2.2.252/24

SW002
Interface VLAN 3 10.1.1.252 255.255.255.0
Interface VLAN 4 10.2.2.253 255.255.255.0

SW002#en
SW002#configure terminal
SW002#interface vlan 3
SW002#ip address 10.1.1.252 255.255.255.0
SW002#description payroll
SW002#no shutdown
SW002#exit
SW002#exit
SW002#copy running-config startup-config
SW002#show interface vlan 3

Output:
Vlan3 is down, line protocol is down
Hardware is Ethernet SVI, address is 0c16.d3c5.8003 (bia 0c16.d3c5.8003)
Description: Payroll
Internet address is 10.1.1.252/24

SW002#en
SW002#configure terminal
SW002#interface vlan 4
SW002#ip address 10.2.2.253 255.255.255.0
SW002#description accounting
SW002#no shutdown
SW002#exit
SW002#exit
SW002#do copy running-config startup-config
SW002#show interface vlan 4

Output:
Vlan4 is down, line protocol is down
Hardware is Ethernet SVI, address is 0c16.d3c5.8004 (bia 0c16.d3c5.8004)
Description: Accounting
Internet address is 10.2.2.253/24

Attach the following PCs in GNS3  using a cable in the following order to switch SW002 and configure VLANs

Configure PC1–>PC8 with VLAN 3
Configure PC17->PC20 and PC 26 with VLAN4

VLAN 3 PCs
PC1 10.1.1.1 255.255.255.0 SW001 Gi0/0 VLAN3
PC2 10.1.1.2 255.255.255.0 SW001 Gi0/1 VLAN3
PC3 10.1.1.3 255.255.255.0 SW001 Gi0/2 VLAN3
PC4 10.1.1.4 255.255.255.0 SW001 Gi0/3 VLAN3
PC5 10.1.1.5 255.255.255.0 SW001 Gi1/0 VLAN3
PC6 10.1.1.6 255.255.255.0 SW001 Gi1/1 VLAN3
PC7 10.1.1.7 255.255.255.0 SW001 Gi1/2 VLAN3
PC8 10.1.1.8 255.255.255.0 SW001 Gi1/3 VLAN3

VLAN 4 PCs
PC17 10.2.2.9   255.255.255.0 SW001 Gi2/0 VLAN4
PC18 10.2.2.10  255.255.255.0 SW001 Gi2/1 VLAN4
PC19 10.2.2.11  255.255.255.0 SW001 Gi2/2 VLAN4
PC20 10.2.2.12  255.255.255.0 SW001 Gi2/3 VLAN4
PC26 10.2.2.13  255.255.255.0 SW001 Gi3/0 VLAN4

Configure the Switchports for each PC on SW001

SW001#en
SW001#configure terminal
SW001#interface gigabit 0/0
SW001#switchport access vlan3
SW001#no shutdown
SW001#exit

Optional – Configure using range

SW001#en
SW001#configure terminal
SW001#interface range gigabit 0/0-3
SW001#switchport access vlan3
SW001#no shutdown
SW001#exit

Test on SW001

Using the PC1 Console (Command Prompt), ping the IP Addresses PC2 to PC8, you should get a response since they are all in the same VLAN. Network and Subnet.

PC1> ping 10.1.1.2 (PC2)
84 bytes from 10.1.1.2 icmp_seq=1 ttl=64 time=1.431 ms
84 bytes from 10.1.1.2 icmp_seq=2 ttl=64 time=16.437 ms
84 bytes from 10.1.1.2 icmp_seq=3 ttl=64 time=2.838 ms
84 bytes from 10.1.1.2 icmp_seq=4 ttl=64 time=14.387 ms
84 bytes from 10.1.1.2 icmp_seq=5 ttl=64 time=2.694 ms

Using the PC1 Console (Command Prompt), ping the IP Addresses PC17 to PC20, you should not get a response, as the IP is has a different Network ID

PC1> ping 10.2.2.9
host (255.255.255.0) not reachable

Next using PC17 conole (Command prompt), ping the IP address of PC18 to PC25, you should get a response since they are all in the same VLAN. Network and Subnet.

PC17> ping 10.2.2.10
84 bytes from 10.2.2.10 icmp_seq=1 ttl=64 time=2.080 ms
84 bytes from 10.2.2.10 icmp_seq=2 ttl=64 time=7.837 ms
84 bytes from 10.2.2.10 icmp_seq=3 ttl=64 time=6.879 ms
84 bytes from 10.2.2.10 icmp_seq=4 ttl=64 time=15.491 ms
84 bytes from 10.2.2.10 icmp_seq=5 ttl=64 time=10.740 ms

Using the PC1 Console (Command Prompt), ping the IP Addresses PC17 to PC20, you should not get a response, as the IP is has a different Network ID

PC1> ping 10.1.1.1
host (255.255.255.0) not reachable

Trunk port (Uplink) configuration connecting SW001 to SW002, configure VLAN3 and VLAN4 

SW001

SW001#en
SW001#configure terminal
SW001#interface gigabit 3/1
SW001#switchport mode trunk
SW001#switchport trunk allowed vlan add 3-4
SW001#do copy running-config startup-config

if you recieve an error “rejected: An interface whose trunk encapsulation is “Auto” can not be configured to “trunk” mode”, you will need to use the following command.

SW001#en
SW001#configure terminal
SW001#interface gigabit 3/1
SW001#switchport mode trunk
SW001#switchport trunk encapsulation dot1q
SW001#switchport trunk allowed vlan add 3-4
SW001#do copy running-config startup-config

SW002

SW002#en
SW002#configure terminal
SW002#interface gigabit 3/1
SW002#switchport mode trunk
SW002#switchport trunk allowed vlan add 3-4
SW002#do copy running-config startup-config

if you recieve an error “rejected: An interface whose trunk encapsulation is “Auto” can not be configured to “trunk” mode”, you will need to use the following command.

SW002#en
SW002#configure terminal
SW002#interface gigabit 3/1
SW002#switchport mode trunk
SW002#switchport trunk encapsulation dot1q
SW002#switchport trunk allowed vlan add 3-4
SW002#do copy running-config startup-config

Commands used

enable
configure terminal
hostname
do
copy running-config startup-config
show version
show interface vlan
show interfaces status
show mac address-table
switchport mode trunk
switchport trunk allowed vlan add
switchport access
switchport trunk encapsulation dot1q
interface Gigabit
interface range
no shutdown
shutdown