Skip to content

18. Computer Networks ​

This subject follows the network layers and selected concrete mechanisms: Manchester, NRZI, 4B/5B, QPSK, QAM-16, TCP connection management, ECN/DCTCP, DNS, HTTP, DHCP, and ARP.

18.1 Layer Models: ISO/OSI and TCP/IP ​

Computer networks are usually explained through layer models. A layer offers services to the layer above it and uses services of the layer below it. This separation lets one layer change its implementation without forcing every application or every piece of hardware to change.

There are two relevant models.

ModelLayersMain idea
TCP/IP modelLink, network, transport, applicationThe practical Internet model. It became the standard protocol family for large-scale internetworking and is the model most directly reflected in real protocols such as IP, TCP, UDP, DNS, and HTTP.
ISO/OSI reference modelPhysical, data link, network, transport, session, presentation, applicationA conceptual reference model that separates communication functions more finely. It is useful for naming responsibilities even when real protocols do not fit it perfectly.

The OSI model can be remembered from bottom to top:

The TCP/IP model merges several OSI responsibilities:

TCP/IP layerRough OSI correspondenceExamples
LinkPhysical + data link responsibilitiesEthernet, Wi-Fi, PPP, local framing and MAC
NetworkNetwork layerIP, ICMP, routing
TransportTransport layerTCP, UDP
ApplicationSession + presentation + application responsibilitiesDNS, HTTP, DHCP, application protocols

The exam point is not that one model is "right" and the other is "wrong." The OSI model is a clean vocabulary; TCP/IP is the deployed Internet architecture.

What to Emphasize in an Oral Answer ​

  • Define a layer model as a service boundary: each layer uses the layer below and offers a cleaner service to the layer above.
  • Name the OSI layers in order and attach one responsibility to each: physical bits, data-link frames/local access, network packets/routing, transport process communication, session dialogs, presentation representation, application protocols.
  • Name the TCP/IP layers and examples: link, network/IP/ICMP, transport/TCP/UDP, and application/DNS/HTTP/DHCP.
  • Explain the mapping: TCP/IP merges OSI physical+data-link into link and folds session/presentation responsibilities into application protocols.
  • Emphasize why layering matters: modularity, replaceable implementations, encapsulation, and clear reasoning about where a failure or protocol feature belongs.
  • Avoid saying one model is simply correct and the other wrong; OSI is a reference vocabulary, TCP/IP is the deployed Internet architecture.
Suggested answer

Layer models divide network communication into responsibilities. A layer provides a service to the layer above it and hides the details of how that service is implemented below it. The OSI model is the more detailed conceptual model: physical, data link, network, transport, session, presentation, and application. It is useful because each layer has a clear role, from transmitting raw bits up to application-level protocols.

The TCP/IP model is the practical model used by the Internet. It has four layers: link, network, transport, and application. The link layer handles local transmission and framing; the network layer, mainly IP, moves packets across interconnected networks; the transport layer provides process-to-process communication through TCP or UDP; and the application layer contains protocols such as DNS and HTTP.

The two models are related but not identical. TCP/IP merges some OSI responsibilities, especially session and presentation, into the application layer. The important idea is modularity: Ethernet or Wi-Fi can change without rewriting HTTP, and DNS or HTTP can use the same transport and network services.

18.2 Physical Layer: Baseband, Broadband, Encoding, and Modulation ​

The physical layer transmits bits through a communication channel. It specifies mechanical, electrical, timing, and procedural details of the interface and the transmission medium.

Signals, Symbols, and Synchronization ​

Distinguish wired and wireless transmission:

AreaKey facts
Wired transmissionData is sent by changing a physical quantity such as voltage or current. Periodic signals can be decomposed into harmonic components, which explains bandwidth limits.
Wireless transmissionElectromagnetic waves have frequency f and wavelength λ; in vacuum, λ⋅f=c, where c is the speed of light.
SymbolThe transmitted unit need not be one bit. A symbol may encode several bits, such as four symbols A=00, B=01, C=10, D=11.
Baud versus bit rateBaud means symbols per second; data rate means bits per second. They are equal only when one symbol encodes exactly one bit.

Synchronization answers the question: when should the receiver sample the signal and where does a symbol begin?

Synchronization methodMeaning
Explicit clockA separate clock signal is available; suitable for short or parallel transmissions.
Critical instantsSender and receiver synchronize at the beginning of a symbol or block and assume clocks remain close enough for a short interval.
Symbol codes / self-clocking signalsThe signal itself contains transitions that allow clock recovery without a separate clock.

Transmission Media ​

The following are media.

MediumCharacteristics
Magnetic carriersHigh bandwidth, high latency; useful for physical data transfer, not interactive networking.
Twisted pairCommon in telecommunication and Ethernet; supports analog and digital transmission.
Coaxial cableHigher speed and distance than simple twisted copper; supports analog and digital signals.
Optical fiberUses light source, fiber, and detector; a pulse can represent 1, no pulse 0; high bandwidth and long distance.
RadioEasy to generate, usable indoors and outdoors, supports long distances; propagation depends strongly on frequency.
MicrowaveMostly line-of-sight, fading can occur, relatively inexpensive for some links.
Infrared and millimeter waveUseful at short distance; does not penetrate solid objects well.
Visible light / laserHigh bandwidth, cheap and license-free, but weather and alignment can matter.

Baseband and Broadband ​

Transmission typeMeaningTypical use
BasebandThe digital signal is converted directly to voltage/current and transmitted in the channel without carrier modulation.Many local wired digital links.
BroadbandThe signal is carried by modulating a carrier in a wider frequency band.Radio, cable, and other carrier-based systems.

Digital Encoding Schemes ​

Manchester, NRZI, and 4B/5B are important digital encoding schemes. The 4/5 item is the common 4B/5B line-coding scheme.

EncodingHow it represents bitsWhy it matters
ManchesterEach bit period contains a transition, so data and clock are combined. Depending on convention, low-to-high may mean 1 and high-to-low 0, or vice versa.Self-clocking and robust synchronization, but it uses more bandwidth because every bit has a transition.
NRZIInformation is represented by whether the signal changes state, commonly "invert on 1" and "no transition on 0" or the opposite by convention.Reduces some synchronization problems compared with simple NRZ, but long runs without transitions may still be an issue.
4B/5BEach 4-bit data group is mapped to a 5-bit code word chosen to avoid too many consecutive zeros.Improves clock recovery and works well with encodings such as NRZI; overhead is 25%.

Modulation ​

For broadband transmission, Start from a sinusoidal carrier:

g(t)=A∗sin(2∗pi∗f∗t+phi)

The information can be encoded by changing amplitude A, frequency f, or phase φ.

Modulation familyAnalog formDigital formIdea
AmplitudeAMASKEncode information in the amplitude of the carrier.
FrequencyFMFSKEncode information in the frequency of the carrier.
PhasePMPSKEncode information in phase shifts of the carrier.

The topic also names QPSK and QAM-16:

SchemeMeaningCore description
QPSKQuadrature phase-shift keyingUses four carrier phases, so one symbol can carry 2 bits. It is a PSK scheme.
QAM-1616-point quadrature amplitude modulationCombines amplitude and phase changes; one of 16 constellation points is selected, so one symbol can carry 4 bits.

Digital transmission uses a finite set of discrete signal states. Analog transmission uses a continuous set of signal values. Digital reception can often regenerate the original discrete value despite moderate noise; analog noise tends to accumulate.

What to Emphasize in an Oral Answer ​

  • Frame the physical layer as converting bits or symbols into signals over a medium, with timing, electrical/optical/radio, and mechanical interface details.
  • Distinguish bit rate from baud rate: a symbol can encode one or more bits.
  • Mention synchronization: explicit clock, critical instants, or self-clocking signal codes.
  • Contrast baseband with broadband: direct digital signaling versus modulating a carrier.
  • For broadband, name the carrier parameters and digital modulation families: amplitude/ASK, frequency/FSK, phase/PSK.
  • Include the required examples: Manchester is self-clocking but bandwidth-expensive; NRZI uses transitions; 4B/5B avoids long transition-free runs at 25% overhead.
  • Include QPSK and QAM-16 as symbol examples: QPSK carries 2 bits per symbol, QAM-16 carries 4 bits per symbol.
  • Tie media choice to bandwidth, distance, noise, mobility, and line-of-sight constraints.
Suggested answer

The physical layer is responsible for transmitting bits as physical signals. It defines the medium, timing, electrical or optical properties, and the way symbols are represented. In wired media, information can be sent by changing voltage or current; in wireless media, electromagnetic waves are used, with frequency and wavelength related by λ⋅f=c.

The transmitted unit is often a symbol, not necessarily a single bit. Baud measures symbols per second, while bit rate measures bits per second. Synchronization is therefore essential: the receiver must know when to sample the signal. This can be done with an explicit clock, by synchronizing at block boundaries, or with self-clocking codes.

In baseband transmission, the digital signal is put directly onto the medium. In broadband transmission, the data modulates a carrier. Modulation can change amplitude, frequency, or phase; the digital versions are ASK, FSK, and PSK. QPSK uses four phases and carries two bits per symbol, while QAM-16 combines amplitude and phase to represent sixteen symbols, four bits per symbol.

Digital encoding schemes solve synchronization and signal-quality problems. Manchester has a transition in every bit period and is self-clocking but bandwidth-expensive. NRZI uses transitions to carry information. 4B/5B maps each four data bits to five coded bits to avoid long transition-free runs. Together, media, encoding, and modulation determine the achievable bit rate, reliability, and distance.

The data link layer provides a well-defined service interface to the network layer over a local link. It handles frames, errors, flow control, and local medium access.

Three service styles. The wording is normalized here:

Service styleMeaning
Unacknowledged connectionless serviceFrames are sent without explicit acknowledgement; suitable where the medium is reliable or higher layers handle errors.
Acknowledged connectionless serviceEach frame is acknowledged, but no long-lived connection is set up.
Acknowledged connection-oriented serviceA logical connection is established and frames are acknowledged in order.

Framing ​

The physical layer sends a stream of bits; the data link layer must split it into frames and compute checksums. Four framing techniques are:

MethodMechanismMain problem or use
Character countThe header states how many characters are in the frame.Very sensitive to header errors; a corrupted count loses frame boundaries.
Flag bytes with character stuffingSpecial start/end bytes mark frame boundaries; escape bytes protect accidental flag bytes inside data.Byte-oriented method.
Flag bit pattern with bit stuffingFrames begin/end with a bit pattern such as 01111110; after five consecutive 1 bits in data, the sender inserts a 0.Bit-oriented method; receiver removes stuffed zeros.
Physical-layer coding violationUses redundant physical encoding patterns that cannot appear in normal data.Works only when the physical code has unused symbols.

Error Handling ​

The data link layer must answer two questions:

  1. Did frames reach the destination network layer?
  2. Did they arrive in the correct order and exactly once?

To achieve this, protocols use acknowledgements, timeouts, retransmissions, and sequence numbers. A damaged or lost frame can be retransmitted, and duplicate frames can be recognized by sequence numbers.

Bit errors:

Error typeMeaning
Single-bit errorOne bit changes from 0 to 1 or from 1 to 0.
Burst errorA sequence is affected, with first and last symbols wrong and no sufficiently long correct subsequence inside.

Hamming Distance, Detection, and Correction ​

Let a code contain permitted codewords of equal length. The Hamming distance between two codewords is the number of bit positions where they differ. The distance of a code is the minimum distance between any two different permitted codewords.

Code distanceConsequence
1No reliable error detection: one bit error may turn one valid codeword into another.
2One-bit errors can be detected but not corrected.
3One-bit errors can be corrected and two-bit errors can be detected.

General rule:

GoalRequired minimum code distance
Detect d bit errorsd+1
Correct d bit errors2d+1

Also give the Hamming bound: for a code C of length n and distance k, disjoint balls around codewords must fit into all 2n bit strings. This expresses the tradeoff between code rate and error-handling power. A good code has both high rate and high distance, but those goals conflict.

Parity and Hamming Code ​

A parity bit is chosen so the number of 1 bits is even or odd.

ParityRule
Even parityAdd 0 if the number of ones is already even; otherwise add 1.
Odd parityAdd 0 if the number of ones is already odd; otherwise add 1.

In a Hamming code, check bits are placed at power-of-two positions (1, 2, 4, 8, ...). Data bits fill the remaining positions. Each check bit controls a pattern of positions, and the resulting parity syndrome identifies a one-bit error.

CRC ​

CRC, or cyclic redundancy check, treats a bit sequence as coefficients of a polynomial over Z2.

Steps:

  1. Choose a generator polynomial G(x) of degree r, known by sender and receiver.
  2. Append r zero bits to the frame, forming xrM(x).
  3. Divide by G(x)(mod2).
  4. Subtract the remainder modulo 2 and append it as the checksum.
  5. The receiver divides the received polynomial by G(x). A nonzero remainder indicates an error.

CRC cannot detect errors whose error polynomial is a multiple of the generator polynomial, but well-chosen generators detect common burst errors very well.

Describe a progression of data link protocols:

ProtocolAssumptionsBehavior
Unrestricted simplexSender and receiver always ready, no errors, infinite buffers.Sender continuously sends frames; no sequence number or acknowledgement is needed.
Simplex stop-and-waitReceiver needs processing time, no frame damage/loss.Sender sends one frame and waits for acknowledgement before sending the next.
Simplex for noisy channelFrames may be damaged or lost.Sender uses timeout and retransmission; receiver checks checksum, acknowledges good frames, drops bad ones.

The sliding-window protocol generalizes stop-and-wait. The sender may have up to n unacknowledged frames in flight. Sender and receiver each maintain a window of allowed sequence numbers.

If an error happens in a stream:

StrategyReceiver behaviorTradeoff
Go-back-NDiscards frames after the missing or bad frame; sender retransmits from that frame onward.Simpler, but wastes bandwidth after isolated errors.
Selective repeatBuffers good frames after the bad one and asks for/retransmits only missing frames.Better bandwidth use, but needs more receiver memory and sequence-number care.

HDLC and PPP ​

ProtocolMain content
HDLCBit-oriented data link protocol using a sliding window. Frame fields include flag, address, control, data, and checksum. Frame types include information, supervisory, and unnumbered frames. Supervisory frames include receive ready, reject, receive not ready, and selective reject.
PPPPoint-to-Point Protocol. Provides framing, a line control protocol for setup/testing/option negotiation/release, and negotiation of network-layer options. It is byte-oriented and can carry protocol identifiers such as LCP, NCP, IP, IPX, or AppleTalk.

Medium Access Control and Dynamic Channel Allocation ​

When several stations share a broadcast channel, the MAC sublayer decides who may transmit. Static allocation divides the medium by frequency or time, but this is inefficient for bursty traffic. Dynamic allocation is needed when stations transmit irregularly.

Competition protocols assume that collisions can happen and collided frames must be retransmitted.

ProtocolTime model / sensingBehavior
Pure ALOHAContinuous time, no carrier sensingSend whenever ready; on collision, wait random time and retry.
Slotted ALOHADiscrete slotsSend only at slot boundaries; this roughly doubles ALOHA capacity but performance still drops sharply under high load.
1-persistent CSMACarrier sensing, continuous timeIf channel is idle, send immediately; if busy, keep listening and send as soon as it becomes idle.
Non-persistent CSMACarrier sensing, continuous timeIf busy, wait random time before checking again; reduces greediness.
p-persistent CSMACarrier sensing, slotted timeIf idle, transmit with probability p; otherwise defer to the next slot with probability 1−p.
CSMA/CDCarrier sensing with collision detectionMonitor while transmitting; abort on collision, wait random time, and retry.

Non-race protocols avoid collisions:

ProtocolIdea
Reservation / placeholder protocolStations reserve future sending opportunities in numbered contention slots.
Binary countdownStations send binary identifiers from most significant bit; if a station sends 0 and hears 1, it withdraws because a higher-priority sender exists.

Limited-race protocols combine low-latency contention under light load with collision-free selection under heavy load. A typical example is adaptive tree traversal:

At each tree node, the protocol tests whether zero, one, or several stations in that subtree want to transmit. On collision, it descends to children.

What to Emphasize in an Oral Answer ​

  • Define the data link layer as local-link delivery that packages bits into frames and handles framing, errors, flow control, and medium access.
  • List framing methods and their problems: character count, flag bytes plus character stuffing, flag bit patterns plus bit stuffing, and physical-layer coding violations.
  • Explain error handling with checksums, acknowledgements, timeouts, retransmission, sequence numbers, and duplicate suppression.
  • State the Hamming-distance rules: distance d+1 detects d bit errors, and distance 2d+1 corrects d bit errors.
  • Include parity, Hamming codes, and CRC; for CRC, mention polynomial division over Z2 and nonzero remainder detection.
  • Explain stop-and-wait versus sliding windows, and compare go-back-N with selective repeat.
  • Mention HDLC/PPP as protocol examples if time allows: HDLC is bit-oriented with sliding windows, PPP is byte-oriented with link and network-control negotiation.
  • For MAC, contrast random access/competition protocols such as ALOHA and CSMA/CD with reservation, binary countdown, and adaptive-tree style collision reduction.
Suggested answer

The data link layer turns an unreliable bit stream into frames and provides local delivery services to the network layer. It must identify frame boundaries, detect or correct errors, regulate flow, and decide access to a shared medium.

Framing can be done by character count, by start and end flag bytes with character stuffing, by flag bit patterns with bit stuffing, or by physical-layer coding violations. Since the physical layer can corrupt bits, frames include redundancy. The most important ideas are Hamming distance, parity, Hamming codes, and CRC. A code with distance d+1 can detect d bit errors; a code with distance 2d+1 can correct d bit errors. CRC treats bit strings as polynomials over Z2, appends a remainder as checksum, and lets the receiver detect errors by division.

Flow control starts with stop-and-wait and becomes efficient with sliding windows. The sender may send several frames before acknowledgements arrive. If an error occurs, go-back-N retransmits from the bad frame onward, while selective repeat buffers later correct frames and retransmits only missing ones.

On broadcast links, MAC protocols allocate the channel. ALOHA sends freely and resolves collisions by random retry. CSMA improves this by listening before sending, and CSMA/CD also aborts when it detects a collision. Reservation, binary countdown, and adaptive tree protocols reduce or avoid collisions when contention is high.

18.4 Network Layer: Routing, IP, Fragmentation, IPv4, and IPv6 ​

The network layer forwards packets from source to destination across multiple networks. It is the lowest layer that deals with end-to-end delivery between hosts rather than only local link delivery.

Services offered to the transport layer should:

  • hide subnet design details;
  • hide the number, type, and topology of intermediate networks;
  • provide a uniform addressing system.

Routing Types and Algorithms ​

Routing typeMeaning
Hierarchical routingRouters are grouped into domains. A router knows its own domain in detail and treats other domains more abstractly.
Broadcast routingA packet is sent everywhere.
Multicast routingA packet is sent to a selected group.

A routing algorithm fills/maintains routing tables and then uses them for forwarding.

Algorithm / familyClassificationCore idea
Dijkstra shortest pathStatic / link-state style computationLabel nodes by best known distance from a start node; finalize the closest temporary label repeatedly.
FloodingStaticForward incoming packets on all outgoing lines except the incoming line. Use hop count and duplicate tracking to limit explosion.
Distance-vector / distributed Bellman-FordAdaptive, distance-basedEach router knows costs to neighbors and exchanges distance vectors with them; it updates its own vector from neighbor information.
Link-state routingAdaptive, connection/topology-basedDiscover neighbors, measure cost, build a link-state packet, flood it to routers, then compute shortest paths.

Distance-vector protocols are simple and distributed, but can converge slowly and suffer from problems such as count-to-infinity. Link-state protocols require more global topology information but usually converge more predictably.

Internet Routing, OSPF, BGP, and Path Vector ​

At the network layer, the Internet is an interconnection of autonomous systems. Inside an autonomous system, protocols such as OSPF can compute least-cost paths from link-state information. Between autonomous systems, BGP is used.

ProtocolScopeMain idea
OSPFInside an autonomous systemBuilds a weighted directed graph of topology and computes least-cost paths.
BGPBetween autonomous systemsExchanges reachability between ASes while allowing policy decisions.
Path-vector routingBGP's routing modelA route advertisement carries the AS path. A router can detect loops and apply policy based on the path, not just a distance number.

BGP is not simply "shortest path." It may prefer or reject paths because of administrative policies, business relations, and transit rules.

IP Datagrams and IPv4 ​

Describe Internet communication as follows:

  1. The transport layer breaks data streams into datagrams or segments.
  2. Datagrams are transmitted across the Internet and may be broken into smaller units.
  3. The target network layer reassembles the original datagram and passes it upward.
  4. The target transport layer delivers data to the receiving process.

Important IPv4 header fields:

FieldPurpose
VersionWhich IP version is used.
IHLIPv4 header length.
Type of service / DS fieldService class or traffic treatment.
Total lengthHeader plus payload length.
IdentificationSame value in all fragments of one original datagram.
DF flag"Don't fragment": routers must not fragment.
MF flag"More fragments": set on all fragments except the last.
Fragment offsetPosition of this fragment in the original datagram.
Time to liveHop limit; reduced at routers and packet is discarded at zero.
ProtocolIdentifies upper-layer protocol, such as TCP or UDP.
Header checksumProtects the IPv4 header and is recalculated at each hop.
Source and destination addressIPv4 addresses.
OptionsExtensibility field, rarely used in fast paths.

IPv4 Addresses, Subnets, CIDR, NAT, and Fragmentation ​

An IPv4 address is 4 bytes, commonly written in dotted decimal notation such as 192.168.0.1. It identifies a network part and a host part.

Subnets divide an internal network into parts while appearing as one network externally. Routers use a subnet mask and longest-prefix matching. CIDR generalizes this by representing routes as prefixes rather than old address classes.

Private IPv4 ranges commonly used with NAT:

Private rangeSize
10.0.0.0/816,777,216 addresses
172.16.0.0/121,048,576 addresses
192.168.0.0/1665,536 addresses

NAT lets many internal hosts use private addresses while sharing one or a few public addresses. It mitigates IPv4 exhaustion but breaks the pure end-to-end addressing model and requires state at the NAT device.

IPv4 fragmentation can be performed by routers when a datagram is larger than the next link MTU and DF is not set. Fragments share the same identification value; offset and MF identify their positions. Reassembly is done at the destination.

IPv6 ​

IPv6 uses 16-byte addresses written as eight hexadecimal groups, such as:

text
8000:0000:0000:0000:0123:4567:89AB:CDEF

Important contrasts:

AspectIPv4IPv6
Address length32 bits128 bits
HeaderVariable length with header checksumSimplified fixed base header, no header checksum
FragmentationRouters may fragment unless DF setFragmentation is handled by source nodes using an extension header; routers do not fragment ordinary packets
Address pressureExhausted; NAT commonVast address space; NAT is less central
ExtensibilityOptions in base headerExtension headers

Network-Layer Protocols ​

ProtocolRole
ICMPReports unexpected events such as unreachable destination, timeout, parameter problem, resource throttling, echo request, and echo response.
ARPMaps an IPv4 address to a physical address on a local network by broadcast request and reply.
RARPHistorical reverse mapping from physical address to IP address.
OSPFInterior link-state routing protocol.
BGPExterior inter-AS routing protocol using policy and AS paths.

What to Emphasize in an Oral Answer ​

  • Define the network layer as host-to-host packet delivery across multiple networks, with addressing, forwarding, routing, and fragmentation concerns.
  • Distinguish routing-table construction from per-packet forwarding and longest-prefix matching.
  • Compare routing algorithms: distance vector/distributed Bellman-Ford, link-state plus Dijkstra, flooding, hierarchical routing, and path-vector BGP.
  • Place Internet protocols correctly: IP carries datagrams, ICMP reports/control messages, ARP maps IPv4 to local hardware addresses, OSPF is internal link-state, and BGP is inter-AS policy routing.
  • Cover IPv4 essentials: 32-bit addresses, CIDR/subnets, NAT pressure from address exhaustion, TTL, protocol, source/destination, checksum, and fragmentation fields.
  • Explain fragmentation and MTU: IPv4 routers may fragment; IPv6 removes router fragmentation from normal forwarding.
  • Cover IPv6 essentials: 128-bit addresses, simpler base header, extension headers, and source-side fragmentation.
  • Mention the likely distinction that BGP is not simply shortest path routing; it carries AS paths and policy.
Suggested answer

The network layer forwards packets between hosts across multiple networks. It hides subnet details from the transport layer and gives hosts a uniform addressing system. Routing has two parts: maintaining routing tables and forwarding packets according to those tables.

Distance-vector routing, such as distributed Bellman-Ford, has each router exchange distance information with its neighbors and update its vector from what neighbors report. Link-state routing works differently: routers discover neighbors, measure link costs, flood link-state information, and then compute shortest paths, typically with Dijkstra's algorithm. On the Internet, OSPF is a link-state protocol inside an autonomous system, while BGP routes between autonomous systems. BGP is a path-vector protocol: routes carry AS paths, so routers can detect loops and apply policy, not only shortest distance.

IP is the main network-layer protocol. IPv4 uses 32-bit addresses and a header with fields such as TTL, protocol, source, destination, checksum, and fragmentation fields. IPv4 routers may fragment packets if the next link MTU is too small and fragmentation is allowed. CIDR and longest-prefix matching replaced classful routing, and NAT became common because IPv4 addresses were exhausted.

IPv6 uses 128-bit addresses and a simpler base header. It removes router fragmentation from the normal forwarding path; fragmentation is done by source nodes with an extension header. This improves forwarding efficiency and gives a far larger address space.

18.5 Transport Layer: UDP, TCP, Connection Management, and Congestion Control ​

The content belongs to the transport layer. The transport layer provides process-to-process communication above IP.

Connectionless and Connection-Oriented Transport ​

ModeMeaningTradeoff
ConnectionlessNo connection setup; each datagram is sent independently.Low overhead, but no built-in reliability or ordering.
Connection-orientedConnection state is established and maintained.Can hide loss, duplication, corruption, and reordering from applications, but costs more overhead.

Reliability mechanisms:

  • acknowledgements for received packets;
  • retransmission of unacknowledged packets;
  • checksum over header and packet;
  • sequence numbers and receiver reordering;
  • duplicate suppression.

Multiplexing, Demultiplexing, and Interaction Models ​

Transport protocols multiplex many application flows over the same network-layer service. Ports identify the sending and receiving processes.

ConceptMeaning
MultiplexingCombining traffic from several processes or channels into one lower-layer communication path.
DemultiplexingUsing identifiers such as ports to deliver received data to the correct process.
Bidirectional byte streamTCP's model: two byte sequences flow in opposite directions; data may be segmented and reassembled by TCP.
RPCRemote Procedure Call hides network communication behind a procedure-call interface. A client stub packs parameters, the OS sends a message, a server stub unpacks it, the server runs the procedure, and the result returns similarly.

UDP ​

UDP is a simple connectionless transport protocol.

UDP propertyMeaning
Header size8 bytes.
Header fieldsSource port, destination port, UDP length, UDP checksum.
ReliabilityNo retransmission, ordering, or flow control.
Use caseShort messages and applications that implement their own reliability or prefer low latency, such as DNS queries, streaming, or real-time protocols.

TCP Header and Service ​

TCP creates a reliable bidirectional byte stream between endpoints. It segments application data, numbers bytes, acknowledges received data, retransmits lost data, and uses flow/congestion control.

Important TCP header fields:

FieldPurpose
Source port, destination portIdentify sender and receiver process endpoints.
Sequence numberNumber of the first data byte in the segment; SYN consumes one sequence number.
Acknowledgement numberIf ACK is set, the next byte expected by the receiver.
Header lengthTCP header length in 32-bit words.
WindowReceiver-advertised window: how many bytes may be sent from the acknowledged position.
ChecksumProtects TCP header, data, and pseudo-header.
OptionsIncludes MSS and other extensions.
Urgent pointerIndicates urgent data position when URG is used.
FlagsURG, ACK, PSH, RST, SYN, FIN. Modern headers also include ECN-related flags, but The list includes the classic six.

Three-Way Handshake and TCP States ​

TCP connection management is described by a state machine with connection establishment, data transfer, and connection termination states.

TCP connection establishment:

Common TCP states:

StateMeaning
CLOSEDNo connection state exists.
LISTENServer waits for a connection request.
SYN-SENTClient has sent SYN and waits for a matching response.
SYN-RECEIVEDSYN received and SYN+ACK sent; waiting for final ACK.
ESTABLISHEDData transfer state.
FIN-WAIT-1Endpoint sent FIN and waits for ACK or FIN.
FIN-WAIT-2FIN was acknowledged; waiting for peer's FIN.
CLOSE-WAITPeer sent FIN; local application has not closed yet.
CLOSINGBoth sides sent FIN, waiting for ACK.
LAST-ACKLocal FIN sent after receiving peer FIN, waiting for final ACK.
TIME-WAIT (TIME_WAIT)Wait to ensure old duplicate segments expire and final ACK can be retransmitted if needed.

TCP close is usually a four-segment exchange because each direction of the byte stream is closed independently with FIN and ACK.

Flow Control ​

Flow control protects the receiver from being overwhelmed. TCP uses the receiver-advertised window rwnd, also called wnd. If the receive buffer is full, the receiver can advertise 0; otherwise it advertises how much more data it can accept. The sender must not have more unacknowledged data in flight than the advertised window allows.

Congestion Control ​

Congestion control protects the network from overload. If too much traffic enters the network, buffers overflow, packets are lost, retransmissions increase load, and a feedback loop can cause congestion collapse. Call this the avalanche phenomenon.

Requirements:

RequirementMeaning
EfficiencyHigh throughput with low latency.
FairnessCompeting flows get roughly fair bandwidth, unless policy deliberately prioritizes some traffic.

Tools:

  • capacity increase;
  • resource reservation and admission control;
  • load reduction and regulation;
  • sliding windows;
  • slow start;
  • Nagle's algorithm;
  • Tahoe/Reno-style congestion response;
  • AIMD behavior.

Slow Start, Congestion Avoidance, Tahoe, and Reno ​

TCP uses two windows:

WindowOwnerMeaning
rwnd / advertised windowReceiverReceiver-side flow-control limit.
cwnd / congestion windowSenderSender-side estimate of safe in-flight data for the network.

The effective sending window is roughly:

text
min(rwnd, cwnd)

In slow start, cwnd begins small, often around one MSS, and grows by approximately one MSS per acknowledgement, doubling once per RTT until loss or a threshold.

After cwnd reaches ssthresh, congestion avoidance uses additional increase. On congestion, TCP applies multiplicative decrease. This is AIMD: additional increase, multiplicative decrease. It tends toward both efficiency and fairness.

AlgorithmPacket loss response
TahoeOn timeout or loss signal, set ssthresh to about half the window, reset cwnd to one MSS, and restart slow start.
RenoUses fast retransmit on three duplicate ACKs and fast recovery. After fast retransmit, it halves the window but avoids returning all the way to the beginning of slow start for that case. Timeout still causes a stronger reduction.

Also list MIMD and AIAD as alternative increase/decrease styles, but AIMD is the important TCP fairness mechanism.

ECN and DCTCP ​

The topic explicitly names ECN marking and DCTCP. These are additional corrections.

MechanismMeaning
ECNExplicit Congestion Notification. Routers can mark packets to indicate congestion instead of dropping them, if endpoints negotiated ECN support. The receiver echoes the indication back to the sender, and the sender reduces its rate.
DCTCPData Center TCP. A TCP congestion-control scheme for data centers that uses ECN marks to estimate the fraction of bytes that experienced congestion, then scales cwnd based on that estimate. It aims for high throughput and low latency in shallow-buffered data-center switches.

Nagle's Algorithm ​

Include TCP-Nagle: small packets should not be sent while acknowledgements are outstanding. A packet is small if its data length is less than MSS. Once the acknowledgement for the previous packet arrives, the next small packet can be sent. This reduces many tiny TCP segments on the network.

What to Emphasize in an Oral Answer ​

  • Define transport as process-to-process communication above host-to-host IP, with ports for multiplexing and demultiplexing.
  • Contrast UDP and TCP: UDP is small, connectionless, unordered, and unreliable; TCP is connection-oriented, reliable, ordered, and byte-stream based.
  • Name TCP reliability mechanisms: sequence numbers, acknowledgements, checksums, retransmission, duplicate suppression, and reassembly.
  • Describe the three-way handshake and why SYN sequence numbers are acknowledged; mention four-way close and TIME_WAIT if states are asked.
  • Separate flow control from congestion control: rwnd protects the receiver, cwnd protects the network, and the effective window is roughly min(rwnd, cwnd).
  • Explain slow start, congestion avoidance, and AIMD at a high level; contrast Tahoe reset with Reno fast retransmit/fast recovery after duplicate ACKs.
  • Include ECN and DCTCP as modern congestion signaling: marks can replace drops, and DCTCP uses the marked-byte fraction in data centers.
  • Mention Nagle's algorithm as the small-segment reduction rule when ACKs are outstanding.
Suggested answer

The transport layer provides process-to-process communication above IP. UDP is the simple connectionless transport protocol: it has ports, length, checksum, and data, but it does not provide retransmission, ordering, flow control, or connection state. It is useful when messages are short or the application controls reliability itself.

TCP is connection-oriented and provides a reliable bidirectional byte stream. It uses sequence numbers, acknowledgements, checksums, retransmission, duplicate suppression, and receiver-side flow control. A connection is established by a three-way handshake: the client sends SYN with an initial sequence number, the server replies with SYN+ACK and its own sequence number, and the client replies with ACK. TCP then enters the established state. Closing is usually four-way because each direction of the stream is closed independently.

Flow control and congestion control solve different problems. Flow control protects the receiver using the advertised window. Congestion control protects the network using the congestion window. Slow start grows the congestion window quickly at first; congestion avoidance then grows it additionally. On congestion, Tahoe and Reno reduce the window, with Reno using fast retransmit and fast recovery after duplicate acknowledgements. This is the practical AIMD idea: increase cautiously, decrease strongly when congestion appears.

Modern congestion signaling can use ECN, where routers mark packets instead of dropping them. DCTCP is a data-center variant that uses the fraction of ECN-marked bytes to adjust the congestion window more precisely. TCP also has mechanisms such as Nagle's algorithm to avoid sending many small packets.

18.6 Application Layer: DNS, HTTP, DHCP, and ARP ​

The application layer contains protocols that applications directly use. DNS and HTTP are central here. DHCP is also useful for IP configuration, and ARP belongs naturally near the network/link boundary because it maps IPv4 addresses to link-layer addresses.

DNS ​

DNS is a hierarchical, distributed naming system. Its central role is to resolve human-readable domain names into numerical addresses and other records needed by network services.

Emphasize:

  • DNS maps names such as www.example.com to addresses such as IPv4 or IPv6 addresses.
  • It lets names stay stable even when physical location or routing changes.
  • Responsibility is delegated: each domain can have authoritative name servers, and responsibility can be delegated to subdomains.
  • DNS also stores information such as mail exchangers.
  • DNS is both a distributed database and a protocol.

required DNS details:

ConceptMeaning
Before DNSEarly Internet hosts relied on centrally maintained host tables such as HOSTS.TXT; this did not scale well.
Name hierarchyNames are hierarchical, with the root at the top, then top-level domains, domains, subdomains, and host/service names.
ZoneAn administratively managed part of the DNS namespace. A zone is served by authoritative name servers.
Zone fileA text representation of the records for a DNS zone, such as SOA, NS, A, AAAA, MX, CNAME, and TXT records.
Resource recordA typed DNS entry. Examples: A for IPv4 address, AAAA for IPv6 address, MX for mail exchanger, NS for name server, CNAME for alias, TXT for text metadata.
Local name server / recursive resolverThe resolver contacted by a host. It either answers from cache or recursively queries the DNS hierarchy on behalf of the client.
ResolutionThe process of finding records by following delegation from root to TLD to authoritative servers, or by using cached answers.

DNS resolution can be represented as:

HTTP ​

HTTP is an application-layer request-response protocol for distributed hypermedia systems. A client, usually a browser or other user agent, sends requests to a server, and the server sends responses. HTTP semantics are mostly independent of the underlying transport, though HTTP/1.1 and HTTP/2 usually run over TCP, while HTTP/3 runs over QUIC over UDP.

The statement that HTTP/2.0 was newest after 2015. That statement is now outdated: HTTP/3 is standardized by RFC 9114. For the exam, the important point is still the protocol model and persistence/cookies.

HTTP conceptMeaning
Stateless protocolEach request is independent at the protocol semantics level; state can be added by cookies, authentication, server sessions, or application logic.
Non-persistent HTTPA separate TCP connection is opened for each object/request. This causes repeated connection setup cost.
Persistent HTTPMultiple requests/responses reuse one connection, reducing handshake overhead and improving performance. HTTP/1.1 defaults to persistent connections unless closed.
CookieHTTP state-management mechanism. The server sends Set-Cookie; the user agent returns Cookie on later matching requests, enabling sessions over a mostly stateless protocol.
HTTP/2Multiplexes streams over a TCP connection and compresses headers.
HTTP/3Uses QUIC over UDP as its transport, preserving HTTP semantics while changing the transport behavior.

DHCP ​

DHCP automatically provides network configuration to hosts, commonly including IP address, network mask, default gateway, and DNS server.

Three allocation types:

Allocation typeMeaning
ManualAddress is assigned based on MAC address.
AutomaticAddress is assigned from a configured range.
DynamicAddress is leased from a range and can later be reused.

DHCP is a client-server protocol: clients send requests and servers provide configuration responses.

ARP ​

ARP maps IPv4 addresses to physical addresses such as Ethernet MAC addresses. A host broadcasts a question like "Who has this IP address?" on the local network. The owner replies with its hardware address.

Four common cases:

  1. Two clients on the same local network communicate directly.
  2. A host sends to a host on another network through a gateway.
  3. A router forwards a packet through another router.
  4. A router forwards to a destination on a directly attached network.

RARP, also mentioned in the network-layer section, historically did the reverse: it mapped physical address to IP address for a newly started station. It is largely historical and superseded by BOOTP/DHCP-style configuration.

What to Emphasize in an Oral Answer ​

  • Frame the application layer as user/application-facing protocols built on transport services.
  • For DNS, mention distributed hierarchical naming, delegation, zones, authoritative servers, recursive resolvers, caching, and common record types such as A, AAAA, MX, NS, CNAME, SOA, and TXT.
  • Explain DNS resolution as following referrals from root to TLD to authoritative servers unless a cached answer is available.
  • For HTTP, define request-response semantics and statelessness; cookies add application/session state.
  • Contrast non-persistent and persistent HTTP; note HTTP/1.1 persistence, HTTP/2 multiplexing over TCP, and HTTP/3 over QUIC/UDP.
  • Include DHCP: automatic IP configuration with manual, automatic, and dynamic lease allocation of address, mask, gateway, and DNS server.
  • Include ARP as the local IPv4-to-MAC mapping protocol using broadcast request and reply, and distinguish it from DNS.
Suggested answer

The application layer contains protocols that applications actually use. DNS is the distributed naming system of the Internet. It replaces unscalable central host tables with a delegated hierarchy: root, top-level domains, domains, subdomains, and host names. A zone is an administratively managed part of that hierarchy, served by authoritative name servers. Zone files contain resource records such as A, AAAA, MX, NS, CNAME, SOA, and TXT. A host normally asks a local recursive resolver, which follows referrals through the hierarchy or answers from cache.

HTTP is a request-response protocol for hypermedia systems. It is stateless at the protocol level: each request is separate, but cookies allow servers to maintain sessions. In non-persistent HTTP, a new TCP connection is opened for each object. In persistent HTTP, multiple requests use the same connection, which avoids repeated connection setup. HTTP/1.1 uses persistent connections by default, HTTP/2 multiplexes streams over TCP, and HTTP/3 keeps HTTP semantics but uses QUIC over UDP.

Also include DHCP and ARP. DHCP automatically supplies IP configuration such as address, mask, gateway, and DNS server, either manually, automatically, or dynamically by lease. ARP maps an IPv4 address to a physical address on a local network by broadcast request and reply.