Module 2 · Networking Fundamentals · Lesson 6 of 75
TCP, UDP, ports, DNS and HTTP, with a hands-on lab
How TCP connections start, what UDP is for, the ports every analyst knows, how DNS and HTTP work, and the commands to troubleshoot a network.
In this lesson · about 40 minutes
- Explain the TCP three-way handshake and when UDP is used instead
- Match common services to their port numbers
- Use ip, ping, traceroute, dig and ss to investigate a network
TCP and the three-way handshake
Before any data flows, TCP sets up a connection: the client sends SYN, the server answers SYN-ACK, the client replies ACK. After that, every segment is numbered and acknowledged, so lost data is resent and arrives in order. Connections end with FIN (polite) or RST (abrupt).
Security angles: a SYN flood sends thousands of SYNs and never finishes, filling the server's table of half-open connections. Port scanners such as Nmap send a SYN and watch the answer: SYN-ACK means open, RST means closed, silence usually means filtered by a firewall.
UDP
No handshake, no resends. Used where speed matters more than perfection, or where the application handles it: DNS lookups, video calls, games, DHCP, NTP, VPNs like WireGuard. Because there is no handshake, UDP source addresses are easy to fake, which is how amplification attacks work (a small spoofed question to a DNS or NTP server makes it fire a big answer at the victim).
Ports every security person knows
| Port | Service | Note |
|---|---|---|
| 20/21 | FTP | Sends passwords in clear text |
| 22 | SSH / SFTP | Encrypted remote login; constant password-guessing target |
| 23 | Telnet | Clear text; should be off everywhere |
| 25, 587 | SMTP | Sending email |
| 53 | DNS | UDP for lookups, TCP for big answers and zone transfers |
| 67/68 | DHCP | UDP |
| 80 / 443 | HTTP / HTTPS | Web; 443 is HTTP inside TLS |
| 110, 143 / 993, 995 | POP3, IMAP / their TLS versions | Reading email |
| 123 | NTP | Time sync (accurate time matters for logs) |
| 135, 139, 445 | RPC, NetBIOS, SMB | Windows file sharing; worms such as WannaCry spread over 445 |
| 161/162 | SNMP | Device monitoring; default "public" community strings leak data |
| 389 / 636 | LDAP / LDAPS | Directory lookups (Active Directory) |
| 88 | Kerberos | Windows domain logins |
| 1433, 3306, 5432 | SQL Server, MySQL, PostgreSQL | Databases should never face the internet |
| 3389 | RDP | Windows remote desktop; heavily attacked |
DNS: the internet's phone book
Your computer asks a resolver "what is the address of www.example.com?". The resolver asks a root server, then the .com servers, then example.com's own name server, and caches the answer for its TTL. Record types: A (IPv4), AAAA (IPv6), CNAME (alias), MX (mail server), TXT (text, including SPF and DMARC email-security policies), NS (name servers), PTR (reverse lookup). Attackers abuse DNS for phishing look-alike domains, cache poisoning, and smuggling data out inside DNS queries ("DNS tunnelling").
HTTP in brief
A browser sends a request (method such as GET or POST, a path, headers, sometimes a body) and the server sends a response (a status code, headers and a body). Status codes: 2xx success, 3xx redirect, 4xx your mistake (401 not logged in, 403 forbidden, 404 not found), 5xx the server's mistake. HTTP itself is stateless, so sites use cookies to remember who you are. You will pick HTTP apart in Modules 11 and 12.
Try it · watch it move
The TCP handshake as a phone call
Step through a TCP connection: SYN, SYN-ACK, ACK, data, then FIN. Try the version where the port is closed and see the RST.
(nothing captured yet)
Try it · watch it move
Follow a name lookup (DNS)
Follow a DNS question from your laptop to the root, the top-level domain and the domain's own server, then see the answer get cached.
The resolver's notebook (cache)
nothing about example.com yet
Hands-on lab (simulated terminal)
Lab: investigate your own network
You are on an Ubuntu VM in your home lab. Everything here is your own machine, so no permission issues. The output is simulated with made-up addresses.
Step 1 of 6. Type each command and press Enter. Nothing runs on your computer.
1. Show your network interfaces and IP addresses.
Flashcards
Module 2 flashcards
0 of 12 known
Say the answer out loud, flip the card, then be honest: cards you miss come back at the end.
Practice exam
Module 2 checkpoint
10 questions, 12 minutes.
- 10 questions · 12 minutes
- No feedback until you submit. Flag questions to come back to them.
- Aim for 85% or better before you move on. The real exam's 750 out of 900 is roughly 80–83%.
Written by Noviq Academy in its own words. All labs are simulations: no real systems are touched, and every name, address, password and hash is made up. The offensive techniques taught here are for defending systems and for authorised testing only; never scan, access or test a system without the owner's written permission. Tool and product names belong to their owners, and command output may differ slightly from yours. Read-aloud uses your device's built-in voices.