1 of 58

CMPT 471/771: Computer Networks��Introduction

Instructor: Mohamed Hefeeda

1

School of Computing Science �Simon Fraser University

2 of 58

Outline

  • Motivation: why networks matter
    • Rogers, the FAA outage, and the scale of AI
  • Course information
  • Basic concepts
    • Internet structure, layers, services
  • Performance analysis
    • Delay, loss, throughput: the basic equations
    • Scale: node, rack, cluster, region, globe
    • Impact of scale and failures

2

3 of 58

​

​

Why study computer networks?

​

They are critical for every aspect of our life.

​

Here are some examples …

3

4 of 58

Networks Run Everyday Life

4

5 of 58

Example 1: Rogers Massive Outage: July 2022

5

~12M Canadians affected!

Disrupted almost everything …

From healthcare to entertainment

Even 9-1-1 and government services

​

The Rogers Outage disrupted services across Canada

6 of 58

Rogers Outage: What Happened?

6

Update to some routers

🡺 removed route distribution filters

🡺 too many routes inserted into core routers, overwhelming them

🡺 routers stopped advertising network prefixes 🡺

🡺 Rogers customers (networks) became unreachable from the Internet! 

​

7 of 58

Example 2: Disruption in the US Air Travel: Nov 2026

  • Likely cause: one new router
    • Sent 1,000 connections every 4–5 s
    • 🡺 Old equipment became unstable
    • 🡺 17 of 22 centers overwhelmed 🡺 lost radar and radio links

​

  • 🡺 Air travel halted for ~4 h
    • 9,159 flights canceled that day

7

New router (Arkansas)

FAA telecom network

En route centers

17 unstable, 5 fine

8 of 58

​

​

Computer networks are critical for the AI revolution

​

Here is how …

8

9 of 58

Networks and AI

  • Training AI Models:
    • Requires tens of thousands of GPUs, running for many weeks
    • GPUs exchange gradients over the network with strict latency and bandwidth requirements
    • 🡺 Network is on the critical path of every training step

​

  • Inference (processing prompts):
    • Billions of queries per day 🡺 need to be forwarded over the network to thousands of GPUs
    • 🡺 Load balancing and request scheduling are critical for user experience

​

9

10 of 58

Course Objectives

  • Understand how networks are designed
    • From the Internet to datacenters and AI clusters
    • 🡺 develop deeper understanding of complex systems
  • Build and program networks
    • SDN controllers, P4 switches, ...
    • 🡺 improve your systems skills
  • Analyze and measure performance
    • Analytical models and measurement labs: TCP, BGP, SDN, …
    • 🡺 improve your analysis and measurement skills
  • Reason about security and AI in networks
    • Analyze vulnerabilities and mitigations, know how AI can help networks
    • 🡺 appreciate the potential threats and know available tools

10

11 of 58

Course Topics

11

1 Introduction

Week 1

2 Network Layer

Weeks 1–2

3 SDN + Virtualization

Weeks 2–3

4 Router Design and QoS

Week 4

5 Programmable Data Planes (P4)

Weeks 5–6

6 TCP and Congestion Control

Weeks 7–8

7 Datacenter Design

Week 9

8 AI Datacenters

Weeks 10–11

9 Protocol Support for AI

Weeks 11–12

Security thread: attacks, vulnerabilities, defenses

AI-for-networks thread: detection, configuration, control

12 of 58

Module 2: Network Layer (Routing and BGP)

  • Forwarding vs routing
  • Routing inside a network
  • BGP: routing between networks
  • Security: prefix hijacks, RPKI
  • AI: an LLM diagnoses failures
  • Hands-on: AnalyzeBGP lab

12

AS 1

AS 2

BGP

13 of 58

Module 3: SDN and Network Virtualization

  • SDN: control apart from switches
  • Traffic engineering: B4, SD-WAN
  • Virtual networks: VLANs, tunnels
  • Security: controller attacks
  • AI: learning for traffic engineering
  • Hands-on: ExploreSDN, Project 1

13

Apps: routing, firewall

SDN controller

Switch

Switch

Switch

VM

VM

VM

Pod

Virtual switch on one server

14 of 58

Module 4: Router Design and QoS Support

  • Inside a router: ports, fabric
  • Lookup: longest prefix match
  • Buffers and drops: RED
  • Scheduling: priority, fair queuing
  • QoS: IntServ, DiffServ

14

Router

In

Out

In

Out

In

Out

Switch fabric

15 of 58

Module 5: Programmable Data Planes (P4)

  • Program the switch at line rate
  • P4: parse, match, act
  • State: registers, counters, meters
  • In-band network telemetry
  • In-network aggregation for ML
  • SmartNICs, DPUs, RDMA
  • Hands-on: Project 2

15

Parser

Match

Action

Match

Action

Match

Action

Deparser

Packets in → out at line rate

Program: P4 code

Tables filled at run time (P4Runtime)

16 of 58

Module 6: TCP and Congestion Control

  • TCP recap; AIMD, slow start, Reno
  • TCP performance models
  • CUBIC, BBR, QUIC
  • ECN, bufferbloat, queue management
  • AI: learned congestion control
  • Hands-on: AnalyzeTCP lab

16

Capacity of the bottleneck

time

17 of 58

Module 7: Datacenter Design

  • Racks, servers, storage
  • Power and cooling; efficiency (PUE)
  • Fabrics: Clos, fat-tree
  • Load balancing: ECMP, flowlets
  • Optical switching
  • AI: cooling, failure prediction

17

18 of 58

Module 8: AI Datacenters

  • AI training and parallelism
  • GPU servers: HBM, NVLink
  • Power density and liquid cooling
  • Rail-optimized fabrics; MoE
  • Llama 3 and Google TPU clusters

18

19 of 58

Module 9: Protocol Support for AI

  • Transport: DCTCP, Swift, Homa
  • RDMA and lossless Ethernet
  • DCQCN, HPCC, Ultra Ethernet
  • Collectives: AllReduce, α–β model
  • Inference: moving the KV cache

19

Ring AllReduce on 4 GPUs

GPU 0

GPU 1

GPU 2

GPU 3

each step: send one

chunk to the neighbor

over RDMA: InfiniBand or Ethernet (RoCE)

20 of 58

Internet: Security and Vulnerability

  • Attacks never stop
    • 6.2% of all traffic blocked (2025)
  • DDoS: 47.1 million attacks in 2025
    • Record 31.4 Tb/s [Cloudflare 2026]
  • Web floods: 398M requests/s
    • HTTP/2 Rapid Reset [Google 2023]
  • BGP hijack: YouTube down ~2 h
    • Pakistan Telecom [RIPE 2008]
  • Watch live: radar.cloudflare.com

20

Cloudflare Radar: attacks by source and target

21 of 58

Thread 1: Security

21

Module

Attack or weakness

Defense

2 Network layer

Prefix and sub-prefix hijacks

Signed routes (RPKI)

3 SDN, virtualization

Attacks on the controller

SDN as a defense: DDoS, noisy neighbors

9 AI fabrics (optional)

Tenants sharing one fabric

Partitions; encryption in the NIC

22 of 58

Thread 2: AI for Networks

22

Module

Where AI helps run the network

2 Network layer

An LLM assistant diagnoses network failures

3 SDN

Reinforcement learning for traffic engineering

6 TCP and congestion control

Learned congestion control

7 Datacenter design

Cooling control; predicting failures

23 of 58

Course Information: Reference Books

​

23

24 of 58

Course Info: Grading

  • Projects and Assignments: 50%
    • Multiple Programming Projects
      • Require good programming skills (C++, Python)
    • Several Assignments
      • Labs and practice questions
    • Must read the Assignment Policy (on the course web page)

​

  • Exams: 50%
    • Midterm 1 (20%) and Final (30%)
    • Must score 50+% (aggregate) on exams to pass (>F) the course

​

24

25 of 58

The Elephant in the Classroom!

AI Coding Assistants

25

26 of 58

AI Coding Assistants in 2026

  • 9 in 10 developers use AI agents weekly [JetBrains 2026]
  • 75% of new code at Google is AI-generated [Google 2026]
  • 40%+ of GitHub pull requests start from an agent [GitHub 2026]
  • Yet 46% of developers distrust its accuracy [SO 2025]
    • Measured speedups are still unproven [METR 2026]
  • 🡺 Coding with AI coding assistant is an important skill
  • However, current developers were trained BEFORE AI
    • i.e., they know the details and what is happening
  • 🡺 You need to understand the fundamentals to effectively use AI
    • Otherwise, you will easily be replaced or not hired

26

27 of 58

AI Coding Assistants in the Course

  • Projects are structured in multiple tasks
  • Early tasks are easy and help you understand
    • We recommend you do not use AI tools in them
  • Later tasks are more complex
    • 🡺 you can use AI to do them faster (and practice using AI tools)

​

  • In ALL CASES, you must understand each line of your code

​

  • Oral check-ins: cannot explain your code → zero mark

27

28 of 58

AI Coding: Summary

  • AI is an assistant, not an engineer
    • You still own design, debugging, and security review

​

  • Strong fundamentals make you a better user of AI tools
    • You write more specific, technically grounded prompts
    • You catch hallucinated APIs, wrong protocols, insecure patterns
    • You know when to push back on the model's suggestion
    • You evaluate whether the output is architecturally sound

28

29 of 58

​

​

​

Basic Networking Concepts

​

29

30 of 58

Many Kinds of Networks

30

Home and Wi-Fi

cable, fiber, Wi-Fi

Mobile

cellular 4G and 5G

Campus and enterprise

SFU, offices, hospitals

ISP

ISP backbones

long-haul fiber, IXPs

Content networks

CDNs, nearby caches

Undersea cables

fiber between continents

Satellites

Starlink: 13.6M users

Datacenters, AI clusters

servers and GPUs

Internet

31 of 58

The Internet: Network of Networks

  • Internet: “network of networks”
    • Currently 80,000+ independent networks
    • Interconnected ISPs (Internet Service Providers)
  • Protocols: control sending and receiving messages
    • e.g., TCP, IP, HTTP, BGP, 802.11
  • Internet standards
    • Protocols are specified in RFCs �(Request for Comments)
    • RFCs are developed by the IETF �(Internet Engineering Task Force)

31

mobile network

global ISP

regional ISP

home

network

institutional

network

32 of 58

Internet Structure

  • Roughly hierarchical
  • At center: “tier-1” ISPs
    • e.g., Lumen, Arelion, Cogent, NTT
    • National/international coverage
    • Treat each other as equals

32

Tier 1 ISP

Tier 1 ISP

Tier 1 ISP

Tier-1 providers interconnect (peer) privately

IXP

Tier-1 providers also interconnect at public Internet Exchange Points (IXPs)

Vancouver IXP

33 of 58

Tier-1 ISP Network: e.g., Sprint (US)

33

…

to/from customers

peering

to/from backbone

…

…

…

…

POP: point-of-presence

34 of 58

Internet Structure

34

access

ISP

access

ISP

access

ISP

access

ISP

access

ISP

access

ISP

access

ISP

access

ISP

Regional ISP

Regional ISP

IXP

IXP

Tier 1 ISP

Tier 1 ISP

Google

IXP

  • Tier-1 ISPs 🡺 Regional ISPs (Tier 2) 🡺 Access ISPs (Tier 3) 🡺 Customers
  • Major IT companies (e.g., Google, Facebook):
    • Often connect their data centers directly to IXPs

35 of 58

Internet: Under Sea Cables

  • Hundreds of fiber optic cables interconnect ISPs across the world
  • Explore some of them at submarinecablemap.com

​

35

36 of 58

Google Network

  • Large content providers run private global networks between their data centers and edge sites
  • Explore Google Network

36

37 of 58

Packet Journey

  • A packet passes through many networks (different protocols, devices, technologies, ownerships, …)!

37

access

ISP

access

ISP

access

ISP

access

ISP

access

ISP

access

ISP

access

ISP

access

ISP

Regional ISP

Regional ISP

IXP

IXP

Tier 1 ISP

Tier 1 ISP

Google

IXP

38 of 58

Internet Protocol Stack

  • Application: supports network applications
    • HTTP, DNS, SMTP
  • Transport: transfers data between processes
    • TCP, UDP
  • Network: routes packets from source to destination
    • IP, routing protocols
  • Link: transfers data between neighboring nodes
    • Ethernet, Wi-Fi
  • Physical: handles signals on the wire

​

  • 🡺 Assist us to understand/design complex systems

38

application

​

transport

​

network

​

link

​

physical

39 of 58

Encapsulation

39

datagram

frame

Ht

Hn

Hl

M

Ht

Hn

M

segment

Ht

M

message

M

Ht

Hn

Hl

M

Ht

Hn

M

Ht

M

M

application

transport

network

link

physical

application

transport

network

link

physical

link

physical

network

link

physical

Ht

Hn

Hl

M

Ht

Hn

M

Ht

Hn

Hl

M

Ht

Hn

M

Ht

Hn

Hl

M

Ht

Hn

Hl

M

source

destination

router

switch

40 of 58

Internet Services

  • Services are offered by Transport Layer to apps

​

  • Two services
    • Connection-oriented, reliable
    • Connectionless, unreliable

​

40

application

transport

network

data link

physical

application

transport

network

data link

physical

​

network

data link

physical

​

network

data link

physical

​

network

data link

physical

​

network

data link

physical

​

network

data link

physical

logical end-end transport

  • View the Internet as infrastructure providing communication services to apps
    • Web, email, games, …

​

41 of 58

Internet Services: Connection-Oriented

  • Connection-oriented
    • Prepare for data transfer ahead of time

​

    • Establish connection 🡺 set up state in the two communicating hosts

​

    • Usually comes with reliability, flow and congestion control

​

    • TCP: Transmission Control Protocol

41

42 of 58

TCP: Transmission Control Protocol [RFC 9293]

  • TCP: reliable transfer of bytes from one process to another
    • Virtual pipe between sender and receiver

​

42

transport

application

physical

link

network

process

transport

application

physical

link

network

process

TCP “pipe”

Internet

Client

Server

43 of 58

Internet Services: Connectionless

  • Connectionless
    • No connection set up, simply send
    • Does not offer reliability, flow control, and congestion control!
    • UDP: User Datagram Protocol [RFC 768]

​

​

43

?

Why would we need UDP, given that it offers so little?

  • Because it is simple, fast, and low overhead (small header)
  • No connection setup 🡺 short delay and no state to maintain at sender & receiver (simple)
  • No congestion control 🡺 UDP can send as fast as desired

​

44 of 58

Performance Analysis: Basics

  • We will present simple analysis for latency, queuing, packet losses, and throughput
    • One hop first
    • Then end-to-end

​

  • Will also contrast these performance metrics across different scales
    • Server, rack, cluster, …, internet

44

45 of 58

Packet Delay: Four Sources

45

dproc: nodal processing

  • check bit errors
  • determine output link
  • typically < microsecs

dqueue: queueing delay

  • time waiting at output link for transmission
  • depends on congestion level of router

propagation

nodal

processing

queueing

dnodal = dproc + dqueue + dtrans + dprop

A

B

transmission

46 of 58

Packet Delay: Transmission and Propagation

46

propagation

nodal

processing

queueing

dnodal = dproc + dqueue + dtrans + dprop

A

B

transmission

dtrans: transmission delay:

  • L: packet length (bits)
  • R: link transmission rate (bps)
  • dtrans = L/R

dprop: propagation delay:

  • d: length of physical link
  • s: propagation speed (~2x108 m/sec)
  • dprop = d/s

47 of 58

Transmission vs. Propagation: One Packet

  • Last bit arrives at:

t = L/R + d/s

  • 1,500 B, 1 Gb/s, 1,000 km:
    • 12 µs + 5 ms = 5.012 ms
  • Fast links 🡺 distance dominates

​

  • Transmission = propagation when d = s × L/R
    • 2.4 km at 1 Gb/s,
    • 6 m at 400 Gb/s
    • 🡺 Distance matters, especially in datacenters

​

47

Sender

Receiver

time

first bit

last bit

L/R

L/R

+ d/s

d/s

48 of 58

Latency or Bandwidth? Transfer Time

T = RTT + S / R

    • S: size; R: rate; RTT: round trip
  • Small transfers: latency-bound
  • Large ones: bandwidth-bound
    • The knee: S = R × RTT (the BDP)
  • Web: 10 KB at 1 Gb/s: 50.1 ms
    • 10× faster link: almost no gain
  • AI: 4 KB 10.1 µs; 1 GB 20 ms

48

Internet: 1 Gb/s, 50 ms

AI: 400 Gb/s, 10 µs

1 KB

1 MB

1 GB

10 µs

1 ms

100 ms

10 s

transfer size S (log)

time T (log)

49 of 58

Packet Switching: Queueing and Losses

49

A

B

C

R = 100 Mb/s

R = 1.5 Mb/s

D

E

queue of packets

waiting for transmission over output link

Queuing: occurs when arrival rate exceeds transmission rate

Packet Loss: occurs when queue (memory) is full

50 of 58

Queueing Delay: Traffic Intensity

ρ = L·a / R

    • a: packets/s; L: bits/packet; R: bits/s
    • Arriving bits/s ÷ link rate
  • ρ < 1: short queues after bursts
  • ρ → 1: the queue rarely drains
  • ρ > 1: the queue grows until loss
  • Example: R = 1.5 Mb/s, L = 1,500 B
    • a = 100 pkt/s: ρ = 0.8
    • a = 120 pkt/s: ρ = 0.96

50

ρ = 0.5: short queue

R

ρ = 0.9: long queue

R

ρ > 1: full, packets dropped

R

X

51 of 58

Queueing Delay Explodes with Load

dqueue + dtrans = (L/R) / (1 − ρ)

    • M/M/1 queue: random arrivals
  • Same link: L/R = 8 ms
    • ρ = 0.8: 5 × 8 = 40 ms
  • Think: 20% more traffic (ρ = 0.96)?
    • 25 × 8 = 200 ms: 5× longer
  • Use: spare capacity, or priority
  • Each hop adds its own dqueue (next)

51

ρ > 1

loss

delay (× L/R)

1

0

0.5

0.8

1

load ρ

2×

5×: 40 ms

25×: 200 ms

52 of 58

End-to-End Delay: Multiple Hops

de2e = Σhops (dproc + dqueue + dtrans + dprop)

​

  • Store-and-forward: N links add N × L/R

​

  • Each hop’s queue depends on its load ρ (jitter)

52

Host A

Router 1

Router 2

Host B

link 1

link 2

link 3

t = 0

t = 1 × L/R

t = 2 × L/R

t = 3 × L/R

(plus propagation, processing, and queueing at each hop)

53 of 58

End-to-End Throughput: The Bottleneck

throughput = min(Rs, Rc, R/n)

  • n flows share link R: each gets about R/n
  • n = 50: R/n = 200 Mb/s, so Rc = 100 Mb/s limits
  • n = 200: R/n = 50 Mb/s, so the shared link limits
  • Flows come and go: the bottleneck moves (Module 6)

53

Server

Rs = 1 Gb/s

R1

shared R = 10 Gb/s

R2

Rc = 100 Mb/s

Client

other flows

54 of 58

Example: End-to-End Delay and Bottleneck

  • One packet (1,500 B): delay
    • dtrans = 12 + 1.2 + 120 µs ≈ 0.13 ms (3 links)
    • dprop = 1,000 km ÷ 2×108 m/s = 5 ms
    • de2e ≈ 5.1 ms: distance dominates
  • 10 MB file: throughput
    • min(1 Gb/s, 100 Mb/s, 10 Gb/s ÷ 200) = 50 Mb/s
    • 80 Mb ÷ 50 Mb/s = 1.6 s: the bottleneck dominates

54

Server

Rs = 1 Gb/s

R1

shared by 200 flows: 10 Gb/s

R2

Rc = 100 Mb/s

Client

path: 1,000 km; empty queues

55 of 58

Let us Measure Latency

  • ping –c 3 www.cs.ubc.ca
    • 🡺 7—9 ms
    • Packets travel ~30 KM and back

​

  • ping –c 3 www.cl.cam.ac.uk
    • 🡺 130—150 ms
    • Packet travels ~8000 KM and back

​

  • traceroute www.cl.cam.ac.uk
    • Shows you the details (but some routers on the path do not respond)

​

55

56 of 58

Which Delay Dominates at Each Scale?

  • Queuing: 0 to milliseconds at any scale, and it varies
  • Short wires: processing dominates; long ones: propagation

56

Scale

Distance

Propagation

Transmission (1,500 B)

Main delay

In a node (GPU to GPU)

1 m

5 ns

1.7 ns (NVLink)

processing: NICs, software

In a rack

2 m

10 ns

30 ns (400 Gb/s)

processing

In a cluster

200 m

1 µs

30 ns per hop

processing, queueing

In a region

50 km

250 µs

30 ns

propagation

Across the globe (to the UK)

7,526 km

37.6 ms

12 µs (1 Gb/s)

propagation

57 of 58

Summary

  • Internet structure: network of networks
    • Roughly hierarchical: low tier ISPs connect to higher tier ones
    • Major companies (e.g., Google) directly connect to IXPs
  • Protocol layer and packet encapsulation
    • Packet is ‘encapsulated’ into multiple headers
    • Headers may change as packet traverses the network
  • Internet services
    • Connection-oriented (TCP) and Connectionless (UDP)
  • Performance analysis
    • Four components of latency
    • End-to-end latency, throughput, and bottleneck links

​

​

57

58 of 58

Readings

58