Lab 4 — Inter-VLAN Routing

Two VLANs, one switch, one router.

Build the VLANs, trunk the uplink, and let a single router interface serve both VLANs as their gateway. Work through it in order — check steps off, copy the commands, and finish with the show commands that prove the path.

Interactive lab — play with it

A simulated CLI for this lab. Click a PC, the switch, or the router, type the commands, and watch the inter-VLAN path come up only when every piece is really in place.

A simulated CLI for this lab — click a PC, the switch, or the router, type the commands, and watch the path come up only when every piece is really in place. This models Lab 4’s commands only, not real devices: unsupported commands say so instead of faking it. Type ? for help and use Tab to complete a command.

Setting up…
Topologydrag to pan · double-click a device for its console
Gi0/1 · trunk → G0/0
100%
Windows
Microsoft Windows [Version 10.0.19045.0]
(c) Microsoft Corporation. All rights reserved.
C:\>

Up/down arrows recall commands. The full command list is in the walkthrough below.

Interactive lab

Lab 4 — Inter-VLAN Routing

Two VLANs, one switch, one router. Build the VLANs, trunk the uplink, and let a single router interface serve both VLANs as their gateway.

Click a device to open its console, type the real commands, and check your work when you think it’s done. The lab checks each step as you go.

Walkthrough — commands in order

Two VLANs, one switch, one router. Build the VLANs, trunk the uplink, and let a single router interface serve both VLANs as their gateway — router-on-a-stick.

        VLAN 10 Eng — 10.10.10.0/24          VLAN 20 Sales — 10.10.20.0/24
  PC-Eng ── Fa0/1 [SW1] Gi0/1 ═════ G0/0 [R1] G0/0.10 10.10.10.1
  PC-Sales ── Fa0/3 [SW1]  trunk   G0/0.20 10.10.20.1
        Native VLAN 199 (untagged on the trunk)

Where this shows up in the data center

Router-on-a-stick isn’t how the Oracle fabric routes — the fabric handles that — but the skill is the same one I use when a host can’t reach its gateway: prove the VLAN exists on the switch, prove the trunk carries it, prove the gateway address is really on the router. It’s the same verify-before-you-change-it discipline as checking LLDP neighbors and optical levels before touching a fiber link.

SW1(config)# vlan 10
SW1(config-vlan)# name Eng
SW1(config-vlan)# vlan 20
SW1(config-vlan)# name Sales
SW1(config-vlan)# vlan 199
SW1(config-vlan)# name Native
SW1(config)# interface fa0/1
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 10
SW1(config)# interface fa0/3
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 20
SW1(config)# interface gi0/1
SW1(config-if)# switchport mode trunk
SW1(config-if)# switchport trunk allowed vlan 10,20
SW1(config-if)# switchport trunk native vlan 199
R1(config)# interface g0/0
R1(config-if)# no ip address
R1(config-if)# no shutdown
R1(config)# interface g0/0.10
R1(config-subif)# encapsulation dot1Q 10
R1(config-subif)# ip address 10.10.10.1 255.255.255.0
R1(config)# interface g0/0.20
R1(config-subif)# encapsulation dot1Q 20
R1(config-subif)# ip address 10.10.20.1 255.255.255.0

A subinterface without encapsulation stays down — the gateway never answers until both the encapsulation and the address are set.

C:\> ping 10.10.20.10
C:\> ping 10.10.10.1

Run these from the Eng PC. The first proves inter-VLAN routing; the second proves the gateway itself answers.

Verify it worked

Don’t trust the config until a show command proves it. These are the outputs you should see — if yours differ, that’s the troubleshooting.

SW1# show vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/2, Fa0/4, Gi0/2
10   Eng                              active    Fa0/1
20   Sales                            active    Fa0/3
199  Native                           active
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup

SW1# show interfaces trunk

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

Port        Vlans allowed on trunk
Gi0/1       10,20

Port        Vlans allowed and active in management domain
Gi0/1       10,20

R1# show ip interface brief

Interface              IP-Address      OK? Method Status                Protocol
GigabitEthernet0/0     unassigned      YES unset  up                     up
GigabitEthernet0/0.10  10.10.10.1      YES manual up                     up
GigabitEthernet0/0.20  10.10.20.1      YES manual up                     up

Check yourself

Three questions from the exam angle. Tap to reveal the answer — say it out loud first.

Q1. Why does a subinterface need "encapsulation dot1Q 10" before it can have an IP address?

Q2. Why does G0/0 itself get no IP address?

Q3. PC-Eng can ping its gateway but not PC-Sales. What do you check?

Next labs:

Keep going: Lab 5 — EtherChannel bundles parallel links into single logical links, or go back to Lab 3 — ACLs & NAT. All labs are on the labs hub.