Exercice 4.2.7 : Configure Router-on-a-Stick Inter-VLAN Routing
Part 1: Add VLANs to a Switch
Step 1: Create VLANs on S1
Command to create VLAN 10 and VLAN 30:
S1(config)# vlan 10 S1(config)# vlan 30
Step 2: Assign VLANs to Ports
Assign VLAN 10 to the port connected to PC1 (F0/11):
S1(config)# interface f0/11 S1(config-if)# switchport mode access S1(config-if)# switchport access vlan 10
Assign VLAN 30 to the port connected to PC3 (F0/6):
S1(config)# interface f0/6 S1(config-if)# switchport mode access S1(config-if)# switchport access vlan 30
Verify configuration using
show vlan brief
:S1# show vlan brief
Output:
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/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 VLAN0010 active Fa0/11 30 VLAN0030 active Fa0/6 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active
Step 3: Test Connectivity Between PC1 and PC3
Command to test:
PC1> ping 172.17.30.10
Question: Were the pings successful? Why did you get this result? Answer: The pings did not work because the computers are in different IP networks.
Part 2: Configure Subinterfaces
Step 1: Configure Subinterfaces on R1
Configure G0/0.10 for VLAN 10:
R1(config)# interface g0/0.10 R1(config-subif)# encapsulation dot1Q 10 R1(config-subif)# ip address 172.17.10.1 255.255.255.0
Configure G0/0.30 for VLAN 30:
R1(config)# interface g0/0.30 R1(config-subif)# encapsulation dot1Q 30 R1(config-subif)# ip address 172.17.30.1 255.255.255.0
Step 2: Verify Configuration
Use
show ip interface brief
to verify:R1# show ip interface brief
Output: Both subinterfaces are initially down because the physical interface (G0/0) is disabled.
Enable G0/0 to activate subinterfaces:
R1(config)# interface g0/0 R1(config-if)# no shutdown
Part 3: Test Connectivity with Inter-VLAN Routing
Step 1: Ping Between PC1 and PC3
Question: The pings should still fail. Why? Answer: The switch has no trunk port connected to the router yet.
Step 2: Enable Trunking on S1
Configure trunking on G0/1:
S1(config)# interface g0/1 S1(config-if)# switchport mode trunk
Question: How can you determine that the interface is a trunk port using the show vlan
command?
Answer: The interface is not listed in the Ports section when using:show vlan
Use
show interface trunk
to verify:S1# show interface trunk
Output:
Port Mode Encapsulation Status Native vlan
Gig0/1 on 802.1q trunking 1
Port Vlans allowed on trunk
Gig0/1 1-1005
Port Vlans allowed and active in management domain
Gig0/1 1,10,30
Port Vlans in spanning tree forwarding state and not pruned
Gig0/1 1,10,30
Step 3: Test Connectivity
Question: What addresses do PC1 and PC3 use as their default gateway addresses? Answer: They use the subinterface's address.
Last updated