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

PortServiceNote
20/21FTPSends passwords in clear text
22SSH / SFTPEncrypted remote login; constant password-guessing target
23TelnetClear text; should be off everywhere
25, 587SMTPSending email
53DNSUDP for lookups, TCP for big answers and zone transfers
67/68DHCPUDP
80 / 443HTTP / HTTPSWeb; 443 is HTTP inside TLS
110, 143 / 993, 995POP3, IMAP / their TLS versionsReading email
123NTPTime sync (accurate time matters for logs)
135, 139, 445RPC, NetBIOS, SMBWindows file sharing; worms such as WannaCry spread over 445
161/162SNMPDevice monitoring; default "public" community strings leak data
389 / 636LDAP / LDAPSDirectory lookups (Active Directory)
88KerberosWindows domain logins
1433, 3306, 5432SQL Server, MySQL, PostgreSQLDatabases should never face the internet
3389RDPWindows 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.

💻Your computer10.10.10.20🗄️Server10.10.10.5not connected
what a packet capture shows
(nothing captured yet)
Step 1 of 6Before any real data is sent, TCP sets up a connection with three short messages. Think of starting a phone call: you don't start talking until you know the other person is there.

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.

💻Your laptop10.10.10.20📒Resolver10.10.10.53 :53🌳Root serverknows who has .com🏷️.com serverknows example.com's NS🏠example.com's serverthe real answerexample.com? #3f2a

The resolver's notebook (cache)

nothing about example.com yet

Step 1 of 7You type example.com. But computers connect using numbers (IP addresses), the way you need a phone number to call a person. So your laptop asks its resolver: “What's the number for example.com?” It tags the question with ID 0x3f2a.

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.

Lab: investigate your own network

1. Show your network interfaces and IP addresses.

student@lab-ubuntu:~$

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.

12 left in the deck

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.