---
title: "CCNA: OSI vs TCP/IP and Cabling | CyberWithMadhav"
description: "Free CCNA 200-301 lesson: OSI and TCP/IP layers, encapsulation, routers, switches, APs, firewalls, copper and fibre, TCP vs UDP and ports, with a lab."
url: https://www.cyberwithmadhav.com/learn-ccna-network-building-blocks.html
source_format: markdown rendering of the HTML page
---

[Learn](https://www.cyberwithmadhav.com/learn.html) / [Stage 3: Networking and CCNA](https://www.cyberwithmadhav.com/learn.html#stage-3) / Lesson 3.1

$ lesson 3.1 --track ccna --domain fundamentals

# Network Building Blocks: OSI, TCP/IP, Devices, Cabling, Interfaces

Before VLANs, routing and security, you need a clear picture of what a network is made of: the layers every packet passes through, the job of each box, the cables between them, and how to read an interface when something feels slow.

- Stage **3** Networking and CCNA
- Level **Beginner**
- **55** min
- **5** sections, quiz, lab

Start the lesson Jump to the lab

## In this lesson

1. Layers and encapsulation: how data gets wrapped
2. What each device does
3. Cabling, duplex and the physical layer
4. TCP, UDP and the ports you must know
5. Reading interfaces like an engineer
6. Flashcards
7. Quick quiz
8. Hands-on lab
9. Key takeaways

## By the end of this lesson you can

- Map the OSI layers to the TCP/IP model and name the unit of data at each
- Explain the job of routers, switches, Layer 3 switches, APs, WLCs, firewalls and IPS
- Choose copper, multimode or single-mode fibre for a run
- Compare TCP and UDP and recall the well known ports
- Diagnose duplex and cabling problems from show interfaces

3.1.01

## Layers and encapsulation: how data gets wrapped

Lesson 1.4 introduced the layers. The CCNA expects you to use them as a tool: when something breaks, you work out which layer is failing and test that layer. Two models describe the same idea.

The seven OSI layers are a teaching and troubleshooting vocabulary. The TCP/IP model (often drawn with four layers, sometimes five with physical split out) describes the protocols that actually run.

As data goes down the stack, each layer adds its own header: the application's data gets a TCP or UDP header (now a **segment** or **datagram**), then an IP header (a **packet**), then an Ethernet header and trailer (a **frame**), and finally the physical layer turns it into electrical, light or radio signals (**bits**). The receiver strips the headers in reverse. That is **encapsulation** and **de-encapsulation**.

- A switch normally reads up to Layer 2 (MAC addresses in the frame).
- A router reads up to Layer 3 (IP addresses in the packet), and rebuilds a new Layer 2 frame for every hop.
- Firewalls read Layers 3 and 4 (addresses and ports), and next generation firewalls look into Layer 7 (which application, which URL).

Think of it like this

A letter goes in an envelope with the flat number (port), the envelope goes in a courier bag with the city address (IP), and the bag rides on whatever truck covers the next stretch of road (the frame). Each depot opens only the outer layer it needs and puts the bag on a new truck.
Defender move

Name the layer before you pick a control: ARP spoofing is a Layer 2 problem (fixed with Dynamic ARP Inspection, lesson 3.12), IP spoofing is Layer 3 (ACLs, lesson 3.9), session hijacking lives in the upper layers (fixed with TLS). The wrong layer means the wrong fix.

3.1.02

## What each device does

| Device | Works at | Job |
| --- | --- | --- |
| Layer 2 switch | L2 | Forwards frames by MAC address inside one network (one VLAN). Learns which MAC lives on which port. |
| Router | L3 | Forwards packets by IP address between networks. Chooses the path using its routing table. |
| Layer 3 (multilayer) switch | L2 and L3 | Switches and routes in hardware. Common as the core or distribution layer inside a campus. |
| Access point (AP) | L1 and L2 | Bridges Wi-Fi clients onto the wired network. |
| Wireless LAN controller (WLC) | management | Configures and manages many lightweight APs centrally (lesson 3.13). |
| Firewall / NGFW and IPS | L3 to L7 | Stateful filtering; next generation firewalls add application awareness and intrusion prevention, which blocks known attack patterns inline. |
| Endpoints and servers | all layers | Laptops, phones, cameras and printers; servers provide services like DNS, DHCP, web and file sharing. |
| PoE switch | L1 and L2 | Power over Ethernet: powers phones, cameras and APs over the data cable. |

You will also meet the classic designs. A **two tier** (collapsed core) campus has access switches connected to a pair of core and distribution switches. A **three tier** campus separates access, distribution and core. Data centres use **spine and leaf**, where every leaf switch connects to every spine, so any two servers are the same number of hops apart. A **SOHO** (small office, home office) network often has one box that is router, switch, AP and firewall at once, and the WAN connects sites to each other and to the cloud.
How attackers abuse this

Attackers love physical access. A live, unused wall port, or a cheap unmanaged switch someone put under a desk, lets a rogue laptop or a tiny implant join the internal network with no password at all.
Defender move

Shut unused switch ports and put them in an unused VLAN, lock wiring closets, label everything, and use port security or 802.1X so only known devices get access (lessons 3.4 and 3.12).

3.1.03

## Cabling, duplex and the physical layer

| Medium | Typical reach | Use it for |
| --- | --- | --- |
| Copper UTP (Cat5e, Cat6, Cat6A) | Up to 100 m per run for common Ethernet | Desks, phones, APs, PoE devices |
| Multimode fibre (MMF) | Hundreds of metres, depending on speed and fibre grade | Inside a building, between floors and racks |
| Single-mode fibre (SMF) | Kilometres | Between buildings, campuses and service providers |

Fibre does not make a single link magically faster; its advantages are distance and immunity to electrical noise. Old Ethernet needed crossover cables between similar devices, but modern ports use **Auto-MDIX** and work with either cable. In Packet Tracer you still pick the cable type, so the copper straight-through cable is the normal choice between a PC and a switch.

### Half and full duplex

Hubs created one shared medium where only one device could talk at a time (**half duplex**), and collisions were normal. Switch ports are point to point, so both sides talk at once (**full duplex**) and you should see **zero collisions**. When one side is set to full and the other falls back to half, you get a **duplex mismatch**: the link works but is slow, the half duplex side counts collisions and *late collisions*, and the full duplex side counts CRC and input errors. The fix is to leave both ends on auto, or set both ends the same.
Think of it like this

Full duplex is a phone call: both talk and listen at once. Half duplex is a walkie talkie: one talks, the other waits. A mismatch is one person on a phone call and the other holding a walkie talkie, constantly cutting each other off.

3.1.04

## TCP, UDP and the ports you must know

**TCP** is connection oriented. It sets up a session with a three way handshake, numbers every byte, acknowledges what arrived, resends what was lost and uses a window to control speed. **UDP** just sends: no handshake, no recovery, very little overhead. That makes UDP right for voice, video, DNS queries and anything where a late packet is useless anyway.

Every TCP connection starts like this. A port that answers SYN with SYN-ACK is open; that is exactly what a port scanner looks for.

| Port | Protocol | Transport | Note |
| --- | --- | --- | --- |
| 20, 21 | FTP | TCP | Cleartext; prefer SFTP |
| 22 | SSH | TCP | Encrypted remote admin |
| 23 | Telnet | TCP | Cleartext passwords: disable it |
| 25 | SMTP | TCP | Mail between servers |
| 53 | DNS | UDP and TCP | TCP for large answers and zone transfers |
| 67, 68 | DHCP | UDP | Server 67, client 68 |
| 69 | TFTP | UDP | No authentication, used for config and image copies |
| 80, 443 | HTTP, HTTPS | TCP (HTTP/3 uses UDP 443) | Web |
| 123 | NTP | UDP | Time sync, vital for log correlation |
| 161, 162 | SNMP | UDP | Monitoring; traps on 162 |
| 514 | Syslog | UDP | Log messages |

How attackers abuse this

An open Telnet port sends usernames and passwords in cleartext, so anyone who can capture traffic on the path can read them. And because a SYN gets a SYN-ACK from any open TCP port, scanners map every listening service on a network in minutes.
Defender move

Turn off what you do not need, replace cleartext protocols (Telnet, FTP, HTTP management) with SSH, SFTP and HTTPS, and filter management ports so only admin subnets reach them (lessons 3.3 and 3.9).

3.1.05

## Reading interfaces like an engineer

Two commands answer most physical layer questions. `show ip interface brief` gives one line per interface with its IP and two status words: **Status** is Layer 1 (is there a working link?) and **Protocol** is Layer 2 (is the data link working?). `show interfaces` adds duplex, speed and the error counters.

| Status / Protocol | Means | Check |
| --- | --- | --- |
| up / up | Working | Nothing to fix at L1 and L2 |
| administratively down / down | Someone typed shutdown | no shutdown |
| down / down | No physical link | Cable, the other end, wrong port |
| up / down | Link is there but L2 fails | Encapsulation or keepalive mismatch, a problem at the far end |

In the counters, **CRC** and **input errors** rising usually means a bad cable, interference or a duplex mismatch; **late collisions** on a switched link almost always mean a duplex mismatch. Practise reading them on R1 below. One of its interfaces has a problem.

console: Router (R1 interfaces)

#### Missions  0/8

Simplified IOS simulator in your browser. It teaches the commands; Packet Tracer and real gear have many more.

## Flashcards: do you remember?

Tap a card to flip it. Try to answer in your head first; recalling is what makes it stick.

## Quick quiz

Instant feedback on every answer. Score 70% or more to pass this lesson's quiz.

### Q1 Which device forwards traffic between different IP networks?

### Q2 A PC's data gets an IP header. What is it called now?

### Q3 Which link should you choose between two buildings 3 km apart?

### Q4 Which application is best suited to UDP?

### Q5 An interface shows `administratively down`. Fix?

### Q6 You see rising CRC errors on one side and late collisions on the other. Most likely cause?

**0 / 6**

## Hands-on lab

Cisco Packet Tracer lab  30 minutes  simulated network

### Packet Tracer lab 3.1: build, cable and read interfaces

**You need:** Cisco Packet Tracer (free with a Cisco Networking Academy account; version 9.0.1 was the current download on the NetAcad Resource Hub when this lesson was written). Devices: 1 x 2960-24TT switch, 1 x ISR4331 router, 2 x PC-PT, copper straight-through cables.

**Simulator lab, zero risk.** This lab runs inside Cisco Packet Tracer, so it touches no real network. Packet Tracer is free with a Cisco Networking Academy account (netacad.com). It simulates a subset of Cisco IOS, so where support for a feature is uncertain we say so instead of promising it works.

#### Topology and addressing

PC1 and PC2 connect to SW1 on Fa0/1 and Fa0/2; SW1 Gi0/1 connects to R1 Gi0/0/0.

| Device | Interface | IPv4 address / prefix | Default gateway or note |
| --- | --- | --- | --- |
| R1 | Gi0/0/0 | 192.168.10.1/24 | n/a |
| PC1 | Fa0 | 192.168.10.11/24 | 192.168.10.1 |
| PC2 | Fa0 | 192.168.10.12/24 | 192.168.10.1 |

1. Place and cableAdd the devices and cable them as in the diagram. Watch the link lights: switch ports often show orange for a short time before turning green, because they pass through spanning tree states first (lesson 3.5).  Done
2. Configure R1`Router>  enable   Router#  configure terminal   Router(config)#  hostname R1   R1(config)#  interface GigabitEthernet0/0/0   R1(config-if)#  ip address 192.168.10.1 255.255.255.0   R1(config-if)#  no shutdown   R1(config-if)#  end`  Done
3. Address the PCsOn each PC open Desktop, then IP Configuration, and enter the address, mask and gateway from the table.  Done
4. Test and watch the layersFrom PC1's Command Prompt run `ping 192.168.10.1` and `ping 192.168.10.12`. Then switch to Simulation mode, filter for ICMP and ARP, and step through one ping. Open a PDU and match each part to a layer: Ethernet header (L2), IP header (L3), ICMP (the payload).  Done
5. Verify`R1#  show ip interface brief   R1#  show interfaces GigabitEthernet0/0/0   SW1#  show interfaces status`On PC1: `ipconfig` and `arp -a`. The first ping may lose one reply while ARP finds R1's MAC address; that is normal.  Done
6. Force a mismatch and look`SW1(config)#  interface FastEthernet0/1   SW1(config-if)#  duplex half   SW1(config-if)#  speed 10   SW1(config-if)#  end   SW1#  show interfaces FastEthernet0/1`Read the duplex and speed lines, then set the port back with `duplex auto` and `speed auto`.  Done

**You are done when:** R1 Gi0/0/0 is up/up with 192.168.10.1, both PCs ping R1 and each other, and you can point to the L2, L3 and ICMP parts of a PDU in Simulation mode.

#### Packet Tracer limits and notes

- Packet Tracer does not reliably produce realistic CRC errors or late collisions from a duplex mismatch, so treat step 6 as a where to look exercise, not proof of real error behaviour. UNVERIFIED how the counters react in your version.
- Fibre cables exist in Packet Tracer, but the device needs a fibre capable port or module, and module names vary by model. UNVERIFIED per device.
- Packet Tracer simulates a subset of IOS. If a command here is rejected in your version, note it, skip that step and carry on; the concept still applies to real Cisco gear.

[Download the lab checklist (.txt)](https://www.cyberwithmadhav.com/assets/learn/learn-ccna-network-building-blocks-lab-checklist.txt)  Print it or keep it open beside Packet Tracer.

## Key takeaways

- Each layer adds a header; switches read L2, routers L3, NGFWs up to L7.
- Copper to 100 m, multimode in buildings, single-mode for kilometres.
- Switched links are full duplex with zero collisions; late collisions mean a duplex mismatch.
- TCP is reliable and ordered, UDP is fast and light.
- show ip interface brief first, show interfaces for the details.

Finished the sections, quiz and lab? Mark the lesson complete. Progress is saved only in this browser.

[Previous 2.4 Linux Logging, Auditing and Hardening](https://www.cyberwithmadhav.com/learn-linux-logging-auditing-hardening.html)[Next 3.2 IP Addressing: IPv4 Subnetting, VLSM, Private Ranges, IPv6 Basics](https://www.cyberwithmadhav.com/learn-ccna-ip-addressing-subnetting.html)
