Live lesson · progress saved to your account

Networking Fundamentals

OSI and TCP/IP, MAC vs IP vs ports, the TCP handshake, TCP vs UDP, subnetting, and the LAN protocols attackers abuse. Ends with a packet-capture investigation of a broken college lab.

beginner90 minwalkthrough

Anyone can read this lesson. To submit answers and earn XP, create a free account.

TASK 01Mission briefing: Computer Lab 3

HELPDESK · NIT-LAB3-0907 From: Lab admin, a fictional engineering college in Nagpur "Since the new term started, Lab 3 is a mess. One PC has no internet at all. Everyone else says it's slow, and a few students saw certificate warnings. The file share hangs, and the attendance app says its database refuses connections. I've attached a packet capture from PC-05. Please help before the practical exams!"

Four different symptoms. They might be one problem or four. To find out you'll need to understand how packets are built, addressed and delivered on a local network.

Computer lab 3 · network diagram Click a symptom

Internet

Router .1

Lab switch

Server .5 / .9

PC-05

PC-17

PC-66 ?

In this room you'll learn:

  • How data is wrapped in layers (OSI and TCP/IP)
  • The three addresses on every packet: MAC, IP and port
  • How the TCP handshake opens a connection, and how it fails
  • TCP vs UDP
  • Subnetting: who is on "my" network
  • DHCP, ARP and ARP spoofing

Then you'll use a terminal and the packet capture to explain every symptom.

Answer the questions

+10 XP

+10 XP

TASK 02The OSI and TCP/IP models

Networking is split into layers. Each layer does one job and only talks to the layers above and below it. This means Wi-Fi can be swapped for fibre without changing your browser.

Watch a request go down the sender's layers, across the cable, and up the receiver's. Each layer on the way down adds a header (encapsulation), and the matching layer on the other side strips it off (decapsulation):

Encapsulation: down the stack, across, and back up Click a layer

Sender

Data

GET /

cable

Receiver

The browser creates the message: an HTTP request.

#OSI layerUnit (PDU)ExamplesTCP/IP layer
7ApplicationDataHTTP, DNS, SSHApplication
6PresentationDataTLS, encodingApplication
5SessionDataSession trackingApplication
4TransportSegmentTCP, UDPTransport
3NetworkPacketIP, ICMP, routersInternet
2Data linkFrameEthernet, ARP, switchesLink
1PhysicalBitsCables, radioLink

Memory trick (7 → 1): All People Seem To Need Data Processing.

OSI is the teaching model, which is why people say "a layer 2 attack" or "a layer 7 firewall". TCP/IP is what the internet actually runs on, and it squeezes the same ideas into 4 layers.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 03MAC, IP and ports

Every packet carries three kinds of address. Think of sending a parcel to a friend in a hostel:

  • IP address = the hostel's postal address. The final destination, and it stays the same the whole way.
  • Port = the room number. Which program on that computer should get it.
  • MAC address = the courier's next stop. The hardware address of the next device on this link. It changes at every hop.

Click through the hops and watch which address changes:

Three addresses on every packet Click a hop or port

Layer 2 · MAC: who is the next hop on this link?

a4:5e:60:11:22:05 → 00:1a:2b:00:00:01

Changes at every hop.

Layer 3 · IP: who is the final destination?

10.20.30.45 → 203.0.113.10 (after NAT: 49.36.x.x → 203.0.113.10)

Stays the same end to end.

Layer 4 · Port: which program?

:51514 → :443 (HTTPS)

Common ports

443/TCP · HTTPS. Encrypted web. Most traffic on the internet.

A MAC address is 48 bits, written like a4:5e:60:11:22:05. The first half identifies the manufacturer. It's burned into the network card, but software can change (spoof) it.

A port is a number from 0 to 65535. Ports below 1024 are "well-known". When a scanner reports "port 3389 open", it means a program is listening there, in this case Remote Desktop.

Learn these by heart: 22 SSH · 53 DNS · 80 HTTP · 443 HTTPS · 445 SMB · 3389 RDP. You'll see them in every scan, every firewall rule and every incident report.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 04The TCP three-way handshake

TCP (Transmission Control Protocol) gives programs a reliable, ordered stream of data over an unreliable network. Before any data moves, both sides must agree to talk and pick starting sequence numbers, so they can track every byte and notice anything missing.

That agreement is the three-way handshake:

  1. SYN: client → server. "I'd like to connect. My sequence number starts at 100."
  2. SYN-ACK: server → client. "OK. I acknowledge 101 (your next byte). Mine starts at 300."
  3. ACK: client → server. "Acknowledged 301." The connection is ESTABLISHED.

Closing uses FIN packets from each side. An abrupt "no" is an RST (reset).

Pick each scenario and watch the ladder:

The TCP three-way handshake Pick a scenario
Client 10.20.30.45 · CLOSEDServer 10.20.30.5 · LISTEN
What you seeWhat it meansNmap calls it
SYN → SYN-ACKSomething is listeningopen
SYN → RSTHost is up, nothing listeningclosed
SYN → (silence, retries)A firewall dropped itfiltered

Where attackers abuse it:

  • SYN flood: thousands of SYNs from fake IPs fill the server's table of half-open connections, a classic denial of service.
  • Half-open (SYN) scan: nmap -sS sends SYN, reads the reply, then sends RST before finishing. It maps open ports without completing a connection.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 05TCP vs UDP

Not every app wants TCP's reliability. Re-sending a lost packet takes time, and for a live video call a late frame is worse than a missing one.

UDP (User Datagram Protocol) skips the handshake, the acknowledgements and the ordering. It just sends.

TCP vs UDP on the same network Toggle packet loss

TCP sender

Receiver

UDP sender

Receiver

TCP · reliable

Packet 3 is lost, the receiver asks again, it's resent. Everything arrives, in order, but later. Used for web, email, file transfer, SSH.

UDP · fast

Frame 3 is simply gone: a tiny glitch in the call, but nothing waits for it. Used for DNS queries, video calls, gaming, live streams.

TCPUDP
ConnectionHandshake firstNone
DeliveryGuaranteed, in orderBest effort
SpeedSlowerFaster, lower delay
Used forWeb, email, SSH, file transferDNS queries, video calls, online games, live streams, VPNs like WireGuard

Security angle: because UDP has no handshake, the source IP is easy to fake. Attackers send small requests to UDP services (DNS, NTP, memcached) with the victim's IP as the source, and the much larger replies flood the victim. This is a reflection / amplification DDoS.

Answer the questions

+10 XP

+10 XP

+10 XP

TASK 06IP addressing and subnetting

A subnet is a group of addresses that can talk to each other directly, without a router. Your computer decides "is this IP on my network, or do I send it to the gateway?" using its subnet mask.

CIDR

10.20.30.45/24 means: the first 24 bits are the network part, the remaining 8 bits are for hosts.

  • Mask: 255.255.255.0 (24 ones, then 8 zeros)
  • Network address: 10.20.30.0 (host bits all 0)
  • Broadcast: 10.20.30.255 (host bits all 1)
  • Usable hosts: 2⁸ − 2 = 254

Drag the slider and watch the bits recolour:

Subnet calculator Drag the slider
00001010000101000001111010001100
24 network bits8 host bits

Subnet mask

255.255.255.0

Network address

10.20.30.0

Broadcast

10.20.30.255

First host

10.20.30.1

Last host

10.20.30.254

Usable hosts

254

Usable hosts = 28 − 2. The first address names the network and the last is the broadcast, so neither can be given to a device.

Quick table

CIDRMaskUsable hosts
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014
/30255.255.255.2522

History: old "classes" (A = /8, B = /16, C = /24) were replaced by CIDR in 1993 because they wasted addresses.

IPv6 uses 128-bit addresses, and a normal LAN is a /64, which is 18 quintillion addresses. Subnetting there is about structure, not saving addresses.

Practice

Ten challenges. Get 8 or more to pass:

Subnetting drill · 10 challenges 0/0 · 0s

Challenge 1/10 · What is the network address for

192.168.1.77/24

The timer starts with your first answer. Use the calculator above if you're stuck.

Why it matters for security: a wrong subnet mask silently breaks networks (you'll see one in the lab). Firewalls, cloud security groups and network segmentation are all written in CIDR. 0.0.0.0/0 means "the entire internet", the most dangerous thing to put in an allow rule.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 07Core protocols: DHCP, ARP, ICMP and NAT

A few small protocols keep every LAN running, and each one trusts too much.

Life on the LAN Pick a protocol

PC-05 .45

Switch

Router .1

Internet

PC-66 .66

DORA: Discover, Offer, Request, Acknowledge. A new device shouts for an address, and the DHCP server (here the router) leases it one, plus the gateway and DNS server to use. A rogue DHCP server could hand out its own gateway instead.

PC-05 network config

IP10.20.30.45/24

Gateway10.20.30.1

DNS10.20.30.1

ProtocolJobHow it's abused
DHCPHands out IP, mask, gateway and DNS to new devices (Discover, Offer, Request, Ack)A rogue DHCP server gives out its own gateway or DNS
ARPFinds the MAC address for an IP on the local networkARP spoofing: fake replies make traffic flow through the attacker (man-in-the-middle)
ICMPError and test messages: ping (echo), traceroute (TTL exceeded)Ping sweeps to find live hosts, ICMP floods
NATLets many private IPs share one public IP (Room 03)Not an attack target itself, but it's why inside devices aren't directly reachable

Tools you'll use in the lab

  • ipconfig (Windows) / ip a (Linux): this machine's IP, mask and gateway
  • ping <ip>: does it answer?
  • tracert / traceroute: which routers are on the way? Each line is one hop.
  • arp -a: the ARP table. Two IPs with the same MAC is a red flag.
  • netstat -an: open connections and their TCP state

Defences against ARP spoofing: Dynamic ARP Inspection (DAI) on managed switches, port security, static ARP entries for critical devices, and encryption (HTTPS, SSH) so intercepted traffic is useless.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 08Lab: diagnose Lab 3

You have remote access to two lab machines and the admin's packet capture.

Part 1 · Terminal

  1. Run ipconfig on PC-05 (working) and PC-17 (broken). Compare the subnet masks.
  2. On PC-17, ping 10.20.30.1. Why does it fail? (Use the subnet calculator from Task 6 on PC-17's IP and mask: is the gateway inside its subnet?)
  3. On PC-05, run tracert 8.8.8.8. What is the first hop? Should it be?
  4. On PC-05, run arp -a. Which two IPs share a MAC?
  5. On PC-05, run netstat -an. Which connection is stuck?
Lab 3 terminal LAB3-PC-05

anyONEhack network lab · type 'help'. Start with ipconfig on both PCs.

C:\LAB3-PC-05>

Part 2 · Packet capture

Click a packet to see its layers. Try the filters.

lab3-capture.pcap 15 packets
No.TimeSourceDestinationProtoInfo
10.00010.20.30.45BroadcastARPWho has 10.20.30.1? Tell 10.20.30.45
20.00110.20.30.110.20.30.45ARP10.20.30.1 is at 00:1a:2b:00:00:01
30.12010.20.30.4510.20.30.5TCP51514 → 443 [SYN] Seq=0 Win=64240
40.12110.20.30.510.20.30.45TCP443 → 51514 [SYN, ACK] Seq=0 Ack=1
50.12110.20.30.4510.20.30.5TCP51514 → 443 [ACK] Seq=1 Ack=1
60.12210.20.30.4510.20.30.5TLSClient Hello (SNI=attendance.lab.local)
71.40210.20.30.4510.20.30.5TCP51520 → 3306 [SYN] Seq=0
81.40210.20.30.510.20.30.45TCP3306 → 51520 [RST, ACK] Seq=1 Ack=1
92.01010.20.30.4510.20.30.9TCP51522 → 445 [SYN] Seq=0
103.01110.20.30.4510.20.30.9TCP[TCP Retransmission] 51522 → 445 [SYN]
115.01310.20.30.4510.20.30.9TCP[TCP Retransmission] 51522 → 445 [SYN]
126.50010.20.30.6610.20.30.45ARP10.20.30.1 is at 3c:52:82:aa:66:01
137.50010.20.30.6610.20.30.45ARP10.20.30.1 is at 3c:52:82:aa:66:01 (duplicate use of 10.20.30.1 detected!)
148.02010.20.30.458.8.8.8ICMPEcho (ping) request ttl=128
158.0588.8.8.810.20.30.45ICMPEcho (ping) reply ttl=117

Packet 3 · layers

▸ Ethernet II · Src: a4:5e:60:11:22:05 · Dst: 00:1a:2b:00:00:05

▸ IPv4 · Src: 10.20.30.45 · Dst: 10.20.30.5

▸ TCP · src port 51514, dst port 443, flags SYN

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP

TASK 09Final mission: fix Lab 3

Write the report for the lab admin. Explain every symptom with evidence:

SymptomRoot causeEvidence
PC-17 has no internet?ipconfig, ping
Slow internet, certificate warnings?arp -a, tracert, packets 12–13
File share hangs?packets 9–11, netstat
Attendance DB refuses connections?packet 8

Think it through:

  • PC-17 is 10.20.30.140/25. Its subnet runs from .128 to .255. Is 10.20.30.1 in it?
  • Who sent the ARP replies claiming to be 10.20.30.1?
  • RST means "closed", silence means "filtered". Which is which here?

What the admin did next: fixed PC-17's mask, unplugged PC-66 (a student had run an ARP-spoofing tool "to see what happens", which is a crime under IT Act section 43/66 from Room 01), enabled Dynamic ARP Inspection on the switch, opened port 445 on the file server's firewall for the lab subnet only, and restarted the MySQL service.

Complete the mission to earn the Handshake Hero badge and 430 XP.

Answer the questions

+10 XP

+10 XP

+10 XP

+10 XP

+10 XP