electronics engineering
Course handbook · Fifth year · Edition with space for notes
Telecom Networks
Telecommunication networks: protocols, the OSI and TCP/IP models, routing, switching and network configuration.
- 8Topics
- 0Solved exercises
- 8Formula sheet
Free handbook generated from the lessons of the site and updated often, every time a lesson or an exercise changes: the latest version is always at www.electronics-engineering.com/handbook/telecommunication-networks. Links work in the PDF too.
1Layered architecture and delays
A telecommunication network must deliver data among billions of different devices, through cables, fibres and radio links of very different nature, run by different organisations. It succeeds by dividing the problem into layers, each with a precise task. In this lesson we look at the layered architecture and encapsulation, circuit and packet switching, the four components of delay, the proof of the advantage of packet transmission over a chain of nodes, and the bandwidth-delay product.
The layers
The Internet model has five layers:
- application: the programs that use the network (web, mail, video), with their protocols (HTTP, SMTP, DNS);
- transport: communication between two processes on two machines, reliable (TCP) or not (UDP);
- network: routing packets from source to destination across many nodes (IP);
- link: transfer over a single hop between two adjacent nodes (Ethernet, Wi-Fi);
- physical: bits on the medium, with the modulations and codes seen in Electrical Communications.
The OSI model has seven, adding presentation and session, which in the Internet are tasks of the applications. Each layer uses the services of the one below and offers services to the one above, and talks to the layer at the same level on the other side through a protocol: a set of rules on the format of messages and on the actions to take.

Going down, each layer adds its own header with the information its peer needs: ports for transport, IP addresses for the network, physical addresses and an error-check code (CRC, Electrical Communications lesson on codes) for the link. This is encapsulation. The advantage is modularity: Wi-Fi can be replaced by fibre without the browser noticing.
Circuits and packets
The traditional telephone network uses circuit switching: before talking, a path with fixed capacity is reserved for the whole duration of the call. Service is guaranteed, but the reserved capacity sits idle during silences. The Internet uses packet switching: data is divided into packets, each with the destination address, and each node forwards them one at a time, queuing them if the outgoing link is busy. Resources are shared among all users according to momentary demand (statistical multiplexing), with much more efficient use of capacity, at the price of variable delays and possible losses when queues fill up.
The components of delay
A packet of
bits crossing a node and the following link suffers four delays:
- processing: the node reads the header and decides where to forward it, microseconds;
- queuing: depends on traffic, from zero to many milliseconds (lesson on queues);
- transmission: the time to put all the bits onto the link of rate
,
. A 1500-byte packet on a 100 Mb/s link takes 120 µs; - propagation: the time a bit takes to cross the medium,
, with
about
m/s in copper and fibre. For 1000 km it is 5 ms, whatever the link rate.
Why divide into packets
In store-and-forward nodes a packet must be received completely before it is retransmitted.
Theorem. A message divided into
packets of
bits crosses
links of rate
(neglecting propagation, processing and queues) in a time
![]()
Proof. The first packet takes
on each link and arrives after
. While the first crosses the second link, the second packet crosses the first link, and so on: the packets advance in line, and one arrives at the destination every
. The last arrives
after the first, i.e. at
. ∎
Example. A 1 MB (8 Mbit) file over three 10 Mb/s links. As a single message (
,
Mbit) it takes
s. Divided into 1000 packets of 8000 bits,
s: a third. The longer the message relative to the number of hops, the closer packet transmission comes to the time of a single link. Moreover, an error forces retransmission of one packet rather than the whole message. The limit is the cost of headers, which weigh more on small packets.
The bandwidth-delay product
How many bits are “in flight” on the link at a given moment? The product of the rate and the propagation delay,
. With 1 Gb/s and 50 ms one way (an intercontinental route) it is 50 Mbit, more than 6 MB. The bandwidth-delay product, computed on the round-trip time (RTT), says how much data the sender must be able to send without waiting for acknowledgements in order to keep the link full: it is why TCP windows must be large on fast, distant networks (lesson on TCP).
2Queueing theory
In a packet network the largest and most variable delays arise in queues: a router receives packets from many directions and must transmit them one at a time. How long does one wait on average? How heavily can a link be loaded before delays explode? Queueing theory answers with simple and surprisingly useful formulas. In this lesson we look at Little’s law with its proof, the M/M/1 queue with the proof of the distribution of the number of packets, the growth of delay with load, and the advantage of statistical multiplexing proved.
The model
A queue is described by how customers (packets) arrive, how long service (transmission) lasts and how many servers there are. Let
be the arrival rate (packets per second) and
the service rate (packets per second the link transmits when busy). The ratio
![]()
is the utilisation: the fraction of time the link is busy. For the queue not to grow without bound,
is needed.
Little’s law
Theorem (Little). In a system in equilibrium, the mean number of customers present
, the arrival rate
and the mean time spent in the system
are related by
![]()
Proof (idea). Observe the system for a long time
. Plot the number of customers present as a function of time and compute the area under the curve. It can be computed in two ways: integrating the number present over time,
; or adding up the time each customer spent in the system, because each contributes to the area a strip of height 1 and length equal to its stay. In time
about
customers arrive, with mean stay
, for an area
. Equating and dividing by
gives the law. ∎
It holds for any distribution of arrivals and services, and for any part of the system: the queue alone, the server alone, a whole network. If a router holds 50 packets on average and 10 000 arrive per second, each stays 5 ms on average.
The M/M/1 queue
The simplest model has Poisson arrivals (independent, with exponential inter-arrival times), exponential service times and a single server: it is written M/M/1. The state is the number
of packets present.
Theorem. In equilibrium the probability of finding
packets is
, and
![]()
Proof. The state goes from
to
with an arrival, at rate
, and from
to
with a departure, at rate
. In equilibrium the probability flow between two adjacent states balances:
, i.e.
, whence
. The probabilities must sum to 1:
, so
. The mean of a geometric distribution of this kind is
. Finally, by Little’s law,
. ∎

The lesson of the graph
The delay, measured in service times
, is
: 2 at 50 % utilisation, 5 at 80 %, 10 at 90 %, 100 at 99 %. Growth is gentle up to half load and violent beyond 80 %.
Example. A 10 Mb/s link with 1000-byte packets has
packets per second, i.e. 0.8 ms per packet. With
packets per second (
) the mean time in the system is
ms: five times the transmission time. That is why network operators add capacity well before links are saturated, and why a “slow” network is often not slow but loaded.
Real traffic is not exactly Poisson: it is burstier, and delays at the same load are larger. But the shape of the curve, exploding near
, remains.
Statistical multiplexing
Theorem. A single link of capacity
shared by
flows each of rate
gives a mean delay
times smaller than
separate links of capacity
, each dedicated to one flow.
Proof. With separate links, each has service rate
(where
corresponds to capacity
) and arrivals
:
. With the shared link service is
and arrivals
:
. The ratio is
. Utilisation is the same in both cases. ∎
It is the quantitative justification of packet switching (lesson on architecture): pooling resources reduces waiting, because a flow can use the capacity left free by the others. The same principle, pooling resources, explains why in a supermarket a single queue serving several tills works better than separate queues.
3Ethernet and switching
Ethernet was born in 1973 as a coaxial cable shared by a few computers in a laboratory, and it has become the technology of almost every local network and of much of operators’ networks, from 10 Mb/s to 800 Gb/s. In this lesson we look at the Ethernet frame and addresses, multiple access with collision detection with the proof of the minimum frame length, switches that learn by themselves where stations are, the problem of loops with the spanning tree and the proof of its properties, and VLANs.
The frame and addresses
An Ethernet frame contains the destination and source addresses, a field indicating the protocol carried (for instance IPv4 or IPv6), the data, from 46 to 1500 bytes in the classic version, and a 32-bit check code (CRC) that lets the receiver discard damaged frames. MAC addresses are 48 bits, written in hexadecimal as 3C:22:FB:1A:07:9E: the first 24 identify the manufacturer, the rest the card. The address with all bits set to 1 is the broadcast, received by all stations.
The shared medium and collisions
In the original Ethernet all stations were connected to the same cable. The CSMA/CD protocol (carrier sense multiple access with collision detection): a station listens to the medium, transmits only if it is free, and keeps listening while transmitting; if it detects a collision with another transmission it stops, waits a random time and tries again, doubling the mean waiting interval each time (binary exponential backoff). It is an evolution of ALOHA (Electrical Communications lesson on multiple access).
Theorem. For a station always to notice a collision while it is still transmitting, the frame duration must be at least twice the maximum propagation time
between two stations:
.
Proof. The worst case: station A, at one end, starts transmitting; the signal takes almost
to reach station B at the other end, which an instant earlier found the medium free and started transmitting. The collision happens near B, and B’s signal takes another
to return to A. A receives evidence of the collision about
after the start of its own transmission: if it had already finished by then, it would believe the frame had arrived. A transmission lasting at least
, i.e. at least
bits, is therefore needed. ∎
In 10 Mb/s Ethernet the value set was 512 bits (51.2 µs), covering 2500 m with repeaters: hence the 64-byte minimum frame length, still in the standard.
Switches
Today every station is connected with its own cable to a switch, in full duplex: it can transmit and receive at the same time, and collisions no longer exist. The switch receives a frame on one port and forwards it only on the port where the destination is. How does it know? It learns by itself:
- for every frame received, it records in a table that the source address lies behind the port it came from;
- if the destination address is in the table, it forwards the frame only on that port (or discards it, if it is the same port it came from);
- if it is not, or if it is a broadcast, it forwards it on all the other ports (flooding).
Entries age and are deleted after a few minutes, so the table follows stations as they move. No configuration is needed: plug in the cables and it works.
The problem of loops
For reliability, switches are connected with redundant paths. But a loop is fatal: a broadcast frame is forwarded by every switch on all ports, comes back round the loop and is forwarded again, forever, multiplying at every turn. In a few seconds the network is saturated (broadcast storm), and the tables go haywire because they see the same source on different ports.

The spanning tree protocol (STP, and its rapid version RSTP) solves the problem: the switches elect a root (the one with the lowest identifier), each computes its shortest path to the root, and ports not on these paths are blocked. The result is a tree.
Theorem. A tree connecting
nodes has exactly
links, and between any two nodes there is a single path.
Proof. *Uniqueness of the path.* If there were two different paths between two nodes, joining them would give a cycle, which a tree by definition does not have. *Number of links.* By induction: a tree with one node has zero links. A tree with
nodes has at least one leaf (a node with a single link: following a longest possible path, its last node cannot have other neighbours without creating a cycle or lengthening the path). Removing the leaf and its link leaves a tree with
nodes, which by hypothesis has
links; putting them back gives
. ∎
The unique path guarantees that every frame arrives only once. The blocked links remain as spares: if an active link fails, the tree is recomputed and a spare one is activated, in a few seconds with RSTP.
VLANs
A flat local network sends every broadcast to everyone, and does not separate a company’s departments. VLANs (virtual LANs, IEEE 802.1Q standard) divide a physical switch into several logical switches: each port belongs to a VLAN, and frames passing between switches carry a 12-bit tag with the VLAN number, up to 4094 networks. Stations in different VLANs cannot see each other at the link layer: to communicate they must go through a router, where security rules can be applied (lesson on IP addressing).
4IP addressing
The IP protocol is the meeting point of the whole Internet: above it there are thousands of applications, below it tens of link technologies, and in between a single packet format and a single addressing scheme. In this lesson we look at IPv4 addresses and CIDR notation, subnet calculation with an example and the proof of the number of hosts, address aggregation, the longest-prefix rule, the support protocols ARP and DHCP, NAT, fragmentation and IPv6.
IPv4 addresses
An IPv4 address is a 32-bit number, written as four bytes in decimal separated by dots: 192.168.10.70. Every address is divided into two parts: a network prefix, common to all the interfaces of the same network, and a host part. With CIDR notation (classless inter-domain routing) the prefix length is written after a slash: 192.168.10.0/24 denotes the network whose addresses share the first 24 bits. The same information is the mask 255.255.255.0, with 24 bits set to 1.
Theorem. A network with an
-bit prefix contains
addresses, of which
can be assigned to interfaces.
Proof. The
host bits can take
different combinations. Two are reserved: the one with all host bits 0 identifies the network itself, the one with all 1s is the network’s broadcast address. ∎
A /24 therefore has 254 hosts, a /16 65 534. For point-to-point links between two routers /31s are used, with only two combinations, for which the rule makes an exception.
Subnets

A company with the network 192.168.10.0/24 wants four separate networks for four departments. It borrows 2 bits from the host part, obtaining /26 prefixes: four subnets, each of
addresses and 62 hosts.
| Subnet | First host | Last host | Broadcast |
|---|---|---|---|
| 192.168.10.0/26 | .1 | .62 | .63 |
| 192.168.10.64/26 | .65 | .126 | .127 |
| 192.168.10.128/26 | .129 | .190 | .191 |
| 192.168.10.192/26 | .193 | .254 | .255 |
Host 192.168.10.70 is in the second subnet: its last 8 bits are 01000110, and the first two, 01, indicate subnet number 1 (counting from 0). A host compares its own prefix with that of the destination: if they match, it delivers directly on the local network, otherwise it sends the packet to its default router (gateway).
Aggregation and the longest prefix
CIDR allows aggregation: the four networks 10.4.0.0/24, 10.4.1.0/24, 10.4.2.0/24, 10.4.3.0/24 share the first 22 bits and are announced as a single 10.4.0.0/22. Aggregation is possible when the blocks are contiguous and aligned:
consecutive blocks starting at a multiple of
. Thanks to aggregation the tables of the routers in the core of the Internet have about a million entries instead of billions.
A table may contain overlapping prefixes. The rule is the longest prefix: the most specific entry matching the address is used. With entries 10.0.0.0/8 towards R1, 10.1.0.0/16 towards R2 and 10.1.2.0/24 towards R3, the packet for 10.1.2.5 goes to R3, the one for 10.1.9.9 to R2 and the one for 10.7.0.1 to R1. The entry 0.0.0.0/0, which matches everything, is the default route. Routers find the longest prefix in nanoseconds with tree structures and associative memories (TCAMs).
ARP and DHCP
To deliver a packet on the local network the MAC address of the destination or of the router is needed (lesson on Ethernet). The ARP protocol asks for it with a broadcast: “who has address 192.168.10.1?”, and the owner answers with its MAC, which is remembered for a few minutes. DHCP automatically assigns a newly connected device its IP address, mask, default router and DNS servers, with a four-message broadcast exchange.
NAT
IPv4 addresses number about 4 billion, fewer than the connected devices. The practical solution is NAT (network address translation): a home or company network uses private addresses (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), not routed on the Internet, and the router translates the outgoing source address and port into those of its own public address, remembering the mapping to translate replies back. Hundreds of devices thus share one public address. The price is that a connection to an internal device cannot be started from outside without special configuration.
Fragmentation
Every link has a maximum packet size, the MTU (1500 bytes for Ethernet). In IPv4 a router can split a packet that is too large into fragments, reassembled by the destination; but losing one fragment loses the whole packet, and today path MTU discovery is preferred: packets are sent with fragmentation forbidden, and if a router replies that they are too large the source makes them smaller.
IPv6
IPv6 uses 128-bit addresses, written in hexadecimal in 16-bit groups: 2001:db8:4a2::1f. The space is practically inexhaustible: an ordinary local network receives a /64, i.e.
addresses. The header is simplified, routers no longer fragment, and devices can configure themselves by combining the prefix announced by the router with their own identifier. In 2025 about half of accesses to Google happen over IPv6, and the two versions coexist through dual-stack and translation mechanisms.
5Routing
A router must know, for every destination, which neighbour to pass a packet to. Nobody writes the tables by hand: the routers compute them themselves, exchanging information through routing protocols. Behind them are two classic graph algorithms. In this lesson we look at Dijkstra’s algorithm with the proof of its correctness, link-state protocols such as OSPF, the Bellman-Ford algorithm and distance-vector protocols with the count-to-infinity problem, and BGP, which holds the networks of the Internet together.
The network as a graph
The network is represented as a graph: routers are the nodes, links the edges, each with a positive cost chosen by the administrator (often inversely proportional to the link speed). The best path between two nodes is the one with minimum total cost.
Dijkstra’s algorithm
In link-state protocols every router floods to all the others the list of its neighbours and costs. In the end every router knows the whole graph and computes by itself the shortest paths to all destinations with Dijkstra’s algorithm (1959):
- the source node has distance 0, all others infinite distance; no node is “final”;
- among the non-final nodes, choose the one with the minimum tentative distance and make it final;
- for each of its neighbours
check whether going through it shortens the route: if
, update
and record that the predecessor of
is
; - go back to step 2 until all nodes are final.

Theorem. If all costs are non-negative, when a node is made final its tentative distance is the shortest distance from the source.
Proof. By contradiction, let
be the first node made final with a distance
greater than the true shortest distance
. Consider a shortest path from the source to
. It starts at a final node (the source) and ends at
, not yet final: along the path there is therefore a first non-final node
, preceded by a final node
. When
was made final its distance was correct (
is the first error), and step 3 set
, i.e.
. Since costs are non-negative,
,
lying on a shortest path to
. So
: the algorithm should have chosen
before
, contrary to the hypothesis. ∎
With negative costs the argument fails, but in networks costs are always positive. The predecessors form the shortest-path tree: from it the router derives, for every destination, the first hop to use. OSPF (Open Shortest Path First), the most widespread link-state protocol inside company and operator networks, does exactly this, and recomputes the tree in milliseconds when a link changes state.
Bellman-Ford and distance vectors
The alternative does not require knowing the whole graph. Each router
knows only the costs to its neighbours and the distance vectors that the neighbours send it periodically, and applies the Bellman-Ford equation:
![]()
that is: my distance to
is the best of “cost to reach the neighbour plus the distance the neighbour declares”. Repeating the exchanges, the estimates converge to the true distances. It is the principle of RIP, one of the oldest protocols, simple but slow.
Count to infinity. Bad news travels badly. Take three routers in a line, A, B and C, with costs 1. A is at distance 2 from C via B. If link B-C fails, B looks for an alternative and finds that A declares distance 2 to C: it then thinks it can go through A with cost 3, not knowing that A’s path goes through B itself. A receives B’s new vector and raises its own estimate to 4, B to 5, and so on: distances grow by one at every exchange, while packets for C bounce between A and B. RIP limits the damage by setting infinity at 16 hops; techniques such as split horizon with poisoned reverse (A declares to B infinite distance to destinations it reaches through B) fix the simple cases but not all of them.
BGP and the Internet
The Internet is made of about 75 000 autonomous systems (ASes): networks of operators, universities, companies, each with its own policy. Inside an AS, OSPF or a similar protocol is used; between different ASes BGP (Border Gateway Protocol) is used. BGP is a path-vector protocol: an announcement carries not just a distance but the list of ASes to cross to reach a prefix. This eliminates loops (an AS discards announcements already containing itself) and enables policies: an operator may prefer a longer but cheaper path, or refuse to carry traffic between two competitors.
BGP rests on trust in announcements, and therein lies its weakness: an AS that announces, by mistake or by malice, a prefix that is not its own can attract traffic meant for someone else. Such episodes have made global services unreachable for hours. The countermeasure being rolled out is RPKI, which cryptographically signs which ASes are authorised to announce which prefixes.
6TCP and congestion control
IP delivers packets on a “best effort” basis: they may be lost, arrive out of order or duplicated. On top of it TCP builds a reliable, ordered byte stream between two programs, and does something more delicate too: it regulates each sender’s speed so that millions of connections share the network without making it collapse. In this lesson we look at reliable transmission with the sliding window and the proof of its efficiency, connection management, congestion control with additive increase and multiplicative decrease, and the proof that this mechanism shares bandwidth fairly.
The efficiency of stop-and-wait
The simplest way to transmit reliably: send a packet, wait for the acknowledgement (ACK), then send the next, retransmitting if the acknowledgement does not arrive within a timeout.
Theorem. With packets of
bits, rate
and round-trip time RTT, the fraction of time the link transmits with stop-and-wait is
![]()
Proof. The sender takes
to send the packet; the last bit arrives after the propagation delay, and the acknowledgement comes back after another: in all, from the start of transmission to the acknowledgement,
elapse (neglecting the duration of the acknowledgement). In this interval the link is used only for
. ∎
With 1 Gb/s, 1500-byte packets (12 µs) and an RTT of 30 ms,
: 0.04 % of the link is used. The solution is the sliding window: up to
bytes can be sent without waiting for acknowledgements. The maximum rate becomes
![]()
and to fill the link the window must be at least the bandwidth-delay product
(lesson on architecture): in the example 3.75 MB. If a packet is lost, everything from there on can be retransmitted (go-back-N) or only the lost packet (selective repeat, which TCP implements with selective acknowledgements, SACK).
The TCP connection
TCP opens the connection with the three-way handshake: SYN from the client, SYN-ACK from the server, ACK from the client. Every byte has a sequence number, and acknowledgements are cumulative: “I have received everything up to byte
“. The receiver announces how much space it has in its buffer (the receive window): this is flow control, which prevents a fast sender from swamping a slow receiver. The retransmission timeout adapts continuously, estimating the mean and the variability of the RTT.
Congestion control
Flow control protects the receiver; the network must be protected separately. If everyone transmits too much, router queues fill up, packets are lost, senders retransmit, and the network can reach congestion collapse: all capacity is used for useless retransmissions. It really happened on the Internet in 1986, and Van Jacobson introduced the mechanism that, with variants, is still in use.
The sender keeps a congestion window
, and the window used is the smaller of this and the receive window:
- slow start: at first
doubles every RTT, to find the available capacity quickly; - additive increase: past a threshold,
grows by one packet per RTT, to probe cautiously for more room; - multiplicative decrease: when a packet is lost, a sign that a queue is full,
is halved.

In steady state the window oscillates in a sawtooth between
and
, with mean value
. From this follows the well-known Mathis formula: with loss probability
, the throughput is about
, where MSS is the segment size. Doubling the distance halves the speed, and reaching 10 Gb/s over long distances requires tiny loss probabilities.
Fairness
Why exactly “additive increase, multiplicative decrease” (AIMD)? Because it is the combination that leads connections to share bandwidth equally, without anyone coordinating them.
Theorem. Two connections with the same RTT sharing a link with an AIMD policy converge to equal rates.
Proof. Let
and
be the two rates and
the difference. During additive increase both grow by the same amount per RTT, so
does not change. When the sum exceeds the capacity, both suffer a loss and halve:
becomes
. After
losses the difference is
, which tends to zero, while the sum keeps oscillating around the capacity. ∎
With multiplicative increase and additive decrease the difference would grow instead of shrinking. Connections with different RTTs are not treated equally: the closer one grows faster and gets more.
Modern variants
On fast, distant networks growth by one packet per RTT is too slow. CUBIC, the default in Linux, grows the window as a cubic function of the time since the last loss, independent of the RTT. BBR, developed by Google, does not wait for losses: it estimates the bottleneck bandwidth and the minimum RTT, and sends at the estimated rate, keeping queues short. The QUIC protocol, on which HTTP/3 is based, brings these functions on top of UDP, together with encryption, so that they can be updated without touching the operating system.
7Quality of service, MPLS and SDN
The Internet treats all packets the same way, but not all services have the same needs: a phone call tolerates some loss but not delays beyond 150 ms, a file transfer the opposite, the control of a remote robot requires small, guaranteed delays. Quality of service (QoS) is the set of techniques for giving different guarantees to different flows. In this lesson we look at the token bucket with the proof of the bound on traffic and on delay, queue service disciplines, the IntServ and DiffServ architectures, MPLS label switching and software-defined networks.
What is guaranteed
The parameters of a flow are bandwidth, end-to-end delay, its variability (jitter) and loss. Propagation delay is fixed; what can be controlled is the delay in queues (lesson on queues). To give guarantees two things must be done: describe the traffic a flow will inject, and serve the queues so as to meet the commitments.
The token bucket
A flow is described with a token bucket with parameters
and
: a bucket of capacity
fills with tokens at a rate of
tokens per second; every byte transmitted consumes a token, and if the bucket is empty one must wait. The flow can thus send bursts of up to
bytes, but on average no more than
bytes per second.
Theorem. The traffic
leaving a token bucket in any interval of duration
satisfies
![]()
Proof. At the start of the interval the bucket holds at most
tokens. During the interval at most
arrive. Every byte transmitted consumes a token, so the bytes transmitted cannot exceed the tokens available,
. ∎

Theorem. If a flow conforming to the bucket
is served by a link guaranteeing it at least rate
, the queuing delay does not exceed
.
Proof. The worst case is a burst of
bytes arriving all at once with an empty queue: the last byte must wait for the earlier ones to be transmitted, i.e.
. After the burst, data arrives at most at rate
, more slowly than it is served, so the queue cannot exceed the initial one. ∎
The same bucket, placed at the network edge, serves as a shaper (which delays excess packets) or a policer (which drops them or marks them as less important).
Service disciplines
- FIFO: first come, first served. Simple, but an aggressive flow delays all the others.
- Priority: several queues, and the highest-priority non-empty one is always served. Excellent for voice, but low-priority flows can starve.
- Weighted fair queuing (WFQ) and its efficient approximations such as deficit round robin: each flow has a queue and a weight
, and receives at least the fraction
of the capacity. This is what makes it possible to guarantee the rate
of the previous theorem.
Against swelling queues (bufferbloat) active queue management schemes such as CoDel are also used, dropping or marking packets before the queue is full, to signal congestion early to TCP (lesson on TCP).
IntServ and DiffServ
The IntServ architecture reserved resources for every single flow along the whole path: strict guarantees, but every router had to remember millions of flows, and it never worked at scale. DiffServ instead classifies packets at the network edge into a few classes, written in 6 bits of the IP header: for example “expedited forwarding” (EF) for voice, “assured forwarding” (AF) with various levels, “best effort” for the rest. Internal routers treat each class with its own queue and priority, without knowing the flows. This is what operators use today to separate telephony, television and Internet on the same network.
MPLS
In operators’ networks packets are often forwarded not by looking at the IP address but at a short label added at the network entrance: this is MPLS (multiprotocol label switching). Each router looks the label up in a small table, replaces it with the next one and forwards the packet along a label-switched path set up in advance. The advantage is no longer so much speed as control: the operator can route traffic on paths other than the shortest ones to balance load (traffic engineering), set up backup paths that can be activated in 50 ms, and build virtual private networks that separate customers on the same infrastructure.
Software-defined networks
In traditional routers every device decides on its own with routing protocols. Software-defined networks (SDN) separate the control plane, which decides the paths, from the data plane, which forwards packets: a central controller, a program that sees the whole network, installs forwarding rules in the devices’ tables (with protocols such as OpenFlow). The network becomes programmable: its behaviour can be changed with software instead of reconfiguring device by device. Together with network function virtualisation (NFV), which replaces dedicated appliances with programs on ordinary servers, it is the basis of data-centre networks and of the 5G core, where the same physical infrastructure is divided into “slices” (network slicing) with different guarantees for different services.
8Network security
The Internet was designed by researchers who trusted one another: no original protocol encrypted data or verified who sent it. Today security is part of every layer. In this lesson we look at the goals of security, symmetric and public-key cryptography, Diffie-Hellman key exchange with the proof and a numerical example, the man-in-the-middle attack and certificates, hash functions and signatures, the TLS protocol, and network defences: firewalls, VPNs and protection against denial-of-service attacks.
The goals
- Confidentiality: only the recipient can read the message.
- Integrity: the message has not been modified.
- Authentication: it is known who sent it.
- Availability: the service stays reachable even under attack.
The typical attacker can read, modify, delete and insert packets along the path: anyone controlling a public Wi-Fi network, a router or a link can do it.
Symmetric cryptography
Sender and recipient share a secret key
, used both to encrypt and to decrypt. The standard algorithm is AES, with 128- or 256-bit keys: trying all
keys would take all the computers in the world vastly longer than the age of the universe. It is fast (processors have dedicated instructions and encrypt tens of gigabits per second) but it has a fundamental problem: how do two parties agree on the key if they have never met, communicating over a network the attacker is listening to?
Diffie-Hellman key exchange
In 1976 Whitfield Diffie and Martin Hellman showed that it is possible. A large prime
and a number
are chosen publicly. A chooses a secret
and sends
; B chooses a secret
and sends
.

Theorem. A and B obtain the same key:
.
Proof. Arithmetic modulo
preserves products and powers: if
then
. So
and
, and the two quantities coincide. ∎
Example with small numbers. With
,
,
,
: A sends
, B sends
. A computes
, B computes
: the common key is 2. The attacker sees
,
, 8 and 19, but to obtain the key would have to find
from
: the discrete logarithm, which for 2048-bit primes (or, with elliptic curves, at 256 bits) nobody knows how to solve in reasonable time.
The man in the middle and certificates
Diffie-Hellman alone does not say with whom one is talking. An attacker on the path can do one exchange with A pretending to be B and another with B pretending to be A, and then read and relay everything: the man-in-the-middle attack. Authentication is needed.
Public-key cryptography (RSA, elliptic curves) uses key pairs: the public key is known to everyone, the private key only to its owner. What is signed with the private key is verified with the public one. A digital signature is computed on the digest of the message produced by a cryptographic hash function (SHA-256): a function that produces 256 bits from any message, such that it is impractical to find two messages with the same digest. Changing a single bit of the message changes the digest completely, and the signature no longer checks out.
But how does one know that a public key really belongs to the bank’s site? A certificate guarantees it: a document binding the site’s name to its public key, signed by a certification authority, whose public key is already installed in the browser and the operating system. This is the chain of trust of the PKI (public key infrastructure).
TLS
The TLS protocol (the “S” in HTTPS) puts all the pieces together. In version 1.3, in a single round trip: client and server perform an elliptic-curve Diffie-Hellman exchange, the server sends its certificate and signs the exchange with its private key (so the client knows it is talking to the right site and not to a man in the middle), and from the common key the symmetric AES keys are derived, with which all subsequent data is encrypted and authenticated. Because the session keys come from an ephemeral exchange, even someone who stole the server’s private key in the future could not decrypt traffic recorded today: this is forward secrecy.
Network defences
- Firewalls: filter traffic by addresses, ports and connection state, for instance allowing in from outside only replies to connections opened from inside. Next-generation ones also inspect application content.
- VPNs: create an encrypted tunnel (IPsec, WireGuard) between two networks or between an employee and the company, across the Internet.
- Intrusion detection (IDS): looks in the traffic for the signatures of known attacks or for anomalous behaviour.
- Distributed denial of service (DDoS): millions of compromised devices, often cameras and home routers, flood a target with traffic, up to terabits per second. Defences are very large distribution networks that absorb the traffic, filters at the operators, and per-source rate limiting with the token buckets of the lesson on quality of service.
∑Formula sheet
Layered architecture and delays
Why divide into packets
![]()
Queueing theory
The model
![]()
Little's law
![]()
The M/M/1 queue
![]()
Routing
Bellman-Ford and distance vectors
![]()
TCP and congestion control
The efficiency of stop-and-wait
![]()
![]()
Quality of service, MPLS and SDN
The token bucket
![]()