Chapter_4_v8.0_r
Chapter_4_v8.0_r
1. Introduction
2. Application layer
3. Transport layer
6. Link layer
Network layer: our goals
understand principles instantiation, implementation
behind network layer in the Internet
services, focusing on data • IP protocol
plane: • NAT, DHCP
• network layer service models
• forwarding versus routing
• how a router works
• addressing
• forwarding
• Internet architecture
Network Layer: 4-4
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
Network Layer: 4-5
Network-layer services and protocols
transport segment from sending to mobile network
routing
Network Layer: 4-7
Network layer: data plane, control plane
data
plane
values in arriving
packet header
0111 1 traditional routing
3
2 algorithms
Remote Controller
control
plane
data
plane
CA
CA CA CA CA
values in arriving
packet header
Internet i. successful
Intserv Guaranteed datagram
yes deliveryyes
to destination
yes yes
(RFC 1633)
ii. timing or order of delivery
Internet iii. bandwidth
Diffserv (RFC 2475)
available
possibleto end-end flow possibly
possibly no
physical layer:
bit-level reception
decentralized switching:
link layer:
using header field values, lookup output port using
e.g., Ethernet
forwarding table in input port memory (“match plus action”)
(chapter 6)
goal: complete input port processing at ‘line speed’
IP packet input port queuing: if datagrams arrive faster than forwarding
0111
rate into switch fabric
header Network Layer: 4-17
Input port functions
lookup,
link
layer forwarding
line switch
protocol fabric
termination
(receive)
queueing
physical layer:
bit-level reception
decentralized switching:
link layer:
using header field values, lookup output port using
e.g., Ethernet
forwarding table in input port memory (“match plus action”)
(chapter 6)
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-18
Destination-based forwarding
R (rate = NR, R
ideally)
...
...
R R
memory
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-27
Output port queuing
datagram This is a really important slide
switch buffer link
layer line
fabric termination
protocol
(rate: 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!
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
27 0 25 0 0 0 0 0 0 0 25 24 0 22 0 0 0 0 0 0 23 22 22 21 27 26 25 24 0 0 0 0
128 0 32 0 0 0 0 0 0 0 32 16 0 4 0 0 0 0 0 0 8 4 2 1 128 64 32 16 0 0 0 0
160 52 15 240
Network Layer: 4-35
IP addressing: introduction
223.1.1.1
223 1 1 1
Network Layer: 4-36
IP addressing: introduction
223.1.1.1
223.1.3.1 223.1.3.2
subnet 223.1.1/24
223.1.1.1
223.1.1.4
where are the
223.1.1.3
subnets?
what are the /24 223.1.9.2 223.1.7.0
subnet 223.1.7/24
subnet 223.1.9/24
subnet addresses?
223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.0
subnet 223.1.2/24
223.1.2.6 subnet 223.1.8/24 223.1.3.27
subnet 223.1.3/24
223.1.1 = 11011111 00000001 00000001 xxxxxxxx
223.1.2 = 11011111 00000001 00000010 xxxxxxxx 223.1.2.1 223.1.2.2
223.1.3 = 11011111 00000001 00000011 xxxxxxxx 223.1.3.1 223.1.3.2
223.1.4 = 11011111 00000001 00000100 xxxxxxxx
• 3 bytes for the network and the 4th byte for the host. • for multicasting.
• Mask: 255.255.255.0 /24 Class E: from 240.0.0.0 to 255.255.255.
• used for experimentation.
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 (x = mask)
subnet host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23
223.1.2.1
223.1.1.2
223.1.1.4 223.1.2.9
223 1 1 0
223.1.3.27
223.1.1.0 = 11011111 00000001 00000001 00000000 223.1.1.3
223.1.2.2
# Leftmost bits = 24
223.1.3.1 223.1.3.2
223.1.1.0/24
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-47
DHCP client-server scenario
Typically, DHCP server will be co-
DHCP server located in router, serving all subnets
223.1.1.1
223.1.2.1
to which router is attached
223.1.2.5
223.1.1.2
223.1.1.4 223.1.2.9
223.1.1.3
223.1.3.27 arriving DHCP client needs
223.1.2.2 address in this network
223.1.3.1 223.1.3.2
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
Network Layer: 4-49
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)
223.1.1.1 DHCP
server 223.1.2.1
223.1.2.5
223.1.1.2
223.1.2.9
223.1.1.4
223.1.1.3 223.1.3.27
223.1.2.2
223.1.3.1 223.1.3.2
Network Layer: 4-50
DHCP: example
DHCP DHCP Connecting laptop will use DHCP
UDP
to get IP address, address of first-
DHCP
DHCP IP
DHCP Eth hop router, address of DNS server.
Phy
DHCP
DHCP REQUEST message encapsulated
in UDP, encapsulated in IP, encapsulated
DHCP DHCP 168.1.1.1 in Ethernet
DHCP UDP
IP
DHCP
Eth
Ethernet frame broadcast (dest:
DHCP router with DHCP
Phy server built into FFFFFFFFFFFF) on LAN, received at router
router running DHCP server
DHCP
IP
Eth
address of first-hop router for client,
Phy name & IP address of DNS server
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
Organization 1 beginning
199.31.0.0/16”
200.23.18.0/23 “or 200.23.18.0/23”
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”
200.23.18.0/23 “or 200.23.18.0/23”
• Private IP addresses are not routable outside the local network (they cannot
be advertised to the public Internet).
• They are widely used on almost all local networks today.
• Private addresses are usually translated with NAT at an edge router to map the
private addresses used on a LAN to the public address space used by the ISP.
Public IP address
95.1.14.77
Private IP addresses
• Private IP addresses are not routable outside the local network (they cannot
be advertised to the public Internet).
• They are widely used on almost all local networks today.
• Private addresses are usually translated with NAT at an edge router to map the
private addresses used on a LAN to the public address space used by the ISP. Network Layer: 4-61
NAT: network address translation
NAT: all devices in local network share just one IPv4 address as
far as outside world is concerned
rest of local network (e.g., home
Internet network) 10.0.0/24
10.0.0.1
138.76.29.7 10.0.0.4
10.0.0.2
10.0.0.3
all datagrams leaving local network have datagrams with source or destination in
same source NAT IP address: 138.76.29.7, this network have 10.0.0/24 address for
but different source port numbers source, destination (as usual)
Network Layer: 4-62
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)
https://www.google.com/intl
/en/ipv6/statistics.html
Network Layer: 4-69
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!
• think of application-level changes in last 25 years: WWW, social
media, streaming media, gaming, telepresence, …
• Why?
1
https://www.google.com/intl/en/ipv6/statistics.html
Network Layer: 4-70
Revision
Additional IP addressing problems
x xx xx xxx
27 2 6 2 5 2 4 2 3 2 2 2 1 2 0
a.b.c.d/x Number of hosts = 2 32-x
128 64 32 16 8 4 2 1 =255
e) 192.168.5.256 ✗ error
a) 172.16.255.255 ✗ broadcast
b) 172.16.0.255 ✓
✓
d) 172.16.254.255 B: ???
✗ subnet address
e) 172.16.0.0
e) 192.168.5.50 Broadcast
11000000 . 10101000 . 00000101 . 0011 1111
192.168.5.63/28
e) 192.168.5.50 Broadcast
11000000 . 10101000 . 00000101 . 001111 11
192.168.5.63/30
Forwarding Table Preparation for answer 1st step: convert to binary (easy way)
16.16.0.0/16 1 1
00010000 00010000
16.16.0.0/20 2 00010000 00010000 0000 xxxx 2
64.1.0.0/20 3 01000000 00000001 0000 xxxx 3
64.1.1.0/24 4 01000000 00000001 0000 0001 4
16 /8 5 00010000 5