Networking
Dashboard Download PDF

tags: - cocubes - technical - networking


Networking Concepts and Protocols

OSI model

From lowest to highest:

  1. Physical โ€” bits, signals, cables.
  2. Data Link โ€” frames, MAC addressing, switches.
  3. Network โ€” packets, IP addressing, routing.
  4. Transport โ€” ports, TCP/UDP, end-to-end delivery.
  5. Session โ€” session control.
  6. Presentation โ€” encryption, compression, translation.
  7. Application โ€” user-facing network services.

Mnemonic from low to high: Please Do Not Throw Sausage Pizza Away.

For fast MCQs: routing = Network layer; MAC = Data Link; port number = Transport; HTTP/DNS = Application.

TCP versus UDP

TCP UDP
connection-oriented connectionless
reliable, ordered byte stream no delivery/order guarantee
acknowledgements, retransmission, flow/congestion control lower overhead and latency
web pages, file transfer, mail streaming, gaming, DNS commonly

TCP three-way handshake: SYN โ†’ SYN-ACK โ†’ ACK.

IP addressing and subnetting

IPv4 has 32 bits. CIDR slash length gives network bits; host bits = 32 โˆ’ slash length.

Prefix Host bits Total addresses Traditional usable hosts
/24 8 256 254
/25 7 128 126
/26 6 64 62
/27 5 32 30
/28 4 16 14
/29 3 8 6

Traditional usable hosts = 2^hostbits โˆ’ 2, excluding network and broadcast. Treat special /31 and /32 rules as exceptions unless specifically asked.

Example: mask 255.255.255.224 = /27. It leaves 5 host bits, so 30 traditional usable hosts/subnet.

Common protocols and ports

Service Purpose Default port
HTTP web 80
HTTPS secure web 443
DNS name to IP lookup 53
DHCP IP configuration UDP 67/68
SSH secure remote shell 22
FTP file transfer control 21
SMTP sending email 25
POP3 retrieving email 110
IMAP synchronised email access 143
Telnet insecure remote terminal 23

Essential services

  • DNS translates domain names to IP addresses.
  • DHCP dynamically provides IP configuration: address, mask, gateway, DNS.
  • ARP maps an IPv4 address to a MAC address on a local network.
  • NAT translates private internal addresses to public addresses.
  • Router forwards between networks; switch forwards frames within a LAN.

HTTP status codes

Code Meaning
200 success
201 resource created
301/302 redirect
400 bad request
401 unauthenticated/credentials required
403 authenticated but forbidden
404 resource not found
500 server error

Security basics

  • Encryption protects confidentiality.
  • Hashing provides one-way integrity/checking; hashes are not encryption.
  • TLS protects HTTP traffic as HTTPS.
  • Firewall filters traffic based on rules.
  • VPN creates an encrypted tunnel over an untrusted network.

[[03_Technical/Technical_Drills|Technical drills]] ยท [[03_Technical/Technical_Quick_Recall|Quick recall]]