CMPT 471: Networking II�Network Layer: Overview��Mohamed Hefeeda
An IP Packet Journey
2
Alice
VAN
EDM
REG
WIN
TOR
MON
HAL
An IP Packet Journey
3
Alice
VAN
EDM
REG
WIN
TOR
MON
HAL
An IP Packet Journey
4
src: Alice
dst: SFU
data
VAN
EDM
REG
WIN
TOR
MON
HAL
An IP Packet Journey
5
src: Alice
dst: SFU
data
VAN
EDM
REG
WIN
TOR
MON
HAL
An IP Packet Journey
6
VAN
EDM
REG
WIN
TOR
MON
HAL
src: Alice
dst: SFU
data
An IP Packet Journey
7
VAN
EDM
REG
WIN
TOR
MON
HAL
src: Alice
dst: SFU
data
An IP Packet Journey
8
VAN
EDM
REG
WIN
TOR
MON
HAL
src: Alice
dst: SFU
data
What happens between two routers
9
Data Plane
VAN
EDM
Data Plane
IF 1
IF 2
IF 3
IF 4
IF 1
IF 2
IF 3
IF 4
src: Alice
dst: SFU
data
SFU IF 2
Alice IF 4
DST OUT_IF
EDM Forwarding Table
Redundancy
What happens between two routers
10
Data Plane
VAN
EDM
Data Plane
IF 1
IF 2
IF 3
IF 4
IF 1
IF 2
IF 3
IF 4
src: Alice
dst: SFU
data
SFU IF 1
Alice IF 3
DST OUT_IF
VAN Forwarding Table
What happens between two routers
11
Data Plane
VAN
EDM
Data Plane
src: Alice
dst: SFU
data
IF 1
IF 2
IF 3
IF 4
IF 1
IF 2
IF 3
IF 4
What happens between two routers
12
In the current Internet, forwarding happens by:
But, who calculates the forwarding tables?
src: Alice
dst: SFU
data
…
Forwarding Table
IP Packet
Match
This is called Packet Forwarding
Routers Have “Brains”
13
Control Plane
Control Plane
Data Plane
Data Plane
This brain is called the Control Plane
VAN
EDM
Routers Have “Brains”
14
Control Plane
Control Plane
The control plane runs a routing algorithm to:
VAN
EDM
SFU IF 1
Alice IF 3
DST OUT_IF
VAN Forwarding Table
SFU IF 2
Alice IF 4
DST OUT_IF
EDM Forwarding Table
Routing algorithm
Routing algorithm
Control Plane: Two Approaches
15
Control Plane
Control Plane
VAN
EDM
SFU IF 1
Alice IF 3
DST OUT_IF
VAN Forwarding Table
SFU IF 2
Alice IF 4
DST OUT_IF
EDM Forwarding Table
Routing algorithm
Routing algorithm
Control Plane
REG
SFU IF 2
Alice IF 4
DST OUT_IF
REG Forwarding Table
Routing algorithm
Distributed Approach: routers exchange messages with each other to calculate tables
…
…
Control Plane: Two Approaches
16
Agent
Agent
VAN
SFU IF 1
Alice IF 3
DST OUT_IF
VAN Forwarding Table
SFU IF 2
Alice IF 4
DST OUT_IF
EDM Forwarding Table
Agent
REG
SFU IF 2
Alice IF 4
DST OUT_IF
REG Forwarding Table
Centralized Approach: routers exchange messages with an external software
…
…
Control Plane
Forwarding vs Routing
17
| Forwarding | Routing |
Plane | Data plane | Control plane |
Objective | Move pkts to output ports | Compute network paths |
Scope | Local to routers | Network level |
Implementation | Hardware (often) | Software (often) |
Timescale | nanoseconds | milliseconds – seconds |
Network layer (or routers) has two functions:
Forwarding vs Routing
18
| Forwarding | Routing |
Plane | Data plane | Control plane |
Objective | Move pkts to output ports | Compute network paths |
Scope | Local to routers | Network level |
Implementation | Hardware (often) | Software (often) |
Timescale | nanoseconds | milliseconds – seconds |
Network layer (or routers) has two functions:
Network Layer: Overview
19
forwarding
table
routing protocols
IP protocol
ICMP protocol
transport layer: TCP, UDP
link layer
physical layer
network
layer
IP is the waist of the “hourglass”
20
🡪 No need to update routers and hosts every time we have new: service, device, or link technology, …!
HTTP, FTP, DNS, SMTP, …
TCP, UDP, …
IP
Copper, fiber, radio
Ethernet, PPP, …
CSMA, SONET, …
At every router/host
IPv4 Datagram Format
21
Fragmentation
Header & data
Addressing
E.g., TCP segment
ICMP 0x01
TCP 0x06
UDP 0x11
IPv6 0x29
Size: 20 bytes (min)
IPv4 Fragmentation
22
IPv4 Fragmentation
23
Router A
Router B
MTU = 4000
MTU = 1500
4000 bytes
1500 bytes
1500 bytes
1040 bytes
Fragment 1
Fragment 2
Fragment 3
4000 bytes
IPv4 Fragmentation
24
3980 B
20 B
1480 bytes
20 B
Fragment 1
1480 bytes
20 B
Fragment 2
1020 bytes
20 B
Fragment 3
IPv4 Fragmentation
25
Time-to-live (TTL)
26
Often used in OS Fingerprinting tools
Loops!
Time-to-live (TTL)
27
IPv4 Addressing
An IP addresses is associated with each interface
28
IPv4 Addressing
29
223.1.1.1 = 11011111 00000001 00000001 00000001
223
1
1
1
.
.
.
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4
223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2
223.1.3.1
223.1.3.27
IPv4 Addressing: Subnets
30
223.1.3.X
223.1.2.X
223.1.1.X
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4
223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2
223.1.3.1
223.1.3.27
subnet
Subnets
31
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4
223.1.2.9
223.1.2.2
223.1.2.1
223.1.3.2
223.1.3.1
223.1.3.27
Subnet
Subnets
32
223.1.9.2
223.1.9.1
223.1.7.0
223.1.7.1
223.1.8.0
223.1.8.1
223.1.2.6
223.1.2.2
223.1.2.1
223.1.3.2
223.1.3.1
223.1.3.27
223.1.1.1
223.1.1.2
223.1.1.3
223.1.1.4
IPv4 Addressing: CIDR
33
11001000 00010111 00010000 00000000
200.23.16.0/24
Subnet part
24 bits
Host part
32 - 24 = 8 bits
IPv4 Addressing: CIDR
34
11001000.00010111.00010000. 00000000 200.23.16.0
200.23.16.0/24
/24 bits means that we have 8 bits to use for hosts
Subnet part (Prefix) Host part (Suffix) IP address
11001000.00010111.00010000. 00000001 200.23.16.1
11001000.00010111.00010000. 00000010 200.23.16.2
11001000.00010111.00010000. 11111110 200.23.16.254
11001000.00010111.00010000. 11111111 200.23.16.255
…
IPv4 Addressing: CIDR
35
11001000.00010111.00010000. 00000000 200.23.16.0
Subnet part (Prefix) Host part (Suffix) IP address
11001000.00010111.00010000. 11111111 200.23.16.255
In practice, the first and last IP addresses of a prefix are reserved
Identifies the network
(host part is all 0’s)
Identifies the broadcast address
(host part is all 1’s)
🡪 /24 can support up to 254 (=256-2) hosts
How to get an IP address?
How does a host get IP address?
36
How to get an IP address?
How does a network get IP address space?
37
How to get an IP address?
38
ISP A block 11001000 00010111 00010000 00000000 200.23.16.0/20
Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23
Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23
Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23
…
Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23
Example: Given an ISP network called A with address 200.23.16.0/20.
How can it allocate IP addresses for 8 customer networks?
Use additional 3 bits to allocate addresses for the 8 customer networks.
Hierarchical IP Addressing
39
200.23.16.0/20
200.23.16.0/23
200.23.18.0/23
200.23.20.0/23
200.23.30.0/23
…
This is ISP A
The eight customer networks
200.23.18.0/26
200.23.18.64/26
200.23.18.192/26
200.23.19.0/26
…
Other eight customer networks of 200.23.18.0/23
200.23.0.0/16
ISP A is a customer of other provider
Hierarchical IP Addressing
40
“Send me anything
with addresses
beginning
200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
ISP A
Organization 0
Organization 7
Internet
Organization 1
200.23.20.0/23
Organization 2
.
.
.
.
.
.
200.23.16.0/20
ISP B
“Send me anything
with addresses
beginning
199.31.0.0/16”
199.31.0.0/16
Hierarchical IP Addressing
41
“Send me anything
with addresses
beginning
200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
ISP A
Organization 0
Organization 7
Internet
Organization 1
ISP B
“Send me anything
with addresses
beginning
199.31.0.0/16
or 200.23.18.0/23”
200.23.20.0/23
Organization 2
.
.
.
.
.
.
200.23.16.0/20
199.31.0.0/16
Organization 1 moves to ISP B
Hierarchical IP Addressing
42
200.23.18.0/23 IF2
DST OUT_IF
Forwarding Table
200.23.16.0/20 IF1
199.31.0.0/16 IF2
src: Alice
dst: 200.23.16.5
data
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
ISP A
Organization 0
Organization 7
Organization 1
ISP B
200.23.20.0/23
Organization 2
.
.
.
.
.
.
200.23.16.0/20
199.31.0.0/16
IF 1
IF 2
Longest prefix match
Hierarchical IP Addressing: Summary
43
IPv6
44
IPv6 Datagram Format
45
Priority/Traffic Class: identify priority among datagrams in flow
Flow Label: identify datagrams in same “flow”
Next header: identify upper layer protocol for data
Other Changes
46
IPv4 🡪 IPv6
47
IPv4 source, dst addr
IPv4 header fields
IPv4 datagram
IPv6 datagram
UDP/TCP payload
IPv6 source dest addr
IPv6 header fields
IPv4 🡪 IPv6: Tunneling
48
IPv4 tunnel
connecting IPv6 routers
A
B
E
F
IPv6
IPv6
IPv6
IPv6
Logical View
Physical View
A
B
E
F
IPv6
IPv6
IPv6
IPv6
C
D
IPv4
IPv4
IPv6 Deployment
49
Percentage of users accessing Google using IPv6: Source
Network Layer--Data Plane: Summary
50