CS计算机代考程序代写 ER assembly cache DHCP algorithm dns 12

12
2/9/21
UCLA CS 118 Winter 2021
Instructor: Giovanni Pau TAs:
Hunter Dellaverson Eric Newberry
This chapter slide deck draws from different sources 7th and 8th edition of the textbook
Transport Layer: 3-1
Chapter 4
Network Layer:
Data Plane
A note on the use of these PowerPoint slides:
We’re making these slides freely available to all (faculty, students, readers). They’re in PowerPoint form so you see the animations; and can add, modify, and delete slides (including this one) and slide content to suit your needs. They obviously represent a lot of work on our part. In return for use, we only ask the following:
§ If you use these slides (e.g., in a class) that you mention their source (after all, we’d like people to use our book!)
§ If you post any slides on a www site, that you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material.
For a revision history, see the slide note for this page. Thanks and enjoy! JFK/KWR
All material copyright 1996-2020
J.F Kurose and K.W. Ross, All Rights Reserved
Computer Networking: A
Top-Down Approach
8th edition
Jim Kurose, Keith Ross Pearson, 2020
Network layer: our goals
§understand principles behind network layer services, focusing on data plane:
• network layer service models • forwarding versus routing
• how a router works
• addressing
• generalized forwarding • Internet architecture
§instantiation, implementation in the Internet
• IP protocol
• NAT, middleboxes
Network Layer: 4-3
Network layer: “data plane” roadmap
§Network layer: overview • data plane
• control plane
§What’s inside a router
• input ports, switching, output ports • buffer management, scheduling
§IP: the Internet Protocol • datagram format
• addressing
• network address translation • IPv6
§Generalized Forwarding, SDN
• Match+action
• OpenFlow: match+action in action
§ Middleboxes
Network Layer: 4-4
34
1

Network-layer services and protocols
Two key network-layer functions
§ transport segment from sending to receiving host
• sender: encapsulates segments into datagrams, passes to link layer
• receiver: delivers segments to transport layer protocol
§ network layer protocols in every Internet device: hosts, routers
§ routers:
• examinesheaderfieldsinallIP
datagrams passing through it
• movesdatagramsfrominputportsto output ports to transfer datagrams along end-end path
mobile network
network-layer functions:
§forwarding: move packets from a router’s input link to appropriate router output link
§routing: determine route taken by packets from source to destination
• routing algorithms
analogy: taking a trip
§forwarding: process of getting through single interchange
§routing: process of planning trip from source to destination
values in arriving packet header
0111
implemented in routers
r
1
p
a
c
ke
t’s
g
application transport network link physical
network
link physical
56
Network layer: data plane, control plane
Per-router control plane
Individual routing algorithm components in each and every router interact in the control plane
Data plane:
§local, per-router function §determines how datagram
arriving on router input port is forwarded to router output port
Control plane
§network-wide logic §determines how datagram is
routed among routers along end- end path from source host to destination host
§two control-plane approaches: • traditional routing algorithms:
4.1

OVERVIEW OF NETWORK LAYER 309
network
link physical
enterprise network
network
link physical
network
phlyinsikcal
network
link physical
national or global ISP
32 2 • software-defined networking (SDN): packet header 1
78
implemented in (remote) servers
Network Layer: 4-7
3
2
datacenter network
application transport network link physical
Network Layer: 4-5
forwarding
routing
Control plane Data plane
values in arValues in arriving
output 0100 3 0110 2 0111 2 1001 1
i
v
in
header
1101
0111
3
1
Routing Algorithm Routing algorithm
Local forwarding table
control plane
data plane
header
Figure 4.2 ♦ Routing algorithms determine values in forward tables
tables. In this example, a routing algorithm runs in each and every router and both forwarding and routing functions are contained within a router. As we’ll see in Sec- tions 5.3 and 5.4, the routing algorithm function in one router communicates with the routing algorithm function in other routers to compute the values for its forward- ing table. How is this communication performed? By exchanging routing messages containing routing information according to a routing protocol! We’ll cover routing algorithms and protocols in Sections 5.2 through 5.4.
The distinct and different purposes of the forwarding and routing functions can be further illustrated by considering the hypothetical (and unrealistic, but technically feasible) case of a network in which all forwarding tables are configured directly by human network operators physically present at the routers. In this case, no routing protocols would be required! Of course, the human operators would need to interact with each other to ensure that the forwarding tables were configured in such a way that packets reached their intended destinations. It’s also likely that human configu- ration would be more error-prone and much slower to respond to changes in the net- work topology than a routing protocol. We’re thus fortunate that all networks have both a forwarding and a routing function!
Network Layer: 4-8
M04_KURO4140_07_SE_C04.indd 309
11/02/16
3:14 PM
Network Layer: 4-6
2/9/21
2

9 10
2/9/21
Software-Defined Networking (SDN) control plane
Remote controller computes, installs forwarding tables in routers
Remote Controller
control plane
data plane
CA
values in arriving packet header
CA CA
CA
CA
01 3
2
111
Network Layer: 4-9
Network service model
Q: What service model for “channel” transporting datagrams from sender to receiver?
example services for individual datagrams:
§guaranteed delivery
§guaranteed delivery with less than 40 msec delay
example services for a flow of datagrams:
§in-order datagram delivery §guaranteed minimum bandwidth
to flow
§restrictions on changes in inter- packet spacing
Network Layer: 4-10
Network-layer service model
Network Architecture
Internet ATM ATM Internet
Internet
Service Model
best effort Constant Bit Rate
Quality of Service (QoS) Guarantees ?
Bandwidth Loss Order Timing
none no Constant rate yes
no no yes yes yes no
Internet “best effort” service model
Available Bit Rate Guaranteed min no
No guarantees on:
Init.sersvuGcucaerasnstfeuelddatagyerasm delivery tyoesdestinyaetsion yes
(RFC 1633)
ii. timing or order of delivery
iii. bandwidth available to end-end flow
Diffserv (RFC 2475) possible possibly possibly no
Network Layer: 4-11
Network-layer service model
Network Architecture
Internet ATM ATM Internet
Internet
Service Model
best effort
Constant Bit Rate
Available Bit Rate
Intserv Guaranteed (RFC 1633)
Diffserv (RFC 2475)
Quality of Service (QoS) Guarantees ?
Bandwidth none
Constant rate Guaranteed min yes
possible
Loss Order Timing no no no yes yes yes no yes no yes yes yes
possibly possibly no
Network Layer: 4-12
11 12
3

13 14
2/9/21
Reflections on best-effort service:
§simplicity of mechanism has allowed Internet to be widely deployed adopted
§sufficient provisioning of bandwidth allows performance of real-time applications (e.g., interactive voice, video) to be “good enough” for “most of the time”
§replicated, application-layer distributed services (datacenters, content distribution networks) connecting close to clients’ networks, allow services to be provided from multiple locations
§congestion control of “elastic” services helps
It’s hard to argue with success of best-effort service model
Network Layer: 4-13
Network layer: “data plane” roadmap
§Network layer: overview • data plane
• control plane
§What’s inside a router
• input ports, switching, output ports • buffer management, scheduling
§IP: the Internet Protocol
• datagram format
• addressing
• network address translation • IPv6
§Generalized Forwarding, SDN
• Match+action
• OpenFlow: match+action in action
§Middleboxes
Network Layer: 4-14
Router architecture overview
high-level view of generic router architecture:
routing, management control plane (software) operates in millisecond time frame
routing processor
forwarding data plane
(hardware) operates in nanosecond timeframe
high-speed switching fabric
router input ports
router output ports
Network Layer: 4-15
Input port functions
line termination
link layer protocol (receive)
lookup, forwarding
queueing
physical layer:
bit-level reception
link layer:
e.g., Ethernet (chapter 6)
switch fabric
decentralized switching:
§ using header field values, lookup output port using
forwarding table in input port memory (“match plus action”) § goal: complete input port processing at ‘line speed’
§ input port queuing: if datagrams arrive faster than forwarding
rate into switch fabric
Network Layer: 4-16
15 16
4

17 18
2/9/21
Input port functions
link layer protocol (receive)
lookup, forwarding
line termination
queueing
physical layer:
bit-level reception
link layer:
e.g., Ethernet (chapter 6)
switch fabric
decentralized switching:
§ using header field values, lookup output port using
forwarding table in input port memory (“match plus action”) § destination-based forwarding: forward based only on
destination IP address (traditional)
§ generalized forwarding: forward based on any set of header
field values
Network Layer: 4-17
Destination-based forwarding
3
Q: but what happens if ranges don’t divide up so nicely?
Network Layer: 4-18
Longest prefix matching
longest prefix match
when looking for forwarding table entry for given destination address, use longest address prefix that matches destination address.
11001000 00010111 00010110 10100001 which interface? 11001000 00010111 00011000 10101010 which interface?
Destination Address Range
Link interface
11001000 00010111 00010*** ********
0
11001000 00010111 00011000 ********
1
11001000 00010111 00011*** ********
2
otherwise
3
examples:
Network Layer: 4-19
Longest prefix matching
longest prefix match
when looking for forwarding table entry for given destination address, use longest address prefix that matches destination address.
11001000 00010111 00010110 10100001 which interface? 11001000 00010111 00011000 10101010 which interface?
Destination Address Range
Link interface
11001000 00010111 00010*** ********
0
11001000 00010111 00011000 ********
1
11001000 m00a0t1c0h1!11 00011*** ********
2
otherwise
3
examples:
Network Layer: 4-20
19 20
5

21 22
2/9/21
Longest prefix matching
longest prefix match
when looking for forwarding table entry for given destination address, use longest address prefix that matches destination address.
Destination Address Range
Link interface
11001000 00010111 00010*** ********
0
11001000 00010111 00011000 ********
1
11001000 00010111 00011*** ********
2
otherwise
3
examples:
match!
11001000 00010111 00010110 11001000 00010111 00011000
10100001 10101010
which interface? which interface?
Network Layer: 4-21
Longest prefix matching
longest prefix match
when looking for forwarding table entry for given destination address, use longest address prefix that matches destination address.
11001000 00010111 00010110 10100001 which interface? 10101010 which interface?
Destination Address Range
Link interface
11001000 00010111 00010*** ********
0
11001000 00010111 00011000
********
1
11001000 00010111 00011*** ********
2
otherwise
match!
3
examples:
Network Layer: 4-22
11001000 00010111 00011000
Longest prefix matching
§ we’ll see why longest prefix matching is used shortly, when we study addressing
§ longest prefix matching: often performed using ternary content addressable memories (TCAMs)
• content addressable: present address to TCAM: retrieve address in one clock cycle, regardless of table size
• Cisco Catalyst: ~1M routing table entries in TCAM
Network Layer: 4-23
Switching fabrics
§ transfer packet from input link to appropriate output link
§ switching rate: rate at which packets can be transfer from inputs to outputs
• often measured as multiple of input/output line rate • N inputs: switching rate N times line rate desirable
RR
N input ports N output ports RR
(rate: NR, ideally)
high-speed switching fabric
Network Layer: 4-24
23 24
6

25 26
2/9/21
Switching fabrics
§ transfer packet from input link to appropriate output link
§ switching rate: rate at which packets can be transfer from inputs to outputs
• often measured as multiple of input/output line rate • N inputs: switching rate N times line rate desirable
§three major types of switching fabrics:
memory bus interconnection network
memory
Network Layer: 4-25
Switching via memory
first generation routers:
§ traditional computers with switching under direct control of CPU
§ packet copied to system’s memory
§ speed limited by memory bandwidth (2 bus crossings per datagram)
input port (e.g., Ethernet)
memory
output port (e.g., Ethernet)
system bus
Network Layer: 4-26
Switching via a bus
§datagram from input port memory to output port memory via a shared bus
§bus contention: switching speed limited by bus bandwidth §32 Gbps bus, Cisco 5600: sufficient speed for access routers
Network Layer: 4-27
Switching via interconnection network
§Crossbar, Clos networks, other interconnection nets initially developed to connect processors in multiprocessor
§multistage switch: nxn switch from multiple stages of smaller switches
§exploiting parallelism:
• fragmentdatagramintofixedlengthcellson
entry
• switchcellsthroughthefabric,reassemble datagram at exit
3×3 crossbar
8×8 multistage switch
built from smaller-sized switches
Network Layer: 4-28
27 28
7

2/9/21
Switching via interconnection network
§ scaling, using multiple switching “planes” in parallel: § speedup, scaleup via parallelism
§Cisco CRS router:
§ basic unit: 8
switching planes
§ each plane: 3-stage
interconnection
network
§ up to 100’s Tbps switching capacity
fabric plane 0 fabric plane 1
fabric plane 2 fabric plane 3
fabric plane 4 fabric plane 5
fabric plane 6 fabric plane 7
Network Layer: 4-29
Input port queuing
§If switch fabric slower than input ports combined -> queueing may occur at input queues
• queueing delay and loss due to input buffer overflow! §Head-of-the-Line (HOL) blocking: queued datagram at front of queue
prevents others in queue from moving forward
output port contention: only one red one packet time later: green
datagram can be transferred. lower red packet experiences HOL blocking packet is blocked
Network Layer: 4-30
switch fabric
switch fabric
29 30
Output port queuing
datagram switch buffer
fabric
(rate: NR) queueing R
§Buffering required when datagrams arrive from fabric faster than link transmission rate. Drop policy: which datagrams to drop if no free buffers?
§Scheduling discipline chooses among queued datagrams for transmission
This is a really important slide
Datagrams can be lost due to congestion, lack of buffers
Priority scheduling – who gets best performance, network neutrality
Network Layer: 4-31
link layer protocol (send)
line termination
Output port queuing
at t, packets more one packet time later from input to output
§buffering when arrival rate via switch exceeds output line speed §queueing (delay) and loss due to output port buffer overflow!
switch fabric
switch fabric
Network Layer: 4-32
31 32
8
… …
… …
… …
… …
… …
… …
… …
… …

33 34
2/9/21
How much buffering?
§RFC 3439 rule of thumb: average buffering equal to “typical” RTT (say 250 msec) times link capacity C
• e.g., C = 10 Gbps link: 2.5 Gbit buffer
§more recent recommendation: with N flows, buffering equal to
RTT.C
N
§but too much buffering can increase delays (particularly in home routers)
• long RTTs: poor performance for realtime apps, sluggish TCP response
• recall delay-based congestion control: “keep bottleneck link just full enough (busy) but no fuller”
Network Layer: 4-33
Buffer Management
switch fabric
datagram buffer
queueing scheduling
link layer protocol (send)
R
packet departures
buffer management: §drop: which packet to add,
drop when buffers are full
• tail drop: drop arriving packet
• priority: drop/remove on priority basis
§marking: which packets to mark to signal congestion (ECN, RED)
Network Layer: 4-34
Abstraction: queue
line termination
packet arrivals
queue (waiting area)
R
link (server)
Packet Scheduling: FCFS
packet scheduling: deciding which packet to send next on link
• first come, first served • priority
• round robin
• weighted fair queueing
FCFS: packets transmitted in order of arrival to output port
§also known as: First-in-first-
Abstraction: queue
out (FIFO)
§real world examples?
packet arrivals
R
queue link
packet departures
(waiting area)
(server)
Network Layer: 4-35
Scheduling policies: priority
Priority scheduling:
§arriving traffic classified, queued by class
• any header fields can be used for classification
§send packet from highest priority queue that has buffered packets
• FCFS within priority class
high priority queue
arrivals
classify link low priority queue
2 1345
departures
arrivals
packet in service
departures
132
4
5
1324 5
Network Layer: 4-36
35 36
9

37 38
2/9/21
Scheduling policies: round robin
Round Robin (RR) scheduling:
§arriving traffic classified, queued by class
• any header fields can be used for classification
§server cyclically, repeatedly scans class queues, sending one complete packet from each class (if available) in turn
R
departures
Network Layer: 4-37
classify link arrivals
Scheduling policies: weighted fair queueing
Weighted Fair Queuing (WFQ):
§generalized Round Robin §each class, i, has weight, wi,
and gets weighted amount of service in each cycle:
wi Sjwj
§minimum bandwidth guarantee (per-traffic-class)
w1
w2 R
classify arrivals
w3
link
departures
Network Layer: 4-38
Sidebar: Network Neutrality
What is network neutrality?
§ technical: how an ISP should share/allocation its resources
• packet scheduling, buffer management are the mechanisms §social, economic principles
• protecting free speech
• encouraging innovation, competition
§enforced legal rules and policies
Different countries have different “takes” on network neutrality
Network Layer: 4-39
Sidebar: Network Neutrality
2015 US FCC Order on Protecting and Promoting an Open Internet: three “clear, bright line” rules:
§no blocking … “shall not block lawful content, applications, services, or non-harmful devices, subject to reasonable network management.”
§no throttling … “shall not impair or degrade lawful Internet traffic on the basis of Internet content, application, or service, or use of a non-harmful device, subject to reasonable network management.”
§no paid prioritization. … “shall not engage in paid prioritization”
Network Layer: 4-40
39 40
10

41 42
2/9/21
ISP: telecommunications or information service?
Is an ISP a “telecommunications service” or an “information service” provider?
§ the answer really matters from a regulatory standpoint!
US Telecommunication Act of 1934 and 1996:
• Title II: imposes “common carrier duties” on telecommunications
services: reasonable rates, non-discrimination and requires regulation • Title I: applies to information services:
• no common carrier duties (not regulated)
• but grants FCC authority “… as may be necessary in the execution of its functions”4
Network Layer: 4-41
Network layer: “data plane” roadmap
§Network layer: overview • data plane
• control plane
§What’s inside a router
• input ports, switching, output ports
• buffer management, scheduling §IP: the Internet Protocol
• datagram format
• addressing
• network address translation • IPv6
§Generalized Forwarding, SDN
• match+action
• OpenFlow: match+action in action
§ Middleboxes
Network Layer: 4-42
Network Layer: Internet
host, router network layer functions:
network layer
transport layer: TCP, UDP
IP protocol
• datagram format
• addressing
• packet handling conventions
Path-selection algorithms: implemented in
• routing protocols (OSPF, BGP)
• SDN controller
forwarding table
link layer
ICMP protocol
• error reporting
• router “signaling”
physical layer
Network Layer: 4-43
IP Datagram format
IP protocol version number
header length(bytes)
“type” of service: § diffserv (0:5)
§ ECN (6:7)
TTL: remaining max hops (decremented at each router)
upper layer protocol (e.g., TCP or UDP)
overhead
§ 20 bytes of TCP § 20 bytes of IP §= 40 bytes + app
layer overhead for TCP+IP
32 bits
total datagram length (bytes)
fragmentation/ reassembly
header checksum
32-bit source IP address
ver
16
head. len
-bit id
type of service
entifier
length
flgs
fragment offset
time to live
upper layer
header checksum
source IP address
destination IP address
options (if any)
payload data (variable length, typically a TCP or UDP segment)
Maximum length: 64K bytes
32-bit destination IP address
Typically: 1500 bytes or less
e.g., timestamp, record route taken
Network Layer: 4-44
43 44
11

IP addressing: introduction
§ IP address: 32-bit identifier associated with each host or router interface
§ interface: connection between host/router and physical link
• router’s typically have multiple interfaces
• host typically has one or two interfaces (e.g., wired Ethernet, wireless 802.11)
223.1.1.1
223.1.1.2
223.1.2.1 223.1.2.9
223.1.1.4
223.1.1.3
223.1.3.27
223.1.3.1
223.1.2.2
223.1.3.2
dotted-decimal IP address notation:
223.1.1.1 = 11011111 00000001 00000001 00000001
223 1 1 1
Network Layer: 4-45
IP addressing: introduction
§ IP address: 32-bit identifier associated with each host or router interface
§ interface: connection between host/router and physical link
• router’s typically have multiple interfaces
• host typically has one or two interfaces (e.g., wired Ethernet, wireless 802.11)
223.1.1.1
223.1.1.2
223.1.2.1 223.1.2.9
223.1.1.4
223.1.1.3
223.1.3.27
223.1.3.1
223.1.2.2
223.1.3.2
dotted-decimal IP address notation:
223.1.1.1 = 11011111 00000001 00000001 00000001
223 1 1 1
Network Layer: 4-46
45 46
IP addressing: introduction
Q: how are interfaces actually connected?
A: we’ll learn about that in chapters 6, 7
223.1.1.2
A: wired
Ethernet interfaces connected by Ethernet switches
223.1.1.4
223.1.2.1 223.1.2.9
223.1.1.1
223.1.1.3
223.1.3.27
223.1.3.1
223.1.2.2
223.1.3.2
For now: don’t need to worry about how one interface is connected to another (with no intervening router)
A: wireless WiFi interfaces connected by WiFi base station
Network Layer: 4-47
Subnets
§What’s a subnet ?
• device interfaces that can
physically reach each other
without passing through an intervening router
223.1.1.1
223.1.1.2
223.1.2.1 223.1.2.9
223.1.1.4
§IP addresses have structure:
• subnet part: devices in same subnet
have common high order bits
• host part: remaining low order bits
network consisting of 3 subnets
Network Layer: 4-48
223.1.1.3
223.1.3.27
223.1.3.1
223.1.2.2
223.1.3.2
47 48
2/9/21
12

49 50
2/9/21
Subnets
Recipe for defining subnets:
§detach each interface from its host or router, creating “islands” of isolated networks
subnet 223.1.1.0/24
223.1.1.2
223.1.1.1
223.1.1.3
subnet 223.1.2.0/24
223.1.2.1 223.1.2.9
223.1.1.4
§each isolated network is called a subnet
subnet 223.1.3.0/24
223.1.3.27
223.1.3.1
223.1.2.2
223.1.3.2
subnet mask: /24
(high-order 24 bits: subnet part of IP address)
Network Layer: 4-49
Subnets
§ where are the subnets?
§ what are the /24 subnet addresses?
223.1.1.2
223.1.1.1
223.1.1.3
subnet 223.1.1/24
223.1.1.4
223.1.9.2
223.1.7.0
subnet 223.1.7/24
subnet 223.1.9/24
223.1.9.1
223.1.2.6
223.1.7.1
subnet 223.1.2/24
223.1.8.1 223.1.8.0
subnet223.1.8/24 223.1.3.27
subnet 223.1.3/24
223.1.3.2
223.1.2.1
223.1.2.2
223.1.3.1
Network Layer: 4-50
IP addressing: CIDR
CIDR: Classless InterDomain Routing (pronounced “cider”)
• subnet portion of address of arbitrary length
• address format: a.b.c.d/x, where x is # bits in subnet portion of address
subnet host part part
11001000 00010111 00010000 00000000 200.23.16.0/23
Network Layer: 4-51
IP addresses: how to get one?
That’s actually two questions:
1. Q: How does a host get IP address within its network (host part of
address)?
2. Q: How does a network get IP address for itself (network part of address)
How does host get IP address?
§ hard-coded by sysadmin in config file (e.g., /etc/rc.config in UNIX)
§ DHCP: Dynamic Host Configuration Protocol: dynamically get address
from as server
• “plug-and-play”
Network Layer: 4-52
51 52
13

2/9/21
DHCP: Dynamic Host Configuration Protocol
goal: host dynamically obtains IP address from network server when it “joins” network
§can renew its lease on address in use
§allows reuse of addresses (only hold address while connected/on) §support for mobile users who join/leave network
DHCP overview:
§host broadcasts DHCP discover msg [optional]
§DHCP server responds with DHCP offer msg [optional] §host requests IP address: DHCP request msg
§DHCP server sends address: DHCP ack msg
Network Layer: 4-53
DHCP client-server scenario
223.1.1.1 223.1.1.2
223.1.1.3
223.1.1.4
223.1.2.5
223.1.2.9
223.1.2.1
223.1.2.2
DHCP server
Typically, DHCP server will be co- located in router, serving all subnets to which router is attached
arriving DHCP client needs address in this network
Network Layer: 4-54
223.1.3.27
223.1.3.1 223.1.3.2
53 54
DHCP client-server scenario
DHCP server: 223.1.2.5
DHCP discover
DHCP offer
DHCP ACK
Arriving client
The two steps above can be skipped “if a client remembers and wishes to reuse a previously
allocated network address” [RFC 2131]
Network Layer: 4-55
src : 0.0.0.0, 68
Broadcast: is there a
dest.: 255.255.255.255,67
D H C P y si a ed rd vr : e r 0 o. 0u. 0t . 0t h e r e ? transaction ID: 654
src: 223.1.2.5, 67
Broadcast: I’m a DHCP
dest: 255.255.255.255, 68 seryviaedrd!rrH: 2e2r3e.1’s.2.a4n IP
transaction ID: 654
address you can use
lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
Broadcast: OK. I would
yiaddrr: 223.1.2.4
like totruansseactthioinsIDIP: 6a55ddress! lifetime: 3600 secs
src: 223.1.2.5, 67
Broadcast: OK. You’ve
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4 gotrtantshactioInPIDa:d6d55ress!
lifetime: 3600 secs
DHCP: more than IP addresses
DHCP can return more than just allocated IP address on subnet:
§ address of first-hop router for client
§ name and IP address of DNS sever
§ network mask (indicating network versus host portion of address)
Network Layer: 4-56
55 56
14

DHCP: example
DHCP
UDP
IP
Eth
Phy
DHCP
DHCP DHCP DHCP DHCP
D H C P DHCP DHCP DHCP
168.1.1.1
router with DHCP server built into router
§ Connecting laptop will use DHCP to get IP address, address of first- hop router, address of DNS server.
§ DHCP REQUEST message encapsulated in UDP, encapsulated in IP, encapsulated in Ethernet
§ Ethernet frame broadcast (dest: FFFFFFFFFFFF) on LAN, received at router running DHCP server
§ Ethernet demux’ed to IP demux’ed, UDP demux’ed to DHCP
Network Layer: 4-57
DHCP
UDP
IP
Eth
Phy
DHCP: example
DHCP DHCP DHCP DHCP
DHCP
DHCP
DHCP
DHCP router with DHCP
§ DCP server formulates DHCP ACK containing client’s IP address, IP address of first-hop router for client, name & IP address of DNS server
§ encapsulated DHCP server reply forwarded to client, demuxing up to DHCP at client
§ client now knows its IP address, name and IP address of DNS server, IP address of its first-hop router
Network Layer: 4-58
DHCP
UDP
IP
Eth
Phy
DHCP
UDP
IP
Eth
Phy
DHCP
server built into router
57 58
2/9/21
IP addresses: how to get one?
Q: how does network get subnet part of IP address?
A: gets allocated portion of its provider ISP’s address space
ISP’s block 11001000 00010111 00010000 00000000 200.23.16.0/20
ISP can then allocate out its address space in 8 blocks:
Organization 0 Organization 1 Organization 2
11001000 00010111 00010000 00000000 11001000 00010111 00010010 00000000 11001000 00010111 00010100 00000000
200.23.16.0/23 200.23.18.0/23 200.23.20.0/23
… ….. ….
Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23
….
Network Layer: 4-59
Hierarchical addressing: route aggregation
hierarchical addressing allows efficient advertisement of routing information:
Organization 0
200.23.16.0/23
Organization 1
200.23.18.0/23
“Send me anything with addresses beginning 200.23.16.0/20”
“Send me anything with addresses beginning 199.31.0.0/16”
Organization 2 200.23.20.0/23 .
Fly-By-Night-ISP
ISPs-R-Us
. . Organization 7 .
Internet
200.23.30.0/23
Network Layer: 4-60
59 60
15

61 62
2/9/21
Hierarchical addressing: more specific routes § Organization 1 moves from Fly-By-Night-ISP to ISPs-R-Us
§ ISPs-R-Us now advertises a more specific route to Organization 1
Organization 0
200.23.16.0/23
Organization 1 200.23.18.0/23
“Send me anything with addresses beginning 200.23.16.0/20”
“Send me anything with addresses beginning 199.31.0.0/16”
“or 200.23.18.0/23”
Organization 2 200.23.20.0/23
. . .
Fly-By-Night-ISP
ISPs-R-Us
Organization 7 . 200.23.30.0/23
Organization 1 200.23.18.0/23
Internet
Network Layer: 4-61
Hierarchical addressing: more specific routes § Organization 1 moves from Fly-By-Night-ISP to ISPs-R-Us
§ ISPs-R-Us now advertises a more specific route to Organization 1 Organization 0
200.23.16.0/23
Organization 2 200.23.20.0/23 .
Fly-By-Night-ISP
ISPs-R-Us
“Send me anything with addresses beginning 200.23.16.0/20”
“Send me anything with addresses beginning 199.31.0.0/16”
“or 200.23.18.0/23”
. . Organization 7 .
Internet
200.23.30.0/23
Organization 1 200.23.18.0/23
Network Layer: 4-62
IP addressing: last words …
Q: how does an ISP get block of addresses?
A: ICANN: Internet Corporation for Assigned Names and Numbers http://www.icann.org/
• allocates IP addresses, through 5 regional registries (RRs) (who may then allocate to local registries)
• manages DNS root zone, including
delegation of individual TLD (.com, .edu , …) management
Q: are there enough 32-bit IP addresses?
§ ICANN allocated last chunk of IPv4 addresses to RRs in 2011
§ NAT (next) helps IPv4 address space exhaustion
§ IPv6 has 128-bit address space
“Who the hell knew how much address space we needed?” Vint Cerf (reflecting on decision to make IPv4 address 32 bits long)
Network Layer: 4-63
Network layer: “data plane” roadmap
§Network layer: overview • data plane
• control plane
§What’s inside a router
• input ports, switching, output ports
• buffer management, scheduling §IP: the Internet Protocol
• datagram format
• addressing
• network address translation • IPv6
§Generalized Forwarding, SDN
• match+action
• OpenFlow: match+action in action
§ Middleboxes
Network Layer: 4-64
63 64
16

2/9/21
NAT: network address translation
NAT: all devices in local network share just one IPv4 address as far as outside world is concerned
rest of Internet
138.76.29.7
all datagrams leaving local network have same source NAT IP address: 138.76.29.7, but different source port numbers
local network (e.g., home network) 10.0.0/24
10.0.0.4
10.0.0.1 10.0.0.2 10.0.0.3
datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual)
Network Layer: 4-65
NAT: network address translation
§ all devices in local network have 32-bit addresses in a “private” IP address space (10/8, 172.16/12, 192.168/16 prefixes) that can only be used in local network
§ advantages:
§ just one IP address needed from provider ISP for all devices
§ can change addresses of host in local network without notifying
outside world
§ can change ISP without changing addresses of devices in local
network
§ security: devices inside local net not directly addressable, visible by outside world
Network Layer: 4-66
65 66
NAT: network address translation
implementation: NAT router must (transparently):
§ outgoing datagrams: replace (source IP address, port #) of every
outgoing datagram to (NAT IP address, new port #)
• remote clients/servers will respond using (NAT IP address, new port #) as destination address
§ remember (in NAT translation table) every (source IP address, port #) to (NAT IP address, new port #) translation pair
§ incoming datagrams: replace (NAT IP address, new port #) in destination fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table
Network Layer: 4-67
NAT: network address translation
2: NAT router changes datagram source address from 10.0.0.1, 3345 to
1: host 10.0.0.1 sends datagram to 128.119.40.186, 80
NAT translation table
WAN side addr
138.76.29.7, 5001
……
LAN side addr
10.0.0.1, 3345
……
138.76.29.7, 5001, updates table
S: 10.0.0.1, 3345
D: 128.119.40.186, 80
10.0.0.4
S: 138.76.29.7, 5001 D: 128.119.40.186, 80
2
3: reply arrives, destination address: 138.76.29.7, 5001
1
4
10.0.0.1 10.0.0.2 10.0.0.3
138.76.29.7
3
S: 128.119.40.186, 80 D: 10.0.0.1, 3345
S: 128.119.40.186, 80 D: 138.76.29.7, 5001
Network Layer: 4-68
67 68
17

69 70
2/9/21
NAT: network address translation
§ NAT has been controversial:
• routers “should” only process up to layer 3
• address “shortage” should be solved by IPv6
• violates end-to-end argument (port # manipulation by network-layer device) • NAT traversal: what if client wants to connect to server behind NAT?
§ but NAT is here to stay:
• extensively used in home and institutional nets, 4G/5G cellular nets
Network Layer: 4-69
IPv6: motivation
§ initial motivation: 32-bit IPv4 address space would be completely allocated
§ additional motivation:
• speed processing/forwarding: 40-byte fixed length header • enable different network-layer treatment of “flows”
Network Layer: 4-70
IPv6 datagram format
priority: identify priority among datagrams in flow 128-bit IPv6 addresses
32 bits
flow label: identify datagrams in same “flow.” (concept of “flow” not well defined).
ver
pri
flow label
payload len
next hdr
hop limit
source address (128 bits)
destination address (128 bits)
payload (data)
What’s missing (compared with IPv4):
§ no checksum (to speed processing at routers)
§ no fragmentation/reassembly
§ no options (available as upper-layer, next-header protocol at router)
Network Layer: 4-71
Transition from IPv4 to IPv6
§not all routers can be upgraded simultaneously
• no “flag days”
• how will network operate with mixed IPv4 and IPv6 routers?
§tunneling: IPv6 datagram carried as payload in IPv4 datagram among IPv4 routers (“packet within a packet”)
• tunneling used extensively in other contexts (4G/5G)
IPv4 header fields
IPv4 source, dest addr
IPv6 header fields
IPv6 source dest addr
UDP/TCP payload
IPv4 datagram
IPv4 payload
I
Pv6 datagram
Network Layer: 4-72
71 72
18

Tunneling and encapsulation
Ethernet connecting two IPv6 routers:
A B Ethernet connects two E F IPv6 routers
IPv6 IPv6
IPv6 IPv6
IPv6 datagram
IPv4 network connecting two IPv6 routers
AB EF
Link-layer frame
The usual: datagram as payload in link-layer frame
IPv6 IPv6/v4
IPv6/v4 IPv6
IPv4 network
Network Layer: 4-73
Tunneling and encapsulation
Ethernet connecting two IPv6 routers:
A B Ethernet connects two E F IPv6 routers
IPv6 IPv6
IPv6 IPv6
IPv6 datagram
IPv4 tunnel connecting two IPv6 routers
A B
IPv6 IPv6/v4
IPv4 tunnel connecting IPv6 routers
E F
IPv6/v4 IPv6
Link-layer frame
The usual: datagram as payload in link-layer frame
IPv6 datagram
IPv4 datagram
tunneling: IPv6 datagram as payload in a IPv4 datagram
Network Layer: 4-74
73 74
2/9/21
Tunneling
logical view:
physical view:
Note source and destination addresses!
A B IPv4 tunnel connecting IPv6 routers
IPv6 IPv6/v4 ABCDEF
E F
IPv6/v4 IPv6
IPv6 IPv6/v4 IPv4
IPv4
IPv6/v4 IPv6
E-to-F:
src:B dest: E
Flow: X Src: A Dest: F
data
src:B dest: E
Flow: X Src: A Dest: F
data
src:B dest: E
Flow: X Src: A Dest: F
data
flow: X src: A dest: F
data
flow: X src: A dest: F
data
A-to-B: IPv6
B-to-C:
IPv6 inside IPv4
B-to-C: IPv6 inside IPv4
B-to-C:
IPv6 inside IPv6 IPv4
Network Layer: 4-75
IPv6: adoption
§ Google1: ~ 30% of clients access services via IPv6
§ NIST: 1/3 of all US government domains are IPv6 capable
1
https://www.google.com/intl
/en/ipv6/statistics.html
Network Layer: 4-76
75 76
19

2/9/21
IPv6: adoption
§ Google1: ~ 30% of clients access services via IPv6
§ NIST: 1/3 of all US government domains are IPv6 capable § Long (long!) time for deployment, use
• 25 years and counting!
• thinkofapplication-levelchangesinlast25years:WWW,social
media, streaming media, gaming, telepresence, …
• Why?
1 https://www.google.com/intl/en/ipv6/statistics.html
Network Layer: 4-77
Network layer: “data plane” roadmap
§Network layer: overview • data plane
• control plane
§What’s inside a router
• input ports, switching, output ports • buffer management, scheduling
§IP: the Internet Protocol • datagram format
• addressing
• network address translation • IPv6
§Generalized Forwarding, SDN
• Match+action
• OpenFlow: match+action in action
§ Middleboxes
Network Layer: 4-78
77 78
Generalized forwarding: match plus action
Review: each router contains a forwarding table (aka: flow table)
§ “match plus action” abstraction: match bits in arriving packet, take action
• destination-based forwarding: forward based on dest. IP address
Network Layer: 4-79
values in arriving
packet header
• generalized forwarding:
• manyheaderfieldscandetermineaction
• manyactionpossible:drop/copy/modify/logpacket
0111
1
2
3
forwarding table
(aka: flow table)
Flow table abstraction
§flow: defined by header field values (in link-, network-, transport-layer fields) §generalized forwarding: simple packet-handling rules
• match: pattern values in packet header fields
• actions: for matched packet: drop, forward, modify, matched packet or send
matched packet to controller
• priority: disambiguate overlapping patterns • counters: #bytes and #packets
Router’s flow table define router’s match+action rules
Flow table
match
action
Network Layer: 4-80
79 80
20

2/9/21
Flow table abstraction
§flow: defined by header fields
§generalized forwarding: simple packet-handling rules
• match: pattern values in packet header fields
• actions: for matched packet: drop, forward, modify, matched packet or send
matched packet to controller
• priority: disambiguate overlapping patterns • counters: #bytes and #packets
src = *.*.*.*, dest=3.4.*.* src=1.2.*.*, dest=*.*.*.* src=10.1.2.3, dest=*.*.*.*
forward(2)
drop
send to controller
Flow table
match
action
1
4
3
* : wildcard
2
Network Layer: 4-81
OpenFlow: flow table entries
Match
Header fields to match:
Ingress Src Dst Eth VLAN VLAN
IP Src
IP Dst IP IP Proto ToS
Network layer
TCP/UDP TCP/UDP Src Port Dst Port
Transport layer
Port MAC MAC Type
Link layer
ID Pri
Action
Stats
Packet + byte counters
1. Forward packet to port(s)
2. Drop packet
3. Modify fields in header(s)
4. Encapsulate and forward to controller
Network Layer: 4-82
81 82
OpenFlow: examples
Destination-based forwarding:
* * * * * * * 51.6.0.8 * * * * port6
IP datagrams destined to IP address 51.6.0.8 should be forwarded to router output port 6
Firewall:
Switch Port
MAC src
MAC dst
Eth type
VLAN ID
VLAN Pri
IP Src
IP Dst
IP Prot
IP ToS
TCP s-port
TCP d-port
Action
Switch Port
MAC src
MAC dst
Eth type
VLAN ID
VLAN Pri
IP Src
IP Dst
IP Prot
IP ToS
TCP s-port
TCP d-port
Action
* * * * * * * * * * * 22 drop
Block (do not forward) all datagrams destined to TCP port 22 (ssh port #)
Switch Port
MAC src
MAC dst
Eth type
VLAN ID
VLAN Pri
IP Src
IP Dst
IP Prot
IP ToS
TCP s-port
TCP d-port
Action
* * * * * * 128.119.1.1 * * * * * drop
Block (do not forward) all datagrams sent by host 128.119.1.1
Network Layer: 4-83
OpenFlow: examples
Layer 2 destination-based forwarding:
22:A7:23:
* * 11:E1:02 * * * * * * * * * port3
layer 2 frames with destination MAC address 22:A7:23:11:E1:02 should be forwarded to output port 3
Switch Port
MAC src
MAC dst
Eth type
VLAN ID
VLAN Pri
IP Src
IP Dst
IP Prot
IP ToS
TCP s-port
TCP d-port
Action
Network Layer: 4-84
83 84
21

2/9/21
OpenFlow abstraction
§match+action: abstraction unifies different kinds of devices
Router
• match: longest destination IP prefix
• action: forward out a link
Switch
• match: destination MAC address
• action: forward or flood
Firewall
• match: IP addresses and TCP/UDP port numbers
• action: permit or deny
NAT
• match: IP address and port • action: rewrite address and
port
Network Layer: 4-85
OpenFlow example
Host h6
10.3.0.6
s3 controller 4
Orchestrated tables can create network-wide behavior, e.g.,:
§datagrams from hosts h5 and h6 should be sent to h3 or h4, via s1 and from there to s2
2
3
Host h5
10.3.0.5
1
1 s1 33
Host h1
10.1.0.1
2
1 s2 4 2 4
Host h4
10.2.0.4
Host h2
10.1.0.2
Host h3
10.2.0.3
Network Layer: 4-86
85 86
OpenFlow example
Host h6
10.3.0.6
s3
4
3
Orchestrated tables can create network-wide behavior, e.g.,:
§datagrams from hosts h5 and h6 should be sent to h3 or h4, via s1 and from there to s2
match
action
IP Src = 10.3.*.* IP Dst = 10.2.*.*
forward(3)
2
1
controller
Host h5
10.3.0.5
Host h1
10.1.0.1
2
1s1 1 s2 4 2 4
33
Host h4
10.2.0.4
match
action
ingress port = 2 IP Dst = 10.2.0.3
forward(3)
ingress port = 2 IP Dst = 10.2.0.4
forward(4)
match
action
ingress port = 1
IP Src = 10.3.*.* IP Dst = 10.2.*.*
forward(4)
Host h2
10.1.0.2
Host h3
10.2.0.3
Network Layer: 4-87
Generalized forwarding: summary
§ “match plus action” abstraction: match bits in arriving packet header(s) in any layers, take action
• matching over many fields (link-, network-, transport-layer)
• local actions: drop, forward, modify, or send matched packet to
controller
• “program” network-wide behaviors
§ simple form of “network programmability” • programmable, per-packet “processing” • historical roots: active networking
• today: more generalized programming:
P4 (see p4.org).
Network Layer: 4-88
87 88
22

2/9/21
Network layer: “data plane” roadmap
§Network layer: overview §What’s inside a router §IP: the Internet Protocol §Generalized Forwarding § Middleboxes
• middlebox functions
• evolution, architectural principles of the Internet
Network Layer: 4-89
Middleboxes
Middlebox (RFC 3234)
“any intermediary box performing functions apart from normal, standard functions of an IP router on the data path between a source host and destination host”
89 90
Middleboxes everywhere!
NAT: home, cellular, institutional
Application- specific: service
providers, institutional,
CDN enterprise network
national or global ISP
Firewalls, IDS: corporate, institutional, service providers, ISPs
Load balancers:
corporate, service provider, data center, mobile nets
dat net
acent work
er
Caches: service provider, mobile, CDNs
Middleboxes
§ initially: proprietary (closed) hardware solutions
§ move towards “whitebox” hardware implementing open API
§ move away from proprietary hardware solutions
§ programmable local actions via match+action
§ move towards innovation/differentiation in software
§ SDN: (logically) centralized control and configuration management often in private/public cloud
§ network functions virtualization (NFV): programmable services over white box networking, computation, storage
91 92
23

2/9/21
The IP hourglass
Internet’s “thin waist”:
§ one network layer TCP protocol: IP
many protocols in physical, link, transport, and application layers
HTTP SMTP RTP …
QUIC
DASH UDP
IP
§ must be implemented by every (billions) of Internet-connected devices
Ethernet PPP … PDCP WiFi Bluetooth
copper radio fiber
The IP hourglass, at middle age
Internet’s middle age
“love handles”?
HTTP SMTP RTP … QUIC DASH
TCP UDP
caching
§ middleboxes, IP
operating inside the network
Firewalls
Ethernet PPP … PDCP WiFi Bluetooth
copper radio fiber
93 94
Architectural Principles of the Internet
RFC 1958
“Many members of the Internet community would argue that there is no architecture, but only a tradition, which was not written down for the first 25 years (or at least not by the IAB). However, in very general terms,
network.”
Three cornerstone beliefs: § simple connectivity
§ IP protocol: that narrow waist
§ intelligence, complexity at network edge
the community believes that
the goal is connectivity, the tool is the Internet Protocol, and the intelligence is end to end rather than hidden in the
The end-end argument
§ some network functionality (e.g., reliable data transfer, congestion) can be implemented in network, or at network edge
application
transport
network data link physical
application transport network data link physical
end-end implementation of reliable data transfer
hop-by-hop (in-network) implementation of reliable data transfer
application
transport
network data link physical
application transport network data link physical
network
link physical
network
link physical
network
link physical
network
link physical
network
link physical
network
link physical
95 96
24
NAT
NFV

2/9/21
The end-end argument
§ some network functionality (e.g., reliable data transfer, congestion) can be implemented in network, or at network edge
“The function in question can completely and correctly be implemented only with the knowledge and help of the application standing at the end points of the communication system. Therefore, providing that questioned function as a feature of the communication system itself is not possible. (Sometimes an incomplete version of the function provided by the communication system may be useful as a performance enhancement.)
We call this line of reasoning against low-level function implementation the “end- to-end argument.”
Saltzer, Reed, Clark 1981
Where’s the intelligence?
97
98
99
100
Chapter 4: done!
§Network layer: overview §What’s inside a router
§IP: the Internet Protocol §Generalized Forwarding, SDN § Middleboxes
Question: how are forwarding tables (destination-based forwarding) or flow tables (generalized forwarding) computed?
Answer: by the control plane (next chapter)
Additional Chapter 4 slides
20th century phone net:
• intelligence/computing at networkswitches
Internet (pre-2005)
• intelligence, computing at edge
Internet (post-2005)
• programmable network devices • intelligence,computing,massive
application-level infrastructure at edge
Network Layer: 4-100
25

101 102
2/9/21
IP fragmentation/reassembly
§network links have MTU (max. transfer size) – largest possible link-level frame
• different link types, different MTUs §large IP datagram divided
(“fragmented”) within net
• one datagram becomes several
datagrams
• “reassembled” only at destination
• IP header bits used to identify, order
related fragments
fragmentation:
in: one large datagram out: 3 smaller datagrams
reassembly
Network Layer: 4-101
IP fragmentation/reassembly
example:
§ 4000 byte datagram § MTU = 1500 bytes
1480 bytes in data field
offset = 1480/8
one large datagram becomes several smaller datagrams
length =4000
ID =x
fragflag =0
offset =0
length =1500
ID =x
fragflag =1
offset =0
length
ID
fragflag
offset =185
=1500
=x
=1
length =1040
ID =x
fragflag =0
offset =370
Network Layer: 4-102
DHCP: Wireshark output (home LAN)
Message type: Boot Request (1) Hardware type: Ethernet Hardware address length: 6 Hops: 0
Transaction ID: 0x6b3a11b7
request
Message type: Boot Reply (2) Hardware type: Ethernet Hardware address length: 6 Hops: 0
Transaction ID: 0x6b3a11b7
reply
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
Client IP address: 0.0.0.0 (0.0.0.0)
Your (client) IP address: 0.0.0.0 (0.0.0.0)
Next server IP address: 0.0.0.0 (0.0.0.0)
Relay agent IP address: 0.0.0.0 (0.0.0.0)
Client MAC address: Wistron_23:68:8a (00:16:d3:23:68:8a) Server host name not given
Boot file name not given
Magic cookie: (OK)
Option: (t=53,l=1) DHCP Message Type = DHCP Request Option: (61) Client identifier
Length: 7; Value: 010016D323688A;
Hardware type: Ethernet
Client MAC address: Wistron_23:68:8a (00:16:d3:23:68:8a)
Option: (t=50,l=4) Requested IP Address = 192.168.1.101 Option: (t=12,l=5) Host Name = “nomad”
Option: (55) Parameter Request List
Length: 11; Value: 010F03062C2E2F1F21F92B
1 = Subnet Mask; 15 = Domain Name 3 = Router; 6 = Domain Name Server 44 = NetBIOS over TCP/IP Name Server ……
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
Client IP address: 192.168.1.101 (192.168.1.101)
Your (client) IP address: 0.0.0.0 (0.0.0.0)
Next server IP address: 192.168.1.1 (192.168.1.1)
Relay agent IP address: 0.0.0.0 (0.0.0.0)
Client MAC address: Wistron_23:68:8a (00:16:d3:23:68:8a) Server host name not given
Boot file name not given
Magic cookie: (OK)
Option: (t=53,l=1) DHCP Message Type = DHCP ACK Option: (t=54,l=4) Server Identifier = 192.168.1.1 Option: (t=1,l=4) Subnet Mask = 255.255.255.0
Option: (t=3,l=4) Router = 192.168.1.1
Option: (6) Domain Name Server
Length: 12; Value: 445747E2445749F244574092; IP Address: 68.87.71.226;
IP Address: 68.87.73.242;
IP Address: 68.87.64.146
Option: (t=15,l=20) Domain Name = “hsd1.ma.comcast.net.”
Network Layer: 4-103
103
26