Network layer services and design issues
Study notes on Network Layer services and design issues: what the network layer must provide, the trade-offs in its design, exact definitions (datagram vs virtual circuit, forwarding vs routing), performance formulas, worked examples and common exam pitfalls.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Network-layer design decides how packets move from a source host to a destination across many links and networks. Engineers use these ideas when choosing or designing routing, forwarding, addressing and fragmentation policies for real networks, and when trading off performance (delay, throughput) against complexity and state.
Key ideas
Start with definitions (each first use bolded):
- Network layer: the layer in the protocol stack that provides host-to-host packet delivery across a network of links and routers; it lies above the data link layer and below the transport layer. IPv4 uses a TTL (Time To Live) field, and IPv6 uses a Hop Limit, to bound packet lifetime and prevent forwarding loops.
- Forwarding: the per-router action of sending an incoming packet out on the correct outgoing link based on the packet's destination address and the router's forwarding table. (Local, per-packet operation.)
- Routing: the process of computing the paths (routes) that packets should take through the network, producing the information used to populate forwarding tables. (Global or distributed, slower-timescale process.)
- Packet / Datagram: a block of data sent over a packet-switched network that contains user data and header fields (addressing, flags). A datagram usually refers to a connectionless unit delivered independently.
- Virtual circuit (VC): a connection-oriented service that establishes state in each router along a path (a VC identifier and forwarding state) before user packets traverse; thereafter packets carry a small VC label instead of full addresses.
- Connectionless service: network delivers each packet independently (no per-connection state in routers). The Internet’s IP is an example (best-effort).
- Store-and-forward: a forwarding mode where each intermediate node receives the entire packet before beginning to transmit it on the next link.
- MTU (Maximum Transmission Unit): the largest IP packet (including the IP header) that can traverse a link without fragmentation.
Exact statements and derivations commonly asked for:
Store-and-forward end-to-end delay (single packet) over N links. Assumptions: packet length L (bits), link i rate Ri (bits/s), link i propagation distance di (m), propagation speed s (m/s), per-router processing time tp_i, ignoring queueing.
- At link i, transmission delay = L / Ri. Propagation delay = di / s. Processing delay at intermediate routers = tp_i. Each link must finish transmission before the next link can begin forwarding under strict store-and-forward.
- Therefore end-to-end delay D = sum_{i=1..N} (L / Ri + di / s) + sum_{routers} tp_i. If there are N links, there are N-1 intermediate routers (unless counting host processing), so add their tp_i values.
- For equal-rate links (Ri = R) and equal propagation si = s and equal processing t_p, this simplifies to D = N·(L/R) + total propagation + (N-1)·t_p.
- Diagram to draw: a horizontal line of N+1 nodes labelled S, R1, R2, ..., RN-1, D. Under each link draw L/R and di/s and arrow showing packet moving. Label processing times at routers.
Datagram vs Virtual-Circuit trade-off (state and headers). Statements:
- Datagram model: no per-flow state in routers; every packet carries full destination address; more flexible, robust to topology changes; per-packet processing heavier.
- VC model: requires setup phase; routers store per-VC state (scales poorly with number of flows); per-packet headers can be smaller; supports per-flow resources or QoS reservation more easily.
- Trade-off formula derivation (common exam): If setup cost S (bytes or time) is needed once per flow for VC, per-packet headers are Hv for VC and Hd for datagram, break-even number of packets P* solves: P*·Hd = S + P*·Hv → P* = S / (Hd - Hv) (if Hd > Hv).
- Diagram to draw: two parallel illustrations: (a) datagram: show packet with full destination address passed through routers (no state boxes in routers); (b) VC: show setup message establishing state in each router (draw small state table in each router) then packets with small VC label.
Fragmentation rules (IP): "When MTU < datagram length, split into fragments whose payload sizes (except possibly last) are multiples of 8 bytes; each fragment carries copy of header and Fragment Offset measured in 8-byte units; More-Fragments flag set except last fragment." Always state the 8-byte requirement. Also note: in IPv4, routers may fragment unless the DF (Don't Fragment) flag is set; in IPv6, routers do not fragment—only the source may, using the Fragment extension header—and Path MTU Discovery is used to avoid fragmentation.
Queueing summary and simple M/M/1 result (used in design): Assumptions: Poisson arrivals, exponential service times, single server, infinite buffer. Define arrival rate λ (packets/s), service rate μ (packets/s), traffic intensity ρ = λ/μ < 1. Then average waiting time in queue Wq = ρ / (μ - λ). Average time in system W = 1 / (μ - λ).
- State assumptions clearly; routers typically do not satisfy all assumptions exactly, but M/M/1 gives useful intuition about how delay grows rapidly as ρ→1.
Design issues (brief definitions and implications):
- Scalability: protocols must scale to millions of addresses and many routers; per-flow state in routers hurts scalability.
- Robustness: ability to continue forwarding around failures; connectionless datagrams are often more robust.
- Simplicity vs functionality: simpler forwarding/routing is easier to implement and faster, but may lack advanced features (per-flow QoS).
- Heterogeneity: links with different MTUs, rates, and error characteristics require mechanisms like fragmentation and adaptation.
- Security and policy: design must allow (or resist) filtering, traffic control, address hiding (NAT), and protection against attacks.
Formulas
Transmission delay = L / R — L = packet length (bits), R = link rate (bits/s). Applies to one link; units seconds (s).
Propagation delay = d / s — d = link length (m), s = propagation speed (m/s, ~2.0×10^8 m/s typical in fibre). Units: seconds.
Store-and-forward end-to-end delay D = sum_{i=1..N} (L / R_i + d_i / s) + sum_{routers} t_p_i — sums over links and routers; seconds.
Throughput in steady state for a stream across N store-and-forward links is limited by the bottleneck: inter-arrival spacing at the destination ≈ L / R_max. End-to-end latency per packet remains D = sum_{i=1..N} (L / R_i + d_i / s) + sum_{routers} t_p_i; pipelining only reduces the additional time per extra packet (after the first) to ≈ L / R_max. — R_max is the bottleneck rate; units seconds for times. (Use with care; depends on packetization.)
Break-even packet count for VC vs datagram P* = S / (H_d - H_v) — S = one-time setup cost (bytes or seconds), H_d = per-packet datagram header (bytes), H_v = per-packet VC header (bytes). Unit: packets.
M/M/1 queue average waiting in queue W_q = ρ / (μ - λ) — λ = arrival rate (packets/s), μ = service rate (packets/s), ρ = λ/μ, requires ρ < 1. Units seconds.
Utilization ρ = λ / μ — fraction of time server busy (dimensionless).
Throughput = successful data bits delivered / time — units bits/s.
Worked examples
End-to-end delay (store-and-forward) Given: packet L = 12,000 bits. Link1 R1 = 1 Mbps, d1 = 200 km. Link2 R2 = 2 Mbps, d2 = 100 km. Link3 R3 = 512 kbps, d3 = 50 km. Propagation speed s = 2·10^8 m/s. Processing time per intermediate router t_p = 1 ms. Queueing negligible. Find total delay. Steps:
- Transmission delays: t_tx1 = 12000 / 1e6 = 0.012 s = 12.0 ms. t_tx2 = 12000 / 2e6 = 0.006 s = 6.0 ms. t_tx3 = 12000 / 512000 ≈ 0.0234375 s = 23.4375 ms.
- Propagation delays: convert km to m: d1=200000 m → t_prop1 = 200000 / 2e8 = 0.001 s = 1.0 ms. d2=100000 m → 0.0005 s = 0.5 ms. d3=50000 m → 0.00025 s = 0.25 ms. Total propagation = 1.75 ms.
- Processing: two intermediate routers → 2·1 ms = 2.0 ms.
- Sum: transmission = 41.4375 ms; propagation = 1.75 ms; processing = 2.0 ms. Total = 45.1875 ms. Answer: 45.1875 ms.
Datagram vs Virtual-Circuit header trade-off Given: datagram header Hd = 40 bytes, VC per-packet header Hv = 4 bytes, and one-time VC setup cost S = 1200 bytes. How many packets P make VC overhead equal to datagram overhead? Steps:
- Solve P·Hd = S + P·Hv → P·(Hd - Hv) = S → P = S / (Hd - Hv).
- P = 1200 / (40 - 4) = 1200 / 36 = 33.333... → round up to 34 packets. Answer: 34 packets (VC pays off if the flow will send ≥34 packets).
Fragmentation example (IP 8-byte rule) Given: an IP datagram carrying 4000 bytes of payload (user data) plus header H = 20 bytes; outgoing link MTU = 1500 bytes (includes IP header). Determine fragments. Steps:
- Max payload per fragment = MTU - H = 1500 - 20 = 1480 bytes. Must be multiple of 8 → 1480 / 8 = 185, so OK.
- First fragment payload = 1480 bytes, total length = 1500 bytes, Offset = 0, MF = 1.
- Second fragment payload = 1480 bytes, total length = 1500 bytes, Offset = 1480/8 = 185, MF = 1.
- Remaining payload = 4000 - 2960 = 1040 bytes. 1040 / 8 = 130 → exact. Third fragment payload = 1040 bytes, total length = 1060 bytes, Offset = (1480+1480)/8 = 370, MF = 0. Answer: three fragments with offsets 0, 185, 370 and total lengths 1500, 1500, 1060 bytes respectively.
Common mistakes
- In fragmentation, forgetting the 8-byte multiple requirement for offsets and payload (IP requirement).
- Mixing bytes and bits without conversion (e.g., header in bytes vs rate in bits/s). Convert bytes→bits by ×8.
- For the VC vs datagram trade-off forgetting to round up P to an integer (packet count).
- Using M/M/1 queue formulas without stating assumptions (Poisson arrivals, exponential service). Extrapolating those formulas to arbitrary router behavior gives wrong numerical expectations.
For your exam
Kinds of questions you will see:
- Definitions: explain forwarding vs routing, datagram vs virtual circuit, store-and-forward.
- Short notes: list design issues (scalability, robustness, heterogeneity) and explain their impact.
- Derivations: derive end-to-end delay in store-and-forward networks; derive break-even formula for VC vs datagram overhead.
- Numericals: compute delay over multi-link path, do fragmentation calculations, compute queueing delay using M/M/1 assumptions.
- Diagrams: draw a source–router–router–destination chain and label transmission/propagation/processing delays; draw diagrams that contrast datagram and VC (show setup/state boxes).
What a full-marks answer includes:
- Clear definitions of terms used (bold or underlined in handwritten answers is fine).
- All assumptions stated (e.g., ignore queueing, or assume Poisson arrivals).
- Step-by-step algebra with units carried through (bits vs bytes, meters vs km, seconds).
- Correct diagrams with labels: nodes, links, delay terms, header/state boxes.
- Final numeric answers boxed or clearly distinguished and units given.
Quick check
- What is the formula for transmission delay?
- In IP fragmentation, fragment offset is measured in what units?
- State one advantage of connectionless datagram service over virtual circuits.
Answers: 1) L / R (L bits, R bits/s). 2) 8-byte units. 3) More robust and scalable (no per-flow state in routers; packets routed independently).
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?