Lab - Configure Router-on-a-Stick Inter-VLAN Routing (Answers Version)
Lab - Configure Router-on-a-Stick Inter-VLAN Routing (Answers Version)
Topology
Addressing Table
Device Interface IP Address Subnet Mask Default Gateway
R1
G0/0/1.4 192.168.4.1 255.255.255.0 N/A
R1
G0/0/1.8 N/A N/A N/A
VLAN Table
VLAN Name Interface Assigned
S1: VLAN 3
S2: VLAN 3
3 Management S1: F0/6
4 Operations S2: F0/18
S1: F0/2-4, F0/7-24, G0/1-2
7 ParkingLot S2: F0/2-17, F0/19-24, G0/1-2
8 Native N/A
Objectives
Part 1: Build the Network and Configure Basic Device Settings
Part 2: Create VLANs and Assign Switch Ports
Part 3: Configure an 802.1Q Trunk between the Switches
Part 4: Configure Inter-VLAN Routing on the Router
Part 5: Verify Inter-VLAN Routing is working
Background / Scenario
Modern switches use virtual local-area networks (VLANs) to provide segmentation services traditionally provided
by routers in LAN configurations. VLANs address scalability, security, and network management. In general,
VLANs make it easier to design a network to support the goals of an organization. Communication between
VLANs requires a device operating at Layer 3 of the OSI model. Routers in VLAN topologies provide additional
security and traffic flow management.
VLAN trunks are used to span VLANs across multiple devices. Trunks allow the traffic from multiple VLANS to
travel over a single link, while keeping the VLAN identification and segmentation intact. A particular kind of inter-
VLAN routing, called “Router-On-A-Stick”, uses a trunk from the router to the switch to enable all VLANs to pass
to the router.
In this lab, you will create VLANs on both switches in the topology, assign VLANs to switch access ports, verify
that VLANs are working as expected, create VLAN trunks between the two switches and between S1 and R1, and
configure Inter-VLAN routing on R1 to allow hosts in different VLANs to communicate, regardless of which subnet
the host resides.
Note: The routers used with CCNA hands-on labs are Cisco 4221 with Cisco IOS XE Release 16.9.4 (universalk9
image). The switches used in the labs are Cisco Catalyst 2960s with Cisco IOS Release 15.2(2) (lanbasek9
image). Other routers, switches, and Cisco IOS versions can be used. Depending on the model and Cisco IOS
version, the commands available and the output produced might vary from what is shown in the labs. Refer to the
Router Interface Summary Table at the end of the lab for the correct interface identifiers.
Note: Ensure that the routers and switches have been erased and have no startup configurations. If you are
unsure, contact your Answers.
Answers Note: Refer to the Answers Lab Manual for the procedures to initialize and reload devices.
Required Resources
• 1 Router (Cisco 4221 with Cisco IOS XE Release 16.9.4 universal image or comparable)
• 2 Switches (Cisco 2960 with Cisco IOS Release 15.2(2) lanbasek9 image or comparable)
• 2 PCs (Windows with a terminal emulation program, such as Tera Term)
• Console cables to configure the Cisco IOS devices via the console ports
• Ethernet cables as shown in the topology
Instructions
1. Create and name the required VLANs on each switch from the table above.
S1(config)# vlan 3
S1(config-vlan)# name Management
S1(config-vlan)# vlan 4
S1(config-vlan)# name Operations
S1(config-vlan)# vlan 7
S1(config-vlan)# name ParkingLot
S1(config-vlan)# vlan 8
S1(config-vlan)# name Native
S2(config)# vlan 3
S2(config-vlan)# name Management
S2(config-vlan)# vlan 4
S2(config-vlan)# name Operations
S2(config-vlan)# vlan 7
S2(config-vlan)# name ParkingLot
S1(config-vlan)# vlan 8
S1(config-vlan)# name Native
2. Configure the management interface and default gateway on each switch using the IP address
information in the Addressing Table.
S1(config)# interface vlan 3
S1(config-if)# ip address 192.168.3.11 255.255.255.0
S1(config-if)# no shutdown
S1(config-if)# exit
S1(config)# ip default-gateway 192.168.3.1
S2(config)# interface vlan 3
S2(config-if)# ip address 192.168.3.12 255.255.255.0
S2(config-if)# no shutdown
S2(config-if)# exit
S2(config)# ip default-gateway 192.168.3.1
3. Assign all unused ports on both switches to the ParkingLot VLAN, configure them for static access
mode, and administratively deactivate them.
Note: The interface range command is helpful to accomplish this task with as few commands as necessary.
S1(config)# interface range f0/2 – 4 , f0/7 – 24 , g0/1 – 2
S1(config-if-range)# switchport mode access
S1(config-if-range)# switchport access vlan 7
S1(config-if-range)# shutdown
S2(config)# interface range f0/2 – 17, f0/19 – 24 , g0/1 – 2
S2(config-if-range)# switchport mode access
S2(config-if-range)# switchport access vlan 7
S2(config-if-range)# shutdown
1. Change the switchport mode on interface F0/1 to force trunking. Make sure to do this on both switches.
S1(config)# interface f0/1
S1(config-if)# switchport mode trunk
S2(config)# interface f0/1
S2(config-if)# switchport mode trunk
2. As a part of the trunk configuration, set the native VLAN to 8 on both switches. You may see error
messages temporarily while the two interfaces are configured for different native VLANs.
S1(config-if)# switchport trunk native vlan 8
S2(config-if)# switchport trunk native vlan 8
3. As another part of trunk configuration, specify that VLANs 3, 4, and 8 are only allowed to cross the
trunk.
S1(config-if)# switchport trunk allowed vlan 3,4,8
S2(config-if)# switchport trunk allowed vlan 3,4,8
4. Issue the show interfaces trunk command to verify trunking ports, the Native VLAN and allowed
VLANs across the trunk.
S1# show interfaces trunk
PortModeEncapsulationStatusNative vlan
Fa0/3on802.1qtrunking8
PortVlans allowed on trunk
Fa0/33-4,8
PortVlans allowed and active in management domain
Fa0/33-4,8
PortVlans in spanning tree forwarding state and not pruned
Fa0/33-4,8
S2#show interfaces trunk
PortModeEncapsulationStatusNative vlan
Fa0/1on802.1qtrunking8
PortVlans allowed on trunk
Fa0/13-4,8
PortVlans allowed and active in management domain
Fa0/13-4,8
PortVlans in spanning tree forwarding state and not pruned
Fa0/13-4,8
Step 2:Manually configure S1’s trunk interface F0/5
1. Configure the F0/5 on S1 with the same trunk parameters as F0/1. This is the trunk to the router.
S1(config)# interface f0/5
S1(config-if)# switchport mode trunk
S1(config-if)# switchport trunk native vlan 8
S1(config-if)# switchport trunk allowed vlan 3,4,8
2. Save the running configuration to the startup configuration file on S1 and S2.
S1# copy running-config startup-config
S2# copy running-config startup-config
3. Issue the show interfaces trunk command to verify trunking.
Question:
Note: To find out how the router is configured, look at the interfaces to identify the type of router and how many
interfaces the router has. There is no way to effectively list all the combinations of configurations for each router class.
This table includes identifiers for the possible combinations of Ethernet and Serial interfaces in the device. The table
does not include any other type of interface, even though a specific router may contain one. An example of this might
be an ISDN BRI interface. The string in parenthesis is the legal abbreviation that can be used in Cisco IOS commands
to represent the interface.
End of Document
Switch S1
S1# show run
Building configuration…
Current configuration : 3128 bytes
!
! Last configuration change at 21:13:27 UTC Thu Sep 19 2019
!
version 15.2
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
!
hostname S1
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$mjNn$IB.7cD5jpb2CpFN72u.w81
!
no aaa new-model
system mtu routing 1500
!
no ip domain-lookup
!
spanning-tree mode rapid-pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
interface FastEthernet0/1
switchport trunk allowed vlan 3,4,8
switchport trunk native vlan 8
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/3
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/4
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/5
switchport trunk allowed vlan 3,4,8
switchport trunk native vlan 8
switchport mode trunk
!
interface FastEthernet0/6
switchport access vlan 3
switchport mode access
!
interface FastEthernet0/7
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/8
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/9
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/10
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/11
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/12
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/13
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/14
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/15
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/16
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/17
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/18
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/19
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/20
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/21
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/22
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/23
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/24
switchport access vlan 7
switchport mode access
shutdown
!
interface GigabitEthernet0/1
switchport access vlan 7
switchport mode access
shutdown
!
interface GigabitEthernet0/2
switchport access vlan 7
switchport mode access
shutdown
!
interface Vlan1
no ip address
shutdown
!
interface Vlan3
ip address 192.168.3.11 255.255.255.0
!
ip default-gateway 192.168.3.1
ip http server
ip http secure-server
!
banner motd ^C Authorized Users Only! ^C
!
line con 0
password 7 104D000A0618
login
line vty 0 4
password 7 104D000A0618
login
line vty 5 15
password 7 104D000A0618
login
!
end
Switch S2
S2# show run
Building configuration…
Current configuration : 3096 bytes
!
! Last configuration change at 21:14:03 UTC Thu Sep 19 2019
!
version 15.2
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
!
hostname S2
!
boot-start-marker
boot-end-marker
!
enable secret 5 $1$xNwL$Yvok3XJfU3OAjd91Jl6m2.
!
no aaa new-model
system mtu routing 1500
!
no ip domain-lookup
!
spanning-tree mode rapid-pvst
spanning-tree extend system-id
!
vlan internal allocation policy ascending
!
interface FastEthernet0/1
switchport trunk allowed vlan 3,4,8
switchport trunk native vlan 8
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/3
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/4
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/5
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/6
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/7
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/8
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/9
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/10
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/11
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/12
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/13
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/14
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/15
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/16
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/17
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/18
switchport access vlan 4
switchport mode access
!
interface FastEthernet0/19
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/20
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/21
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/22
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/23
switchport access vlan 7
switchport mode access
shutdown
!
interface FastEthernet0/24
switchport access vlan 7
switchport mode access
shutdown
!
interface GigabitEthernet0/1
switchport access vlan 7
switchport mode access
shutdown
!
interface GigabitEthernet0/2
switchport access vlan 7
switchport mode access
shutdown
!
interface Vlan1
no ip address
shutdown
!
interface Vlan3
ip address 192.168.3.12 255.255.255.0
!
ip default-gateway 192.168.3.1
ip http server
ip http secure-server
!
banner motd ^C Authorized Users Only! ^C
!
line con 0
password 7 01100F175804
login
line vty 0 4
password 7 01100F175804
login
line vty 5 15
password 7 01100F175804
login
!
end
Router R1
R1# show run
Building configuration…
Current configuration : 1940 bytes
!
version 16.9
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
platform qfp utilization monitor load 80
no platform punt-keepalive disable-kernel-core
!
hostname R1
!
boot-start-marker
boot-end-marker
!
!
vrf definition Mgmt-intf
!
address-family ipv4
exit-address-family
!
address-family ipv6
exit-address-family
!
enable secret 5 $1$o5iu$mWblQ/HSFMXl8z3PGLI../
!
no aaa new-model
!
no ip domain lookup
!
login on-success log
!
subscriber templating
!
multilink bundle-name authenticated
!
license boot level appxk9
license boot level securityk9
no license smart enable
diagnostic bootup level minimal
!
spanning-tree extend system-id
!
redundancy
mode none
!
interface GigabitEthernet0/0/0
no ip address
negotiation auto
!
interface GigabitEthernet0/0/1
no ip address
negotiation auto
!
interface GigabitEthernet0/0/1.3
description Management Network
encapsulation dot1Q 3
ip address 192.168.3.1 255.255.255.0
!
interface GigabitEthernet0/0/1.4
description Operations Network
encapsulation dot1Q 4
ip address 192.168.4.1 255.255.255.0
!
interface GigabitEthernet0/0/1.8
description Native VLAN
encapsulation dot1Q 8 native
!
interface Serial0/1/0
no ip address
!
interface Serial0/1/1
no ip address
!
interface GigabitEthernet0
vrf forwarding Mgmt-intf
no ip address
negotiation auto
!
ip forward-protocol nd
no ip http server
ip http secure-server
!
control-plane
!
banner motd ^C Authorized Users Only! ^C
!
line con 0
password 7 01100F175804
login
transport input none
stopbits 1
line aux 0
stopbits 1
line vty 0 4
password 7 070C285F4D06
login
!
end
• Recommend