Obiettivo

Teoria che l’esame dà per scontata: modelli, incapsulamento, TCP vs UDP e porte note.

1. OSI vs TCP/IP

#OSIPDUTCP/IPEsempi
7ApplicationDataApplicationHTTP, DNS, DHCP
6PresentationData↑TLS, JSON
5SessionData↑—
4TransportSegment (TCP) / Datagram (UDP)Transportporte
3NetworkPacketInternetIP, router
2Data LinkFrameNetwork AccessMAC, switch
1PhysicalBit↑cavi, Wi-Fi

Mnemonico (7→1): All People Seem To Need Data Processing. Incapsulamento: Data → Segment → Packet → Frame → Bits. Il de-incapsulamento è l’inverso.

2. TCP vs UDP

TCPUDP
ConnessioneConnection-oriented (3-way handshake)Connectionless
AffidabilitàACK, ritrasmissione, ordinamentoNessuna
ControlloFlow control (window), congestion controlNessuno
OverheadHeader 20+ BHeader 8 B
UsiHTTP(S), SSH, FTP, SMTPDNS query, DHCP, TFTP, SNMP, NTP, VoIP

3-way handshake: SYN → SYN-ACK → ACK. Chiusura: FIN/ACK (o RST). Windowing: la finestra dice quanti byte si possono inviare prima di attendere un ACK.

3. Porte note (da sapere a memoria)

PortaServizioProtocollo
20/21FTP dati/controlloTCP
22SSHTCP
23TelnetTCP
25SMTPTCP
53DNSUDP (query) · TCP (trasferimenti zona/risposte grandi)
67/68DHCP server/clientUDP
69TFTPUDP
80 / 443HTTP / HTTPSTCP
110 / 143POP3 / IMAPTCP
123NTPUDP
161 / 162SNMP / trapUDP
514SyslogUDP

Intervalli: well-known 0–1023, registered 1024–49151, dynamic/ephemeral 49152–65535.

4. Altri fondamentali da ripassare

  • Cavi: UTP (100 m) vs fibra (multimode/single-mode); straight-through vs crossover.
  • Tipi di indirizzo IPv4: unicast, broadcast, multicast (224.0.0.0/4); privati RFC 1918 (10/8, 172.16/12, 192.168/16); APIPA 169.254/16.

Common Mistakes

  • DNS usa anche TCP (non solo UDP).
  • UDP non significa “inaffidabile e inutile”: DNS, DHCP e VoIP lo usano perché la velocità conta più della consegna garantita.
  • PDU: frame = L2, packet = L3, segment = L4.

🎯 Synthesis

TCP garantisce (handshake, ACK, window), UDP corre (8 byte, nessuna garanzia); ogni livello OSI incapsula il PDU del livello superiore.

Approfondimenti: DAY 30 — TCP vs UDP – Layer 4 Basics · Ports and Protocols · Protocol vs Port