← all topics

7 · Network layer overview and router architecture ★

Slides 4-1 → 4-31 · HW5 P1, P2, P3 · Textbook 4.1–4.2

What the network layer does (4-2, 4-3)

Data plane vs control plane (4-4 → 4-6)

Data planeControl plane
ScopeLocal, per-routerNetwork-wide logic
JobHow a datagram arriving on an input port is forwarded to an output portHow a datagram is routed among routers along the end-to-end path
Speed (4-11)Nanoseconds, in hardwareMilliseconds, in software

Network service model (4-7 → 4-9)

ArchitectureService modelBandwidthLossOrderTiming
Internetbest effortnonenonono
ATMConstant Bit Rateconstant rateyesyesyes
ATMAvailable Bit Rateguaranteed minnoyesno
InternetIntserv (RFC 1633)yesyesyesyes
InternetDiffserv (RFC 2475)possiblepossiblypossiblyno

"Loss: no" in the best-effort row means no guarantee against loss.

Router architecture (4-11)

Input port functions (4-12 → 4-16)

Switching fabrics (4-17 → 4-21)

FabricHowLimitTwo packets at once?
Memory (first generation)Traditional computer, CPU copies the packet into system memory then outMemory bandwidth; 2 bus crossings per datagramNo: one memory read/write at a time
BusInput port memory → output port memory over a shared busBus contention: speed limited by bus bandwidth (Cisco 5600: 32 Gbps bus)No: one packet on the bus at a time
Interconnection network (crossbar, Clos, multistage)Grid of buses; multistage switches built from smaller switches; datagrams cut into fixed-length cells, reassembled at exitParallel; Cisco CRS up to 100s of TbpsYes if they go to different outputs; no if same output

Input port queueing and HOL blocking (4-22)

Output port queueing (4-23 → 4-25)

Buffer management (4-26)

Packet scheduling (4-27 → 4-30)

HW5 P1: forwarding is by destination only

Q (HW5 P1): Consider the network in the figure. Router A has interfaces 1 (to H1), 2 (to H2), 3 (to B), 4 (to C). H3 sits behind D.

  1. (a) Show the forwarding table in router A such that all traffic destined to host H3 is forwarded through interface 3.
  2. (b) Can you write a forwarding table in router A such that all traffic from H1 destined to H3 is forwarded through interface 3, while all traffic from H2 destined to H3 is forwarded through interface 4? (Hint: this is a trick question.)

HW5 P2: two packets at the same time? (official answers)

Q (HW5 P2): Two packets arrive at two different input ports of a router at exactly the same time. There are no other packets anywhere in the router.

  1. (a) The two packets go to two different output ports. Can they be forwarded through the switch fabric at the same time if the fabric is a shared bus?
  2. (b) The two packets go to two different output ports. Can they be forwarded through the switch fabric at the same time if the fabric uses switching via memory?
  3. (c) The two packets go to the same output port. Can they be forwarded through the switch fabric at the same time if the fabric is a crossbar?

How to solve: scheduling departure order (HW5 P3)

  1. Write down what arrives at each time t. Each packet takes one slot to send.
  2. At the start of each slot, list the packets waiting (include the ones that arrive exactly at that instant).
  3. Pick one by the policy. FIFO: earliest arrival (ties: lower number). Priority: highest class first, FIFO inside the class. RR: alternate classes, skip an empty class. WFQ (weights 2:1): class 1 gets two slots, then class 2 gets one; skip an empty class.
  4. A packet that starts at slot t leaves at t+1. Delay (HW definition in a, b) = slot start − arrival. Arrival-to-departure = that + 1.
  5. Sum and divide by 11.

Q (HW5 P3): Packets 1 to 12 arrive at a single output queue at the times in the figure (table below). Each packet takes one slot to transmit, and packet 1 is in service first.

  1. (a) Assuming FIFO service, give the time at which packets 2 through 12 each leave the queue. For each packet, what is the delay between its arrival and the beginning of the slot in which it is transmitted? What is the average of this delay over all 11 packets?
  2. (b) Now assume priority service: odd-numbered packets are high priority, even-numbered packets are low priority. Give the time each of packets 2 through 12 leaves the queue, the delay from arrival to the beginning of its transmit slot, and the average of this delay over all 11 packets.
  3. (c) Now assume round robin. Packets 1, 2, 3, 6, 11, 12 are class 1; packets 4, 5, 7, 8, 9, 10 are class 2. Give the time each of packets 2 through 12 leaves the queue, the delay between its arrival and its departure, and the average delay over all 11 packets.
  4. (d) Now assume WFQ. Odd-numbered packets are class 1 (weight 2), even-numbered packets are class 2 (weight 1). An idealized WFQ schedule may not be possible, so say why you chose the packet that goes into service in each slot. For each packet, what is the delay between its arrival and its departure? What is the average delay over all 11 packets?
  5. (e) What do you notice about the average delay in all four cases (FIFO, RR, priority, WFQ)?

The problem's arrivals (from the figure)

Timet=0t=1t=2t=3t=4t=5t=6t=7t=8
Arrive1, 23, 465, 7–8, 9–1011, 12

Packet 1 is in service during [0, 1] and leaves at t = 1 in every part. Note that 6 arrives before 5.

a) FIFO

Slot startWaitingSendLeavesArrivedDelay
12, 3, 42201
23, 4, 63311
34, 6, 5, 74412
46, 5, 76522
55, 7, 8, 95632
67, 8, 97733
78, 9, 108852
89, 10, 11, 129953
910, 11, 12101072
1011, 12111182
1112121283
order: 1, 2, 3, 4, 6, 5, 7, 8, 9, 10, 11, 12
sum = 1+1+2+2+2+3+2+3+2+2+3 = 23     average = 23/11 ≈ 2.09 slots

b) Priority (odd = high, even = low, non-preemptive)

Slot startWaiting (H | L)SendLeavesArrivedDelay
13 | 2, 43210
2– | 2, 4, 62302
35, 7 | 4, 65430
47 | 4, 67531
59 | 4, 6, 89650
6– | 4, 6, 84715
7– | 6, 8, 106825
811 | 8, 10, 1211980
9– | 8, 10, 1281054
10– | 10, 12101173
11– | 12121283
order: 1, 3, 2, 5, 7, 9, 4, 6, 11, 8, 10, 12
sum = 0+2+0+1+0+5+5+0+4+3+3 = 23     average = 23/11 ≈ 2.09 slots

c) Round robin (class 1 = 1, 2, 3, 6, 11, 12; class 2 = 4, 5, 7, 8, 9, 10)

Packet 1 (class 1) went first, so class 2 has the next turn. An empty class is skipped.

Slot startWaiting (C1 | C2)TurnSendLeavesArrivedDelay to slot start
12, 3 | 4C24210
22, 3, 6 | –C12302
33, 6 | 5, 7C25430
43, 6 | 7C13513
56 | 7, 8, 9C27632
66 | 8, 9C16724
7– | 8, 9, 10C28852
811, 12 | 9, 10C111980
912 | 9, 10C291054
1012 | 10C1121182
11– | 10C2101274
order: 1, 4, 2, 5, 3, 7, 6, 8, 11, 9, 12, 10
sum (to slot start) = 0+2+0+3+2+4+2+0+4+2+4 = 23   average ≈ 2.09
arrival → departure = each +1: sum 34, average 34/11 ≈ 3.09

d) WFQ (odd = class 1, weight 2; even = class 2, weight 1)

Cycle: class 1 gets two slots, then class 2 gets one. If a class has nothing waiting, its turn passes to the other class (the link never sits idle). Packet 1 used class 1's first slot.

Slot startWaiting (C1 | C2)WhySendLeavesDelay to slot start
13 | 2, 4C1's 2nd slot320
2– | 2, 4, 6C2's slot232
35, 7 | 4, 6new cycle, C1 1st540
47 | 4, 6C1 2nd751
59 | 4, 6, 8C2's slot464
69 | 6, 8new cycle, C1 1st971
7– | 6, 8, 10C1 2nd, but C1 empty → C2685
811 | 8, 10, 12new cycle, C1 1st1190
9– | 8, 10, 12C1 empty → C28104
10– | 10, 12only C2 left10113
11– | 12only C2 left12123
order: 1, 3, 2, 5, 7, 4, 9, 6, 11, 8, 10, 12
sum (to slot start) = 0+2+0+1+4+1+5+0+4+3+3 = 23   average ≈ 2.09
arrival → departure: sum 34, average ≈ 3.09

e) Official answer

The average delay is the same for all four policies (23/11 ≈ 2.09 slots to slot start). Every packet takes one slot and the link is never idle while packets wait, so the set of departure times (2, 3, …, 12) is fixed. The policy only changes which packet gets which time, which moves delay between packets but not the total.

Traps
• Forwarding vs routing: forwarding is local (one router, input → output). Routing is network-wide (the whole path). Don't swap them.
• Data plane = nanoseconds, hardware. Control plane = milliseconds, software.
• Best effort guarantees nothing: not delivery, not order, not timing, not bandwidth.
• HW5 P2: memory and bus are No even for different outputs. Crossbar is No only because both want the same output.
• HOL blocking is an input queue problem. Output queueing is caused by arrivals from the fabric faster than the link rate.
• Buffer rule: RTT·C/√N, square root of N, not N.
• Priority is non-preemptive: a low-priority packet already on the wire finishes.
• In P3, packet 6 arrives at t=2, before 5 (t=3). FIFO sends 6 before 5.
• Read which delay the question wants: "to the beginning of the slot" (a, b) vs "arrival to departure" (c, d). They differ by 1 per packet.

Quick check

1. Forwarding vs routing in one line each. Forwarding: move a packet from a router's input link to the right output link (local, data plane). Routing: compute the source-to-destination path (network-wide, control plane).
2. Per-router control plane vs SDN control plane? Per-router: a routing algorithm runs in every router and the routers talk to each other. SDN: a remote controller computes forwarding tables and installs them in the routers.
3. Name four things the Internet's best-effort service does NOT guarantee. Delivery (no loss guarantee), order, timing (delay), bandwidth.
4. Which switching fabric can forward two packets to two different outputs at the same time? Only the interconnection network (crossbar). Memory and bus move one packet at a time.
5. Why is switching via memory slow? The CPU copies each packet into memory and back out: 2 bus crossings per datagram, limited by memory bandwidth.
6. What is head-of-line blocking? The packet at the front of an input queue waits for a busy output, so packets behind it wait too, even if their outputs are free.
7. RTT = 200 ms, C = 40 Gbps. Buffer by the RFC 3439 rule? With N = 400 flows?
RTT·C = 0.2 s × 40×10⁹ b/s = 8×10⁹ bits = 8 Gbit
with N = 400:  8 Gbit / √400 = 8 / 20 = 0.4 Gbit = 400 Mbit
8. WFQ with weights 3, 2, 5 on a 100 Mbps link. Minimum rate for each class?
Σw = 3 + 2 + 5 = 10
class 1: 3/10 × 100 = 30 Mbps
class 2: 2/10 × 100 = 20 Mbps
class 3: 5/10 × 100 = 50 Mbps
9. Six one-slot packets. Arrivals: t=0: 1, 2; t=1: 3; t=2: 4, 5; t=3: 6. Odd = high priority. Departure order and average delay (to slot start) under FIFO and priority?
FIFO:     order 1,2,3,4,5,6  starts 0,1,2,3,4,5
          delays 0,1,1,1,2,2 = 7     average 7/6 ≈ 1.17
Priority: t=0 send 1 (waiting 1,2)
          t=1 waiting 2(L),3(H) → 3
          t=2 waiting 2,4(L),5(H) → 5
          t=3 waiting 2,4,6 (all L) → 2
          t=4 → 4,  t=5 → 6
          order 1,3,5,2,4,6
          delays 1:0, 3:0, 5:0, 2:3, 4:2, 6:2 = 7   average ≈ 1.17
Same average, as in HW5 P3e.
10. Same six packets, round robin with class A = {1, 2, 3} and class B = {4, 5, 6}, A goes first. Order?
t=0 A: 1     (B empty)       t=1 B empty → A: 2
t=2 B: 4     (turn to B)     t=3 A: 3
t=4 B: 5                     t=5 B: 6 (A empty)
order 1, 2, 4, 3, 5, 6
delays 1:0, 2:1, 4:0, 3:2, 5:2, 6:2 = 7   average ≈ 1.17
Packet 3 arrived at t=1 and started at t=3, so its delay is 2. Total 7, the same as FIFO.
11. HW5 P1b: can router A send H1→H3 traffic on interface 3 and H2→H3 traffic on interface 4? No. Destination-based forwarding looks only at the destination address. Both flows go to H3, so they match the same entry.
12. What do tail drop, ECN and RED have in common? All are buffer management. Tail drop drops the arriving packet when full. ECN and RED mark (or drop early) to signal congestion before the buffer is full.
13. What does a TCAM give you? Longest prefix match lookup in one clock cycle regardless of table size.

← prev · all topics · next →