Part 3 of the "Hacking from Zero" series

Networking Fundamentals Every Hacker Must Know

Published June 7, 2026 ยท By 0xiMAK

"To hack a network, you must first understand it."

Understanding networks is foundational โ€” you can memorize tools but lack effectiveness without grasping why ports exist, how data moves, or what DNS does. This guide covers networking concepts repeatedly encountered in TryHackMe and real penetration testing work.

๐ŸŒ The OSI Model โ€” The 7 Layers Explained

The OSI framework describes how data travels between machines. You'll encounter this constantly in cybersecurity contexts.

LayerNameWhat It DoesHacker Relevance
7ApplicationUser-facing protocols (HTTP, FTP, DNS)SQL injection, XSS, web attacks
6PresentationEncryption, encoding, compressionSSL/TLS stripping, encoding attacks
5SessionManages sessions between devicesSession hijacking
4TransportTCP/UDP โ€” reliable deliveryPort scanning, DoS
3NetworkIP addressing, routingIP spoofing, MITM
2Data LinkMAC addresses, switchesARP poisoning, MAC spoofing
1PhysicalCables, signals, hardwarePhysical access attacks

Memory trick: "Please Do Not Throw Sausage Pizza Away" (Physical, Data Link, Network, Transport, Session, Presentation, Application)

As a hacker, you'll primarily work at Layers 3โ€“7. Understanding all 7 helps you know where in the stack an attack occurs.

๐Ÿ“ฆ TCP vs UDP โ€” The Two Transport Protocols

Everything on the internet travels via either TCP or UDP at the Transport layer (Layer 4).

TCP โ€” Transmission Control Protocol

TCP is reliable. It guarantees that data arrives, in order, without errors. It does this via a three-way handshake:

Client  โ†’  SYN        โ†’  Server    (I want to connect)
Client  โ†  SYN-ACK    โ†  Server    (OK, I'm ready)
Client  โ†’  ACK        โ†’  Server    (Great, let's go)

Why hackers care:

Used by: HTTP, HTTPS, SSH, FTP, SMTP โ€” most services you'll target

UDP โ€” User Datagram Protocol

UDP is fast but unreliable. It fires packets and doesn't check if they arrived. No handshake.

Why hackers care:

Used by: DNS, DHCP, SNMP, VoIP, online gaming

๐Ÿ”ข IP Addresses & Subnetting

IPv4

An IP address is a 32-bit number written as four octets:

192.168.1.100

Each octet is 0โ€“255. There are roughly 4.3 billion possible IPv4 addresses โ€” almost all assigned.

Private IP ranges (not routable on the internet):

RangeCommon Use
10.0.0.0โ€“10.255.255.255Large corporate networks
172.16.0.0โ€“172.31.255.255Medium networks
192.168.0.0โ€“192.168.255.255Home networks

On TryHackMe, target machines are typically in the 10.10.x.x range.

Subnetting & CIDR Notation

A subnet divides a network into smaller segments. CIDR notation tells you how many bits are used for the network vs host:

192.168.1.0/24   โ†’  256 addresses (192.168.1.0 โ€“ 192.168.1.255)
10.0.0.0/8       โ†’  16,777,216 addresses
192.168.1.0/30   โ†’  4 addresses (useful for point-to-point links)

Why hackers care: Knowing the subnet tells you how many hosts to scan. If you're on 10.10.10.0/24, there are up to 254 live hosts to discover.

Scan a whole subnet with Nmap:

nmap -sn 10.10.10.0/24    # Ping sweep โ€” find live hosts

IPv6

128-bit addresses written in hex:

2001:0db8:85a3:0000:0000:8a2e:0370:7334

IPv6 is increasingly relevant. Many tools and firewalls are configured for IPv4 only โ€” IPv6 is sometimes a blind spot worth probing.

๐Ÿ”„ How the Internet Works: A Packet's Journey

When you type https://tryhackme.com in your browser, here's what actually happens:

  1. DNS lookup โ€” Your computer asks, "What's the IP address for tryhackme.com?"
  2. TCP handshake โ€” Your browser connects to that IP on port 443
  3. TLS handshake โ€” Encryption is negotiated
  4. HTTP request โ€” Your browser asks for the webpage
  5. HTTP response โ€” The server sends the HTML back
  6. Rendering โ€” Your browser displays it

Each step is an attack surface. DNS can be poisoned. TLS can be stripped. HTTP can be intercepted. This is why understanding the full journey matters.

๐ŸŒ DNS โ€” The Internet's Phone Book

DNS (Domain Name System) translates human-readable domain names into IP addresses.

tryhackme.com  โ†’  DNS lookup  โ†’  104.22.55.228

DNS Record Types

RecordPurposeHacker Relevance
ADomain โ†’ IPv4 addressBasic lookup
AAAADomain โ†’ IPv6 addressIPv6 recon
MXMail server for domainEmail spoofing recon
CNAMEAlias for another domainSubdomain takeover
TXTArbitrary text (SPF, DKIM)Recon, email security checks
NSNameservers for domainDNS zone transfers
PTRIP โ†’ domain (reverse DNS)Reverse lookups

DNS Enumeration (Hacker's Perspective)

# Basic lookup
nslookup tryhackme.com
# Dig โ€” more powerful
dig tryhackme.com
dig tryhackme.com MX          # Mail servers
dig tryhackme.com TXT         # TXT records
dig tryhackme.com ANY         # All records
# Zone transfer attempt (finds ALL subdomains if misconfigured)
dig axfr @ns1.tryhackme.com tryhackme.com
# Subdomain brute-force (with gobuster)
gobuster dns -d tryhackme.com -w /usr/share/wordlists/subdomains.txt

Zone transfers are a classic misconfiguration โ€” a DNS server that allows zone transfers will dump every single subdomain and IP address for the domain. Always try it.

๐Ÿ”€ ARP โ€” Connecting IPs to MAC Addresses

ARP (Address Resolution Protocol) works at Layer 2. When a device wants to send data to 192.168.1.5, it broadcasts, "Who has 192.168.1.5?" and the device with that IP replies with its MAC address.

ARP Poisoning / ARP Spoofing: An attacker sends fake ARP replies, claiming their MAC address belongs to the gateway's IP. All traffic meant for the gateway now flows through the attacker โ€” a classic Man-in-the-Middle (MITM) attack.

# View your ARP table
arp -a
# ARP poisoning with arpspoof (for labs only)
arpspoof -i eth0 -t 192.168.1.5 192.168.1.1

๐Ÿšช Common Ports โ€” The Hacker's Cheat Sheet

Knowing common ports cold will save you time on every CTF:

PortProtocolServiceNotes
21TCPFTPCheck anonymous login
22TCPSSHBrute-force with Hydra
23TCPTelnetUnencrypted โ€” sniff traffic
25TCPSMTPEmail relay attacks
53TCP/UDPDNSZone transfer, poisoning
80TCPHTTPFull web attack surface
110TCPPOP3Email retrieval
139/445TCPSMBEternalBlue, pass-the-hash
443TCPHTTPSHTTPS web attacks
3306TCPMySQLDB dumping if exposed
3389TCPRDPBrute-force, BlueKeep
5985TCPWinRMWindows remote management
8080TCPHTTP-altDev servers, Jenkins

๐Ÿ” NAT, DHCP, and Firewalls (Quick Overview)

NAT (Network Address Translation)

Allows many private IP devices to share one public IP. Your home router does this. In pentests, NAT is why you can't directly reach internal machines from outside โ€” you need to pivot.

DHCP

Automatically assigns IP addresses to devices on a network. On TryHackMe's VPN, your machine gets a 10.x.x.x address via DHCP.

Firewalls

Filter traffic based on rules (IP, port, protocol). Two types:

Hacker implication: Firewalls block certain ports. When Nmap shows a port as filtered, a firewall is likely dropping your packets. Techniques like firewall evasion (-f for fragmentation, -D for decoys) can help.

๐Ÿ› ๏ธ Essential Networking Commands

# Your IP address
ip a
ifconfig          # older systems
# Routing table
ip route
route -n
# Active connections
ss -tulpn
netstat -tulpn    # older systems
# DNS lookup
nslookup google.com
dig google.com
# Trace the route to a host
traceroute google.com
tracert google.com    # Windows
# Check if host is alive
ping 10.10.10.10
# ARP table
arp -a
# Download a file
wget http://10.10.10.10/file.txt
curl http://10.10.10.10/file.txt

๐ŸŽฏ Practice These on TryHackMe

RoomWhat You'll Learn
Intro to NetworkingOSI model, TCP/IP in depth
How The Web WorksDNS, HTTP, cookies, and end-to-end
DNS in DetailEvery record type, zone transfers
HTTP in DetailRequests, responses, methods, status codes
Packet Analysis (Wireshark)See real packets flowing
Introductory NetworkingSubnetting, routing, ARP

๐Ÿงฉ Putting It All Together

Here's how networking knowledge directly translates to attack techniques:

ConceptAttack-Enabled
DNS recordsSubdomain enumeration, zone transfer
ARPMITM via ARP poisoning
TCP handshakeSYN flood, session hijacking
Open portsVulnerability targeting
SubnetsHost discovery, lateral movement
SMB (445)EternalBlue, pass-the-hash
FirewallsEvasion, port knocking

Every concept in networking has an offensive equivalent. That's why understanding the fundamentals isn't just academic โ€” it directly makes you a better attacker (and defender).

๐Ÿš€ What's Next

Now that you can scan with Nmap and understand the network you're scanning, it's time to put it all together in a real room. Next, a full walkthrough of the RootMe room on TryHackMe โ€” one of the most popular beginner rooms that covers web exploitation and privilege escalation from start to finish.

The "Hacking from Zero" series:
  1. โœ… Getting Started with TryHackMe โ€” Learning Path Overview
  2. โœ… Nmap Deep Dive: The Hacker's Swiss Army Knife
  3. โœ… (You are here) Networking Fundamentals Every Hacker Must Know
  4. โœ… TryHackMe Walkthrough: RootMe Room
  5. โœ… OSINT: How Hackers Find Information About You

Tags: #Networking #CyberSecurity #TryHackMe #EthicalHacking #Pentesting #OSIModel #DNS #TCP #InfoSec

Originally published on Medium.

โ† Back to Blog