Chapter 4 Dataplane
Chapter 4 Dataplane
Data Plane
Network layer: our goals
▪understand principles ▪ instantiation, implementation
behind network layer in the Internet
services, focusing on data • IP protocol
plane: • NAT
• network layer service models
• forwarding versus routing
• how a router works
• addressing
• generalized forwarding
• Internet architecture
Network Layer: 4-2
Network layer: “data plane” roadmap
▪ Network layer: overview
• data plane
• control plane
▪ What’s inside a router
• input/output ports, switching
• buffer management
• scheduling ▪ Generalized Forwarding
• Match+action
▪ IP: the Internet Protocol • OpenFlow
• datagram format, addressing
• network address translation (NAT)
• IPv6
Network Layer: 4-3
Network-layer services and protocols
▪ transport segment from sending to mobile network
Routing
Algorith control
m plane
data
plan
e
values in arriving
packet header
0111 1
2
3
Remote Controller
control
plane
data
plan
e
C
A
CA CA CA CA
values in arriving
packet header
0111 1
2
3
physical layer:
bit-level reception
link layer:
decentralized switching:
e.g., Ethernet ▪ 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-11
Input port functions
link lookup,
layer forwarding
line protocol switch
termination (receive fabric
) queueing
physical layer:
bit-level reception
link layer:
decentralized switching:
e.g., Ethernet ▪ 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-12
Destination-based forwarding
Link interface
Destination Address Range
0
11001000 00010111 00010*** ********
1
11001000 00010111 00011000 ********
2
11001000 00010111 00011*** ********
3
otherwise
Link interface
Destination Address Range
0
11001000 00010111 00010*** ********
1
11001000 00010111 00011000 ********
2
11001000 match!
00010111 00011*** ********
3
otherwise
Link interface
Destination Address Range
0
11001000 00010111 00010*** ********
1
11001000 00010111 00011000 ********
2
11001000 00010111 00011*** ********
3
otherwise
match!
11001000 00010111 00010110 10100001 which interface?
examples:
11001000 00010111 00011000 10101010 which interface?
Network Layer: 4-16
Longest prefix matching
longest prefix match
when looking for forwarding table entry for given
destination address, use longest address prefix that
matches destination address.
Link interface
Destination Address Range
0
11001000 00010111 00010*** ********
1
11001000 00010111 00011000 ********
2
11001000 00010111 00011*** ********
3
otherwise
match!
11001000 00010111 00010110 10100001 which interface?
examples:
11001000 00010111 00011000 10101010 which interface?
Network Layer: 4-17
Longest prefix matching
▪ Longest prefix matching is used
▪ 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
R (rate: NR, R
ideally)
...
...
R R
memory
input output
port memory port
(e.g., (e.g.,
Ethernet) Ethernet)
system bus
switch switch
fabric fabric
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-24
Output port queuing
datagram
switch
buffer link
fabric layer line
(rate: protocol termination
NR) queueing (send) R
switch
switch
fabric
fabric
▪ buffering when arrival rate via switch exceeds output line speed
▪ queueing (delay) and loss due to output port buffer overflow!
Abstraction: queue
R packet
departures
packet
arrivals queue link
(waiting area) (server)
▪ minimum bandwidth
guarantee (per-traffic-class)
Network Layer: 4-31
Network layer: “data plane” roadmap
▪ Network layer: overview
• data plane
• control plane
▪ What’s inside a router
• input/output ports, switching
• buffer management
• scheduling ▪ Generalized Forwarding
• Match+action
▪ IP: the Internet Protocol • OpenFlow
• datagram format, addressing
• network address translation (NAT)
• IPv6
Network Layer: 4-32
Network Layer: Internet
host, router network layer functions:
Path-selection
IP protocol
• datagram format
algorithms: • addressing
network implemented in • packet handling conventions
• routing protocols forwarding
layer (OSPF, BGP) table ICMP protocol
• SDN controller • error reporting
• router “signaling”
link layer
physical layer
223 1 1 1
Network Layer: 4-35
IP addressing: introduction
[Link]
223 1 1 1
Network Layer: 4-36
IP addressing: introduction
[Link]
[Link] [Link]
subnet 223.1.1/24
subnets? [Link]
addresses?
[Link] [Link]
[Link] [Link]
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-43
DHCP client-server scenario
Typically, DHCP server will be
DHCP server co-located in router, serving all
[Link]
[Link]
subnets to which router is attached
[Link]
[Link]
[Link] [Link]
[Link]
[Link] arriving DHCP client needs
[Link] address in this network
[Link] [Link]
DHCP offer
src: [Link], 67
Broadcast: I’m a DHCP
dest: [Link], 68
server!
yiaddr:Here’s
223.1.2.4an IP
transaction ID: 654
address you can use
lifetime: 3600 secs
The two steps above can
DHCP request be skipped “if a client
src: [Link], 68 remembers and wishes to
dest:: [Link],
Broadcast: OK. I would67 reuse a previously
yiaddr: [Link] allocated network address”
like to transaction
use this ID:IP 655
address!
lifetime: 3600 secs
[RFC 2131]
DHCP ACK
src: [Link], 67
dest: [Link], 68
Broadcast: OK. You’ve
yiaddr: [Link]
got that IPID:
transaction address!
655
lifetime: 3600 secs
Network Layer: 4-45
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)
[Link]
[Link] [Link]
[Link]
[Link]
all datagrams leaving local network have datagrams with source or destination in
same source NAT IP address: [Link], this network have 10.0.0/24 address for
but different source port numbers source, destination (as usual)
Network Layer: 4-50
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
payload (data)
IPv6 datagram
IPv4 datagram
Network Layer: 4-56
Tunneling and encapsulation
A B Ethernet connects two E F
Ethernet connecting IPv6 routers
two IPv6 routers: IPv6 IPv6 IPv6 IPv6
IPv6 datagram
Link-layer frame The usual: datagram as payload in link-layer frame
IPv4 network A B E F
connecting two
IPv6 routers IPv6 IPv6/v4 IPv6/v4 IPv6
IPv4 network
IPv6 datagram
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-58
Tunneling
A B IPv4 tunnel E F
connecting IPv6 routers
logical view:
IPv6 IPv6/v4 IPv6/v4 IPv6
A B C D E F
physical view:
IPv6 IPv6/v4 IPv4 IPv4 IPv6/v4 IPv6
A-to-B: E-to-F:
B-to-C: B-to-C: B-to-C:
IPv6 IPv6
IPv6 inside IPv6 inside IPv6 inside
IPv4 IPv4 IPv4
Network Layer: 4-59
IPv6: adoption
▪ Google1: ~ 40% of clients access services via IPv6 (2023)
▪ NIST: 1/3 of all US government domains are IPv6 capable
1
[Link]
Network Layer: 4-61
Network layer: “data plane” roadmap
▪ Network layer: overview
• data plane
• control plane
▪ What’s inside a router
• input/output ports, switching
• buffer management
• scheduling ▪ Generalized Forwarding
• Match+action
▪ IP: the Internet Protocol • OpenFlow
• datagram format, addressing
• network address translation (NAT)
• IPv6
Network Layer: 4-62
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
values in arriving
packet header
forwarding: forward based on dest. IP address
0111 1
• generalized forwarding: 2
3
• many header fields can determine action
• many action possible: drop/copy/modify/log packet
forwarding table
(aka: flow table)
Packet + byte
counters
1. Forward packet to port(s)
2. Drop packet
3. Modify fields in header(s)
4. Encapsulate and forward to controller
Firewall:
Switch MAC MAC Eth VLAN VLAN IP IP IP IP TCP TCP
Port src dst type ID Pri Src Dst Prot ToS s-port d-port Action
* * * * * * * * * * * 22 drop
Block (do not forward) all datagrams destined to TCP port 22 (ssh port #)
Router Firewall
• match: longest • match: IP addresses and
destination IP prefix TCP/UDP port numbers
• action: forward out a • action: permit or deny
link
Switch NAT
• match: destination MAC • match: IP address and port
address • action: rewrite address and
• action: forward or flood port
Host h3
Host h2
[Link]
[Link]
application
application
transport
transport
network hop-by-hop (in-network) implementation of reliable data transfer network
data link
data link
physical network
physical
network network network network network link
link link link link link physical
physical physical physical physical physical
The end-end argument
▪ some network functionality (e.g., reliable data transfer, congestion)
can be implemented in network, or at network edge
…
link-level frame in: one large datagram
• different link types, different MTUs out: 3 smaller datagrams
…
• IP header bits used to identify, order
related fragments