Lab 17 — Router and Switch Basics

Two routers, a switch, and one /24 — from factory defaults.

Name the devices, address the interfaces, give the switch a gateway, then learn what CDP, speed, and duplex actually do by breaking them on purpose. Work through it in order — check steps off, copy the commands, and finish with the show commands.

Interactive lab — play with it

A simulated CLI for this lab. Click a device, type the commands, and watch the show outputs change as the config does.

A simulated CLI for this lab — click a device, type the commands, and watch the show outputs change as the config does. The lab starts unconfigured on purpose: default hostnames, no addresses, interfaces down. This models Pack 14’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
Fa0/0 · 10.10.10.1
Fa0/2 · 10.10.10.2
100%
user EXEC
Lab 17 — Router and Switch Basics simulator — simulated IOS 15.0(1)M4. Type ? for help.
Only this lab's commands are simulated; unsupported commands say so.
Router>

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

Interactive lab

Lab 17 — Router and Switch Basics

Two routers and a switch, all on 10.10.10.0/24, starting from factory defaults. Name them, address them, give the switch a gateway, describe the links, set speed and duplex by hand — then watch CDP and the link itself tell you what each setting actually does.

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 routers and a switch on one /24, starting from factory defaults. The fundamentals every other lab assumes: name the devices, address the interfaces, give the switch a gateway — then learn what CDP, speed, and duplex actually do by breaking them on purpose.

  10.10.10.0/24
R1 Fa0/0 ── 10.10.10.1 ── Fa0/1 [SW1] Fa0/2 ── 10.10.10.2 ── R2 Fa0/0
                           Vlan1 10.10.10.10

Where this shows up in the data center

This is the device-level work underneath everything else in the data center. Before I touch a link I confirm what is on the other end — LLDP is the habit in the data center, CDP is the same idea on Cisco gear — and I check the optics and the negotiated speed and duplex before I blame the config. A duplex mismatch is the classic "the link is up but nothing works" fault, and the first thing I check when a replacement optic or a moved cable does not come up is whether the two ends agree. Same discipline at any scale: verify the neighbor, verify the link, then change something — never the other way round.

R1(config)# hostname R1
R2(config)# hostname R2
SW1(config)# hostname SW1

Each device starts at the default hostname — this step is what makes the rest of the lab readable.

R1(config)# interface fa0/0
R1(config-if)# ip address 10.10.10.1 255.255.255.0
R1(config-if)# no shutdown
R2(config)# interface fa0/0
R2(config-if)# ip address 10.10.10.2 255.255.255.0
R2(config-if)# no shutdown
SW1(config)# interface vlan 1
SW1(config-if)# ip address 10.10.10.10 255.255.255.0
SW1(config-if)# no shutdown
SW1(config)# ip default-gateway 10.10.10.2
SW1# ping 10.10.10.2

Expect 5/5 replies, min/avg/max 1/2/8 ms.

R1(config-if)# description Link to SW1
R2(config-if)# description Link to SW1
SW1(config-if)# description Link to R1
SW1(config-if)# description Link to R2

One description per interface — R1 and R2 Fa0/0 both point at SW1, SW1 Fa0/1 points at R1, Fa0/2 at R2.

SW1(config-if)# speed 100
SW1(config-if)# duplex full
R2(config-if)# speed 100
R2(config-if)# duplex full

On SW1 this is Fa0/2, the link to R2. R1 and SW1 Fa0/1 stay on auto-negotiation.

SW1# show cdp neighbors
SW1(config)# interface fa0/1
SW1(config-if)# no cdp enable
R1(config)# no cdp run
R1(config)# cdp run
R1# show cdp neighbors

After the flush, R1 sees no neighbors at all — but SW1 still sees R2 on Fa0/2, because only Fa0/1 was disabled.

SW1(config)# interface fa0/2
SW1(config-if)# shutdown
SW1(config-if)# no shutdown
SW1# show interfaces status
SW1(config)# interface fa0/2
SW1(config-if)# duplex half
SW1# show interfaces status
R2# show ip interface brief

SW1 reports Fa0/2 down/down; R2 reports Fa0/0 up/down. Same dead link, two different readings — the router side keeps its status up because the interface itself is fine.

SW1(config-if)# duplex full
SW1# show interfaces status
SW1(config-if)# speed 10
SW1# show ip interface brief
R2# show ip interface brief

SW1 Fa0/2 reads down/down again; R2 Fa0/0 reads up/down again. Leave it down — that is where the pack ends.

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 cdp neighbors

Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
                  D - Remote, C - CVTA, M - Two-port Mac Relay

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
R2               Fas 0/2           148        R           C2800     Fas 0/0

R1# show cdp neighbors

Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
                  D - Remote, C - CVTA, M - Two-port Mac Relay

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID

SW1# show interfaces status

Port      Name               Status       Vlan       Duplex   Speed  Type
Fa0/1     Link to R1         connected    1          a-full   a-100  10/100BaseTX
Fa0/2     Link to R2         notconnect   1          half     100    10/100BaseTX
Fa0/3                        connected    1          a-full   a-100  10/100BaseTX
Fa0/4                        connected    1          a-full   a-100  10/100BaseTX
Gi0/1                        connected    1          a-full   a-1000 10/100/1000BaseTX
Gi0/2                        connected    1          a-full   a-1000 10/100/1000BaseTX

R2# show ip interface brief

Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        10.10.10.2      YES manual up                     down

SW1# show ip interface brief

Interface               IP-Address      OK? Method Status               Protocol
FastEthernet0/1         unassigned      YES unset  up                   up
FastEthernet0/2         unassigned      YES unset  down                 down
FastEthernet0/3         unassigned      YES unset  up                   up
FastEthernet0/4         unassigned      YES unset  up                   up
GigabitEthernet0/1      unassigned      YES unset  up                   up
GigabitEthernet0/2      unassigned      YES unset  up                   up
Vlan1                   10.10.10.10     YES manual up                   up

SW1# show version

Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 15.0(2)SE, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2012 by Cisco Systems, Inc.

SW1 uptime is 12 minutes
System returned to ROM by power-on
System image file is "flash:/c2960-lanbasek9-mz.150-2.SE.bin"

Configuration register is 0xF

Check yourself

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

Q1. SW1 Fa0/2 reads down/down and R2 Fa0/0 reads up/down for the same dead link. Why the difference?

Q2. After no cdp enable on SW1 Fa0/1 and a no cdp run / cdp run cycle on R1, why does SW1 still see R2?

Q3. You set speed 100 and duplex full on SW1 Fa0/2, then shut the interface and bring it back. Is the speed still 100?

Next labs:

Keep going: Lab 18 — Life of a Packet follows a ping from a hostname to a MAC address, or go back to Lab 1 — VLANs, Trunking & STP. All eighteen are on the labs hub.