Lab 18: Configuring Inter-VLAN Routing (Router on a Stick)

Lab Objective:

The objective of this lab exercise is to configure a router to provide inter-VLAN communication. By default, hosts in one VLAN cannot communicate with hosts in another VLAN without a router routing between the two VLANs.

Lab Purpose:

Inter-VLAN routing configuration is a fundamental skill. Most networks typically have more than one VLAN, and the hosts in these VLANs are required to communicate with each other if the need arises. As a Cisco engineer, as well as in the Cisco CCNA exam, you will be expected to know how to configure inter-VLAN routing. In this example, you don’t have a Layer 3 switch so you must use a router to route.

Certification Level:

This lab is suitable for CCNA certification exam preparation.

Lab Difficulty:

This lab has a difficulty rating of 9/10.

Readiness Assessment:

When you are ready for your certification exam, you should complete this lab in no more than 20 minutes.

Lab Topology:

Please use the following topology to complete this lab exercise:

Lab 18: Configuring Inter-VLAN Routing (Router on a Stick) 2

Task 1:

Configure a hostname on switches 1 and 2 and routers 1 through 4 as illustrated in the topology above.

Task 2:

Configure and verify Sw1 and Sw2 as VTP Transparent switches. Both switches should be in the VTP domain named CISCO. Secure VTP messages with the password CISCO.

Task 3:

Configure and verify FastEthernet0/1 between Sw1 and Sw2 as an 802.1q trunk and configure VLANs as depicted in the topology above. Assign ports to depicted VLANs and configure Sw1 FastEthernet0/2 as a trunk. VLAN20 should have untagged Ethernet frames. Remember that on 802.1q trunks, only the native VLAN is untagged.

Task 4:

Configure IP addresses on R2, R3, and R4 as illustrated in the diagram.

Task 5:

Configure subinterfaces off R1 FastEthernet0/0 in the corresponding VLANs in the diagram. Also, configure interface VLAN10 on Sw2 with the IP address 10.0.10.2/28.

Task 6:

Test network connectivity by pinging from R1 to routers R2, R3, and R4.

Configuration and Verification

Task 1:

For reference information on configuring hostnames, please refer to earlier labs.

Task 2:

For reference information on configuring and verifying VTP, please refer to earlier labs.

Task 3:

Sw1#config t 
Enter configuration commands, one per line.  End with CTRL/Z. 
Sw1(config)#interface fastethernet0/1 
Sw1(config-if)#switchport mode trunk 
Sw1(config-if)#exit 
Sw1(config)#vlan10 
Sw1(config-vlan)#name SALES 
Sw1(config-vlan)#exit 
Sw1(config)#vlan20 
Sw1(config-vlan)#name TECH 
Sw1(config-vlan)#exit 
Sw1(config)#vlan30 
Sw1(config-vlan)#name ADMIN 
Sw1(config-vlan)#exit 
Sw1(config)#vlan40 
Sw1(config-vlan)#name TEST 
Sw1(config-vlan)#exit 
Sw1(config)#interface fastethernet0/2 
Sw1(config-if)#switchport mode trunk 
Sw1(config-if)#switchport trunk native vlan20 
Sw1(config-if)#exit 
Sw1(config)#interface fastethernet0/3 
Sw1(config-if)#switchport mode access
Sw1(config-if)#switchport access vlan20 
Sw1(config-if)#end 
Sw1#show interfaces trunk 

Port        Mode         Encapsulation  Status        Native vlan 
Fa0/1       on           802.1q         trunking      1 
Fa0/2       on           802.1q         trunking      20 

Port        Vlans allowed on trunk 
Fa0/1       1-4094 
Fa0/2       1-4094 


Port        Vlans allowed and active in management domain 
Fa0/1       1,10,20,30,40 
Fa0/2       1,10,20,30,40 

Port        Vlans in spanning tree forwarding state and not pruned 
Fa0/1       1,20,30,40 
Fa0/2       1,20,30,40 

Sw2#config t 
Enter configuration commands, one per line.  End with CTRL/Z. 
Sw2(config)#interface fastethernet0/1 
Sw2(config-if)#switchport mode trunk 
Sw2(config-if)#exit 
Sw2(config)#vlan10 
Sw2(config-vlan)#name SALES 
Sw2(config-vlan)#exit 
Sw2(config)#vlan20 
Sw2(config-vlan)#name TECH 
Sw2(config-vlan)#exit 
Sw2(config)#vlan30 
Sw2(config-vlan)#name ADMIN 
Sw2(config-vlan)#exit 
Sw2(config)#vlan40 
Sw2(config-vlan)#name TEST
Sw2(config-vlan)#exit 
Sw2(config)#interface fastethernet0/2 
Sw2(config-if)#switchport mode access 
Sw2(config-if)#switchport access vlan30 
Sw2(config-if)#exit 
Sw2(config)#interface fastethernet0/3 
Sw2(config-if)#switchport mode access 
Sw2(config-if)#switchport access vlan40 
Sw2(config-if)#^Z 
Sw2#show interfaces trunk 

Port        Mode         Encapsulation  Status        Native vlan 
Fa0/1       on           802.1q         trunking      1 

Port        Vlans allowed on trunk 
Fa0/1       1-4094 

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

Port        Vlans in spanning tree forwarding state and not pruned 
Fa0/1       1,20,30,40

Task 4:

For reference information on configuring IP interfaces, please refer to earlier labs.

Task 5:

R1#config t 
Enter configuration commands, one per line.  End with CTRL/Z. 
R1(config)#interface fastethernet0/0 
R1(config-if)#description “Connected To Switch Trunk Fa0/2” 
R1(config-if)#no shutdown 
R1(config-if)#exit 
R1(config)#interface fastethernet0/0.10 
R1(config-subif)#description Subinterface For VLAN10
R1(config-subif)#encapsulation dot1Q 10 
R1(config-subif)#ip address 10.0.10.1 255.255.255.240 
R1(config-subif)#exit 
R1(config)#interface fastethernet0/0.20 
R1(config-subif)#description Subinterface For VLAN20 
R1(config-subif)#encapsulation dot1Q 20 native 
R1(config-subif)#ip address 10.0.20.1 255.255.255.128 
R1(config-subif)#exit 
R1(config)#interface fastethernet0/0.30 
R1(config-subif)#description Subinterface For VLAN30 
R1(config-subif)#ip address 10.0.30.1 255.255.255.248 
R1(config-subif)#exit 
R1(config)#interface fastethernet0/0.40 
R1(config-subif)#description Subinterface For VLAN40 
R1(config-subif)#encapsulation dot1Q 40 
R1(config-subif)#ip address 10.0.40.1 255.255.255.224 
R1(config-subif)#end 
R1#show ip interface brief 
Interface          IP-Address    OK?    Method    Status    Protocol 
FastEthernet0/0    unassigned    YES    manual    up        up   
FastEthernet0/0.10 10.0.10.1     YES    manual    up        up    
FastEthernet0/0.20 10.0.20.1     YES    manual    up        up   
FastEthernet0/0.30 10.0.30.1     YES    manual    up        up 
FastEthernet0/0.40 10.0.40.1     YES    manual    up        up 

Sw2(config)#interface vlan1 
Sw2(config-if)#shutdown 
Sw2(config)#interface vlan10 
Sw2(config-if)#ip address 10.0.10.2 255.255.255.240 
Sw2(config-if)#no shutdown 
Sw2(config)#^Z 
Sw2#show ip interface brief 
Interface     IP-Address   OK? Method Status                Protocol 
Vlan1         unassigned   YES NVRAM  administratively down down
Vlan10        10.0.10.2    YES manual up                    up   
Sw2#

Task 6:

R1#ping 10.0.10.2 

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

R1#ping 10.0.20.2 

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

R1#ping 10.0.30.3 

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

R1#ping 10.0.40.4 

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

NOTE: The first ping packet times out due to ARP resolution. Subsequent packets will be successful.


Related Articles

guest
1 Comment
Inline Feedbacks
View all comments
Dan
Dan
3 years ago

Why is there no trunk on R1(config)#interface fastethernet0/0.30 ??