Skip to main content

Networking Cheat Sheet

OSI Model

LayerNameProtocolsData Unit
7ApplicationHTTP, DNS, SMTP, FTPData
6PresentationTLS/SSL, JPEG, ASCIIData
5SessionNetBIOS, RPCData
4TransportTCP, UDPSegment/Datagram
3NetworkIP, ICMP, ARPPacket
2Data LinkEthernet, Wi-Fi, MACFrame
1PhysicalCables, Hubs, RadioBits

Mnemonic: All People Seem To Need Data Processing

Common Ports

TCP

PortService
20/21FTP (data/control)
22SSH
23Telnet
25SMTP
53DNS
80HTTP
110POP3
135RPC
139/445SMB
143IMAP
389LDAP
443HTTPS
465SMTPS
636LDAPS
993IMAPS
995POP3S
1433MSSQL
1521Oracle DB
3306MySQL
3389RDP
5432PostgreSQL
5900VNC
6379Redis
8080HTTP Alt
8443HTTPS Alt
27017MongoDB

UDP

PortService
53DNS
67/68DHCP
69TFTP
123NTP
161/162SNMP
500IKE/IPSec
514Syslog

TCP Handshake

Client → Server: SYN
Server → Client: SYN-ACK
Client → Server: ACK
--- Connection Established ---
Client → Server: FIN
Server → Client: ACK + FIN
Client → Server: ACK
--- Connection Closed ---

TCP Flags

FlagMeaning
SYNSynchronize — start connection
ACKAcknowledge
FINFinish — end connection
RSTReset — abort connection
PSHPush — send data immediately
URGUrgent data

IP Address Classes

ClassRangeDefault SubnetUse
A1.0.0.0 – 126.255.255.255/8Large networks
B128.0.0.0 – 191.255.255.255/16Medium networks
C192.0.0.0 – 223.255.255.255/24Small networks

Private IP Ranges (RFC 1918)

10.0.0.0/8        (10.0.0.0 – 10.255.255.255)
172.16.0.0/12     (172.16.0.0 – 172.31.255.255)
192.168.0.0/16    (192.168.0.0 – 192.168.255.255)

CIDR Quick Reference

CIDRSubnet MaskHosts
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014
/29255.255.255.2486
/30255.255.255.2522

DNS Record Types

TypePurpose
AIPv4 address
AAAAIPv6 address
CNAMEAlias to another hostname
MXMail server
NSName server
TXTText (SPF, DKIM, verification)
PTRReverse DNS lookup
SOAStart of Authority
SRVService location

HTTP Status Codes

CodeMeaning
200OK
201Created
204No Content
301Moved Permanently
302Found (redirect)
400Bad Request
401Unauthorized
403Forbidden
404Not Found
405Method Not Allowed
429Too Many Requests
500Internal Server Error
502Bad Gateway
503Service Unavailable