Chapter4 2021
Chapter4 2021
4-1
Chapter 4: network layer
chapter goals:
understand principles behind network
layer services, focusing on data plane:
• network layer service models
• forwarding versus routing
• how a router works
• generalized forwarding
instantiation, implementation in the
Internet
… built on ...
Physical transfer of bits
Source: Scott Shenker (UC Berkeley): slide 7 at The Future of Networking, and the
Past of Protocols
https://www.youtube.com/watch?v=YHeyuD89n1Y&t=111s
Chapter 4: Network Layer:
Data Plane
4.1 Overview of 4.4 Generalized
Network layer Forward and SDN
• data plane • match
• control plane • action
4.2 What’s inside a • OpenFlow
router examples of
4.3 IP: Internet Protocol match-plus-action
• datagram format in action
• fragmentation
• IPv4 addressing
• network address
translation
• IPv6
Network Layer: Data 4-4
Plane
Network layer
transport segment
application
transport
network
on sending side
data link
physical network network
data link data link
transport layer
network data link data link
data link physical physical
physical
network layer
protocols in every
host, router
router examines Network Layer: Data 4-5
Plane
Two key network-layer
functions
network-layer analogy: taking a trip
functions: forwarding: process
forwarding: move of getting through
packets from router’s single interchange
input to appropriate
router output routing: process of
routing: determine planning trip from
route taken by source to
packets from source destination
to destination
• routing algorithms
Routing
Algorithm
control
plane
data
plane
values in arriving
packet header
0111 1
2
3
control
plane
data
plane
CA
CA CA CA CA
values in arriving
packet header
0111 1
2
3
physical layer:
bit-level reception
data link layer: decentralized switching:
e.g., Ethernet using header field values, lookup
see chapter 6 output port using forwarding table
in input port memory (“match plus
action”)
goal: complete input port
processing at ‘line speed’
queuing: if datagrams arrive faster
than forwarding rate into switch
Network Layer: Data 4-14
Plane
Input port functions
lookup,
link forwarding
line layer switch
termination protocol fabric
(receive)
queueing
physical layer:
bit-level reception
decentralized switching:
data link layer: using header field values, lookup
e.g., Ethernet output port using forwarding table
see chapter 5 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
Network Layer: Data 4-15
Plane
Destination-based
forwarding
forwarding table
Destination Address Range Link Interface
otherwise 3
examples:
DA: 11001000 00010111 00010110 10100001 which interface? 0
DA: 11001000 00010111 00011000 10101010 which interface? 1
rather than 2
Network Layer: Data 4-17
Plane
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: can up ~1M routing table
entries in TCAM
memory
input output
port memory port
(e.g., (e.g.,
Ethernet) Ethernet)
system bus
datagram
switch buffer link
fabric layer line
protocol termination
queueing (send)
switch
switch
fabric
fabric
packet packet
arrivals queue link departures
(waiting area) (server)
physical layer
…
possible link-level in: one large datagram
frame out: 3 smaller datagrams
• different link
types, different
MTUs reassembly
large IP datagram
divided
(“fragmented”) …
within net
• one datagram
becomes several
datagrams
• “reassembled” Network Layer: Data 4-33
Plane
IP fragmentation,
reassembly
length ID fragflag offset
example: =4000 =x =0 =0
4000 byte
datagram one large datagram becomes
several smaller datagrams
MTU = 1500
bytes
1480 bytes in length ID fragflag offset
data field =1500 =x =1 =0
6. 223.1.2.2
• can physically
reach each other
without intervening network consisting of 3 subnets
router
each isolated
network is called
223.1.3.0/24
a subnet
subnet mask: /24
Network Layer: Data 4-39
Plane
In-class question 223.1.1.2
223.1.1.1 223.1.1.4
Q: how many
subnets ? 223.1.1.3
223.1.9.2 223.1.7.0
223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.0
223.1.2.6 223.1.3.27
4-40
Subnets 223.1.1.2
223.1.1.3
223.1.9.2 223.1.7.0
223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.0
223.1.2.6 223.1.3.27
223.1.2.0/24
223.1.3.1 223.1.3.2
223.1.3.0/24
DHCP offer
src: 223.1.2.5, 67
Broadcast: I’m a DHCP
dest: 255.255.255.255, 68
server! Here’s an IP
yiaddrr: 223.1.2.4
transaction
address youID:can
654 use
lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
Broadcast: OK. I’ll
yiaddrr: 223.1.2.4
take that IPID:address!
transaction 655
lifetime: 3600 secs
DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255,
Broadcast: 68
OK. You’ve
yiaddrr: 223.1.2.4
gottransaction
that IPID:address!
655
lifetime: 3600 secs
encapsulated in UDP,
DHCP DHCP 168.1.1.1 encapsulated in IP,
DHCP UDP encapsulated in 802.1
DHCP IP Ethernet frame
DHCP Eth router with DHCP
Phy server built into broadcast (dest:
router FFFFFFFFFFFF) on LAN,
received at router
running DHCP
Ethernet server
demuxed to IP
demuxed, UDP
demuxed to DHCP
Organization 0
200.23.16.0/23
Organization 1
“Send me anything
200.23.18.0/23 with addresses
Organization 2 beginning
200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20”
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
ISPs-R-Us
with addresses
beginning
199.31.0.0/16”
Organization 0
200.23.16.0/23
“Send me anything
with addresses
Organization 2 beginning
200.23.20.0/23 . Fly-By-Night-ISP 200.23.16.0/20”
.
. . Internet
.
Organization 7 .
200.23.30.0/23
“Send me anything
ISPs-R-Us
with addresses
Organization 1 beginning 199.31.0.0/16
or 200.23.18.0/23”
200.23.18.0/23
10.0.0.4
10.0.0.2
138.76.29.7
10.0.0.3
4-64
NAT traversal problem
solution 3: relaying (used in Skype)
• NATed client establishes connection to relay
• external client connects to relay
• relay bridges packets between to connections
2. connection
to 1. connection 10.0.0.1
relay initiated to
by client relay initiated
3. relaying by NATed host
client established
138.76.29.7 NAT
router
4-65
Chapter 4: outline
4.1 Overview of 4.4 Generalized
Network layer Forward and SDN
• data plane • match
• control plane • action
4.2 What’s inside a • OpenFlow
router examples of
4.3 IP: Internet Protocol match-plus-action
• datagram format in action
• fragmentation
• IPv4 addressing
• network address
translation
• IPv6
Network Layer: Data 4-66
Plane
IPv6: motivation
initial motivation: 32-bit address space
soon to be completely allocated.
additional motivation:
• header format helps speed
processing/forwarding
• header changes to facilitate QoS
data
32 bits
Network Layer: Data 4-68
Plane
Other changes from IPv4
checksum: removed entirely to reduce
processing time at each hop
options: allowed, but outside of header,
indicated by “Next Header” field
ICMPv6: new version of ICMP
• additional message types, e.g. “Packet Too
Big”
• multicast group management functions
4-70
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
IPv4 header fields IPv6 header fields
IPv4 payload
IPv4 source, dest addr IPv6 source dest addr
UDP/TCP payload
IPv6 datagram
IPv4 datagram
Network Layer: Data 4-71
Plane
Tunneling
A B IPv4 tunnel E F
connecting IPv6 routers
logical view:
IPv6 IPv6 IPv6 IPv6
A B C D E F
physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6
A B C D E F
physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6
data data
A-to-B: E-to-F:
IPv6 B-to-C: B-to-C: IPv6
IPv6 inside IPv6 inside
IPv4 IPv4 Network Layer: Data 4-73
Plane
IPv6:
adoption
Google: 8% of clients access services via
IPv6
NIST: 1/3 of all US government domains
are IPv6 capable