introduction to computer networking guy leduc chapter 4 ... · networking guy leduc chapter 4 ......
TRANSCRIPT
1
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-1
Introduction to Computer Networking
Guy Leduc
Chapter 4 Network Layer: The Data Plane
Computer Networking: A Top Down Approach, 7th edition. Jim Kurose, Keith RossAddison-Wesley, April 2016.
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-2
Chapter 4: Network Layer Data Plane
Chapter goals: ❒ understand principles behind network layer
services:❍ network layer service models❍ addressing❍ forwarding versus routing❍ how a router works
❒ instantiation, implementation in the Internet
2
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-3
Chapter 4: Network Layer Data Plane
❒ 4.1 Overview of Network layer❍ Data plane❍ Control plane
❒ 4.2 IP: Internet Protocol❍ IPv4 addressing and forwarding❍ Network Address Translation (NAT)❍ Datagram format❍ Fragmentation❍ IPv6
❒ 4.3 What’s inside a router
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-4
Network layer❒ transport segment from
sending to receiving host ❒ on sending side
encapsulates segments into datagrams
❒ on receiving side, delivers segments to transport layer
❒ network layer protocols in every host, router
❒ router examines header fields in all IP datagrams passing through it
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
networkdata linkphysical network
data linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysical
networkdata linkphysicalnetwork
data linkphysical
3
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-5
Two Key Network-Layer Functions
❒ forwarding: move packets from router’s input to appropriate router output
❒ routing: determine route taken by packets from source to destination❍ routing algorithms
analogy:
❒ routing: process of planning trip from source to destination
❒ forwarding: process of getting through single interchange
Network layer: data plane, control plane
Data plane
❒ local, per-router function❒ determines how datagram
arriving on router input port is forwarded to router output port
❒ forwarding function
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:
implemented in routers• software-defined networking
(SDN): implemented in (remote) servers
• not studied in this course
1
23
0111
values in arriving packet header
4-6Network Layer: Data Plane© From Computer Networking, by Kurose&Ross
4
Per-router control plane
RoutingAlgorithm
Individual routing algorithm components in each and every router interact in the control plane
dataplane
controlplane
4.1 • OVERVIEW OF NETWORK LAYER 309
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!
Values in arrivingpacket’s header
1
23
Local forwardingtable
header
0100011001111001
1101
3221
output
Control plane
Data plane
Routing algorithm
Figure 4.2 ♦ Routing algorithms determine values in forward tables
M04_KURO4140_07_SE_C04.indd 309 11/02/16 3:14 PM
4-7Network Layer: Data Plane
1
2
0111
values in arriving packet header
3
© From Computer Networking, by Kurose&Ross
dataplane
controlplane
Logically centralized control planeA distinct (typically remote) controller interacts with local control agents (CAs)
Remote Controller
CA
CA CA CA CA
4-8Network Layer: Data Plane
1
2
0111
3
values in arriving packet header
© From Computer Networking, by Kurose&Ross
5
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-9
Network service modelQ: 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 throughput to flow
❒ restrictions on changes in inter-packet spacing
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-10
Network layer service models:
NetworkArchitecture
Internet
ATM
ATM
ATM
ATM
ServiceModel
best effort
CBR
VBR
ABR
UBR
Bandwidth
none
constantrateguaranteedrateguaranteed minimumnone
Loss
no
yes
yes
no
no
Order
no
yes
yes
yes
yes
Timing
no
yes
yes
no
no
Congestionfeedback
no (inferredvia loss)nocongestionnocongestionyes
no
Guarantees ?
6
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-11
Chapter 4: Network Layer Data Plane
❒ 4. 1 Overview of Network layer❍ Data plane❍ Control plane
❒ 4.2 IP: Internet Protocol❍ IPv4 addressing and forwarding❍ Network Address Translation (NAT)❍ Datagram format❍ Fragmentation❍ IPv6
❒ 4.3 What’s inside a router
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-12
The Internet Network layer
forwardingtable
Host, router network layer functions (data and control):
Routing protocols• path selection• RIP, OSPF, BGP
IP protocol• addressing conventions• datagram format• packet handling conventions
ICMP protocol• error reporting• router “signaling”
Transport layer: TCP, UDP
Link layer
physical layer
Networklayer
7
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-13
Chapter 4: Network Layer
❒ 4.1 Overview of Network layer❍ Data plane❍ Control plane
❒ 4.2 IP: Internet Protocol❍ IPv4 addressing and forwarding❍ Network Address Translation (NAT)❍ Datagram format❍ Fragmentation❍ IPv6
❒ 4.3 What’s inside a router
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-14
IPv4 addressing: introduction❒ IPv4 address: 32-bit
identifier for host, router interface
❒ interface: connection between host/router and physical link❍ routers typically have
multiple interfaces❍ host typically has one or
two interfaces (e.g., wired Ethernet, wireless 802.11)
❒ IP addresses associated with each interface
223.1.1.1 = 11011111 00000001 00000001 00000001
223 1 11
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.2223.1.3.1
223.1.3.27
8
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-15
IPv4 addressing: introduction
Q: how are interfaces actually connected?A: we’ll learn about thatin chapter 6 (and in next course)
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.2223.1.3.1
223.1.3.27
A: wired Ethernet interfaces connected by Ethernet switches
A: wireless WiFi interfaces connected by WiFi base station
For now: don’t need to worry about how one interface is connected to another (with no intervening router)
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-16
Subnets❒ IP address:
❍ subnet part: high order bits
❍ host part: low order bits❒ What’s a subnet?
❍ device interfaces with same subnet part of IP address, and
❍ can physically reach each other without intervening router
network consisting of 3 subnets
223.1.1.1
223.1.1.3
223.1.1.4 223.1.2.9
223.1.3.2223.1.3.1
subnet
223.1.1.2
223.1.3.27223.1.2.2
223.1.2.1
9
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-17
Subnets
Recipe❒ To determine the
subnets, detach each interface from its host or router, creating islands of isolated networks
❒ Each isolated network is called a subnet
In this example, the subnet part is 24 bit-long.Notation: /24
223.1.1.0/24223.1.2.0/24
223.1.3.0/24
223.1.1.1
223.1.1.3
223.1.1.4 223.1.2.9
223.1.3.2223.1.3.1
subnet
223.1.1.2
223.1.3.27223.1.2.2
223.1.2.1
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-18
SubnetsHow many? 223.1.1.1
223.1.1.3
223.1.1.4
223.1.2.2223.1.2.1
223.1.2.6
223.1.3.2223.1.3.1
223.1.3.27
223.1.1.2
223.1.7.0
223.1.7.1223.1.8.0223.1.8.1
223.1.9.1
223.1.9.2
10
Deprecated Classful addresses
Network Layer: Data Plane 4-19
In the past the network portions were constrained to be 8, 16, or 24 bits in length,known as class A, B, and C. It was not very flexible: class C was too small for many organizations, leading to class B rapid depletion. However class B was too large, thus leading to a poor utilization of the assigned address space
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-20
IP addressing: CIDRCIDR: Classless InterDomain Routing
❍ subnet portion of address of arbitrary length❍ address format: a.b.c.d/x, where x is # bits in subnet
portion of address
11001000 00010111 00010000 00000000
subnetpart
hostpart
200.23.16.0/23
Example with x = 23:
11
Special IP addresses
Network Layer: Data Plane 4-21
e.g. « Localhost » maps to 127.0.0.1
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-22
IP addresses: how to get one?
Q: How does host get IP address?
❒ hard-coded by system admin in a file❍ Wintel: control-panel->network->configuration->tcp/ip->properties❍ UNIX: /etc/rc.config
❒ DHCP: Dynamic Host Configuration Protocol: dynamically get address from a server❍ “plug-and-play”
12
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-23
DHCP: Dynamic Host Configuration Protocol
Goal: allow host to dynamically obtain its 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 want to join 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
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-24
DHCP client-server scenario
223.1.1.0/24
223.1.2.0/24
223.1.3.0/24
223.1.1.1
223.1.1.3
223.1.1.4 223.1.2.9
223.1.3.2223.1.3.1
223.1.1.2
223.1.3.27223.1.2.2
223.1.2.1
DHCPserver
arriving DHCPclient needs address in thisnetwork
13
DHCP server: 223.1.2.5 arriving client
DHCP offer
DHCP ACK
DHCP client-server scenarioDHCP discover
Broadcast: is there a DHCP server out there?
Broadcast: I’m a DHCP server! Here’s an IP address you can use
DHCP request
Broadcast: OK. I’ll take that IP address!
Broadcast: OK. You’ve got that IP address!
4-25Network Layer: Data Plane
Maybe several DHCP servers in subnet
Has no IP address
Doesn’t know IP address of DHCP server
DHCP uses UDPWhy?
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-26
DHCP client-server scenario (2)
DHCP server: 223.1.2.5 arriving client
DHCP discover
src : 0.0.0.0, 68 dest.: 255.255.255.255,67yiaddr: 0.0.0.0transaction ID: 654
DHCP offersrc: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddr: 223.1.2.4transaction ID: 654lifetime: 3600 secs
DHCP requestsrc: 0.0.0.0, 68 dest:: 255.255.255.255, 67yiaddr: 223.1.2.4transaction ID: 655lifetime: 3600 secs
DHCP ACKsrc: 223.1.2.5, 67 dest: 255.255.255.255, 68yiaddr: 223.1.2.4transaction ID: 655lifetime: 3600 secs
0.0.0.0 = myself
255.255.255.255 = broadcast on this subnet
yiaddr = yielded address
14
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-27
DHCP: more than IP address
DHCP can return more than just allocated IP address on subnet:❍ address of first-hop router for client❍ name and IP address of default DNS server❍ network mask (indicating network versus host
portion of address)❍ …
DHCP: Wireshark output
Message type: Boot Reply (2) Hardware type: Ethernet Hardware address length: 6 Hops: 0 Transaction ID: 0x6b3a11b7 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."
reply
Message type: Boot Request (1) Hardware type: Ethernet Hardware address length: 6 Hops: 0 Transaction ID: 0x6b3a11b7 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 ……
request
4-28Network Layer: Data Plane© From Computer Networking, by Kurose&Ross
15
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-29
! connecting laptop needs its IP address, addr of first-hop router, addr of DNS server: use DHCP
router with DHCP server built into router
! DHCP request encapsulated in UDP, encapsulated in IP, encapsulated in 802.1 Ethernet
! Ethernet frame broadcast on LAN, received at router running DHCP server
! Ethernet demuxed to IP demuxed, UDP demuxed to DHCP
168.1.1.1
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCPDHCP
DHCP: example
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-30
! DHCP server formulates DHCP ACK containing client’s IP address, IP address of first-hop router for client, name & IP address of DNS server
! encapsulation of DHCP server, frame forwarded to client, demuxing up to DHCP at client
DHCP: example
router with DHCP server built into router
DHCP
DHCP
DHCP
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCPUDP
IPEthPhy
DHCP
DHCP
DHCP
DHCP
! client now knows its IP address, name and IP address of DNS server, IP address of its first-hop router
16
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-31
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, so-called Provider Assigned (PA) addresses
ISP's 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
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-32
Hierarchical addressing: route aggregation
“Send me anythingwith addresses beginning 200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
Organization 0
Organization 7Internet
Organization 1
“Send me anythingwith addresses beginning 199.31.0.0/16”
200.23.20.0/23Organization 2
...
...
Hierarchical addressing allows efficient advertisement of routing information:
Fly-By-Night-ISP200.23.16.0/20
ISPs-R-Us199.31.0.0/16
17
Network Layer: Data Plane 4-33
Provider Independent (PI) addresses – Multihoming
Alternative: Organization 8 gets a Provider Independent (PI) range of addresses
Organization 8 may have multiple providers (so-called multihoming)
“Send me anythingwith addresses beginning 200.23.16.0/20or 100.56.10.0/23”
100.56.10.0/23
Fly-By-Night-ISP200.23.16.0/20
InternetOrganization 8
ISPs-R-Us199.31.0.0/16
“Send me anythingwith addresses beginning 199.31.0.0/16or 100.56.10.0/23”
“Send me anythingwith addresses beginning 100.56.10.0/23”
“Send me anythingwith addresses beginning 100.56.10.0/23”
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-34
IP addressing: the last word...
Q: How does an ISP get block of addresses? Or how does an organization get a PI address block?
A: ICANN: Internet Corporation for Assigned Names and Numbers, http://www.icann.org/
❍ allocates addresses❍ manages DNS❍ assigns domain names, resolves disputes
18
IP forwarding table❒ Assume forwarding is only based on the destination addr❒ There are 232 (i.e., 4 billion) IPv4 addresses❒ Clearly all addresses in the same subnet can be
aggregated into a single forwarding entry in tables❍ Saves space in table❍ Makes address look-up easier too
Network Layer: Data Plane 4-35
Destination Address Range (Subnet) 223.1.1.0 /24
223.1.2.0 /24
223.1.3.0 /24
…
Outgoing link interface0
12
…
More aggregation is possible in forwarding table
Network Layer: Data Plane 4-36
“Send me anythingwith addresses beginning 200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
Organization 0
Organization 7Internet
Organization 1
200.23.20.0/23Organization 2
...
...Fly-By-Night-ISP200.23.16.0/20
Here a unique forwarding entry is enough to reach all 8 organizations,namely 200.23.16.0/20
In Fly-By-Night-ISP, a forwarding entry per organization is still needed
19
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-37
Hierarchical addressing: more specific routes
Assume - Fly-By-Night-ISP acquires ISPs-R-Us- Organization 1 now connects through its subsidiary ISPs-R-Us- Organization 1 keeps its address range (easier management)
“Send me anythingwith addresses beginning 200.23.16.0/20”
200.23.16.0/23
200.23.18.0/23
200.23.30.0/23
Organization 0
Organization 7Internet
Organization 1
“Send me anythingwith addresses beginning 199.31.0.0/16or 200.23.18.0/23”
200.23.20.0/23Organization 2
...
...Fly-By-Night-ISP200.23.16.0/20
ISPs-R-Us199.31.0.0/16
Issue?
IP forwarding table – Overlap❒ In larger Internet, routers will
have overlapping entries in their table
❒ Overlap could be avoided by splitting 200.23.16.0 /20 into 7 blocks of size /23❍ but leads to larger tables
Network Layer: Data Plane 4-38
Destination Address Range200.23.16.0 /20
200.23.18.0 /23
199.31.0.0 /16
…
Outgoing link interface0
12
…
“Send me anythingwith addresses beginning 200.23.16.0/20”
Internet
“Send me anythingwith addresses beginning 199.31.0.0/16or 200.23.18.0/23”
{ overlap
20
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-39
Longest prefix matching
Destination Address Range 11001000 00010111 00010*** ********
11001000 00010111 00011000 ********
11001000 00010111 00011*** ******** ******** ******** ******** ********
DA: 11001000 00010111 00011000 10101010
examples:DA: 11001000 00010111 00010110 10100001 which interface?
which interface?
when looking for forwarding table entry for given destination address, use longest address prefix that matches destination address.
longest prefix matching
Link interface0
12
3default =
{ overlap
Network Layer: Data Plane 4-40
Longest prefix match - Another ex.❒ Suppose a network has the address range 139.165.0.0/16❒ It is first split into 139.165.0.0/17 and 139.165.128.0/17❒ Then part of 139.165.128.0/17 (namely 139.165.128.0/20) is
reallocated elsewhere
139.165.128/17
139.165.0/17
139.165.128/20
R1
R2
Forwarding table in R1:139.165.0/17: forward to port 1139.165.128/17: forward to port 2139.165.128/20: forward to port 1
21
Destination address 139.165.128.0 matches entries 2 and 3.Longest prefix match gives entry 3!
21
Longest prefix matching❒ prefix matching: makes sense if entries with same prefix
are in same area, leads to smaller forwarding tables❍ one entry per subnet, or one per aggregation of subnets sharing
some common prefix❍ granularity: address block size is a power of 2
❒ longest prefix matching: ❍ allows even more aggregation, at the price of a more complex
matching (look-up) procedure❒ performance issue:
❍ matching often performed in hardware using Ternary Content Addressable Memories (TCAMs)
❍ Content addressable: present destination address to TCAM: retrieve action in one clock cycle, regardless of table size
• Cisco Catalyst: stores up to ~1M forwarding entries in TCAM❍ efficient software implementations use tries
4-41Network Layer: Data Plane
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-42
Chapter 4: Network Layer
❒ 4. 1 Overview of Network layer❍ Data plane❍ Control plane
❒ 4.2 IP: Internet Protocol❍ IPv4 addressing and forwarding❍ Network Address Translation (NAT)❍ Datagram format❍ Fragmentation❍ IPv6
❒ 4.3 What’s inside a router
22
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-43
NAT: network address translation
10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4
138.76.29.7
local network(e.g., home network)
10.0.0/24
rest ofInternet
Datagrams with source or destination in this networkhave 10.0.0/24 address for source, destination (as usual)
All datagrams leaving local network have same single
source NAT IP address: 138.76.29.7, different source port numbers
Private IP addresses (RFC 1918): 10.0.0.0/8 = 10/8 172.16.0.0/12 = 172.16/12 192.168.0.0/16 = 192.168/16
Fact: Not enough IPv4 addresses to assign a block to every SOHO (Small Office Home Office)
Solution: NAT
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-44
NAT: Network Address Translation
❒ Motivation: local network uses just one public (i.e., routable) IP address as far as outside world is concerned:❍ range of addresses not needed from ISP: just one IP
address for all devices❍ can change private addresses of devices in local
network without notifying outside world❍ can change ISP without changing private addresses of
devices in local network❍ devices inside local net not explicitly addressable, visible
by outside world (a security plus)
23
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-45
NAT: Network Address TranslationImplementation: NAT router must:
❍ 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 dest fields of every incoming datagram with corresponding (source IP address, port #) stored in NAT table
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-46
10.0.0.1
10.0.0.2
10.0.0.3
S: 10.0.0.1, 3345D: 128.119.40.186, 80
110.0.0.4
138.76.29.7
1: host 10.0.0.1 sends datagram to 128.119.40.186, 80
NAT translation tableWAN side addr LAN side addr138.76.29.7, 5001 10.0.0.1, 3345…… ……
S: 128.119.40.186, 80 D: 10.0.0.1, 3345 4
S: 138.76.29.7, 5001D: 128.119.40.186, 802
2: NAT routerchanges datagramsource addr from10.0.0.1, 3345 to138.76.29.7, 5001,updates table
S: 128.119.40.186, 80 D: 138.76.29.7, 5001 3
3: reply arrives dest. address: 138.76.29.7, 5001
4: NAT routerchanges datagramdest addr from138.76.29.7, 5001 to 10.0.0.1, 3345
NAT: network address translation
24
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-47
NAT: Network Address Translation❒ possible to restrict incoming traffic even more
❍ e.g. only from contacted outside host, by adding fields in WAN side of table
❒ 16-bit port-number field: ❍ 60,000 simultaneous connections with a single LAN-side address!
❒ NAT is controversial:❍ routers should only process up to layer 3❍ address shortage should instead be solved by IPv6❍ violates end-to-end argument
• NAT deployment must be taken into account by app designers, e.g., P2P applications
❒ NAT traversal: what if client wants to connect to server behind NAT?
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-48
NAT traversal problem❒ client wants to connect to
server with address 10.0.0.1❍ server address 10.0.0.1 local to
LAN (client can’t use it as destination address)
❍ only one externally visible NATed address: 138.76.29.7
❒ solution 1: statically configure NAT to forward incoming connection requests at given port to server❍ e.g., (138.76.29.7, port 2500)
always forwarded to 10.0.0.1 port 25000
10.0.0.1
10.0.0.4
NAT router
138.76.29.7
client?
25
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-49
NAT traversal problem❒ solution 2: Universal Plug and
Play (UPnP) Internet Gateway Device (IGD) Protocol. Allows NATed host to:o learn public IP address
(138.76.29.7)o add/remove port mappings
(with lease times)
i.e., automate static NAT port map configuration
10.0.0.1
NAT router
IGD
138.76.29.7
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-50
NAT traversal problem❒ solution 3: relaying (used in Skype)
❍ NATed server establishes connection to relay❍ external client connects to relay❍ relay bridges packets between two connections
138.76.29.7client
1. connection torelay initiatedby NATed host
2. connection torelay initiatedby client
3. relaying established
NAT router
10.0.0.1
26
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-51
Chapter 4: Network Layer
❒ 4. 1 Overview of Network layer❍ Data plane❍ Control plane
❒ 4.2 IP: Internet Protocol❍ IPv4 addressing and forwarding❍ Network Address Translation (NAT)❍ Datagram format❍ Fragmentation❍ IPv6
❒ 4.3 What’s inside a router
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-52
IPv4 datagram format
ver length
32 bits
data (variable length,typically a TCP
or UDP segment)
16-bit identifierheader
checksumtime to
live32 bit source IP address
IP protocol versionnumber
header length (bytes)
max numberremaining hops
(decremented at each router)
forfragmentation/reassembly
total datagramlength (bytes)
upper layer protocolto deliver payload to
head.len
type ofservice
“type” of data flgs fragment offset
upper layer
32 bit destination IP address
Options (if any) E.g. timestamp,record routetaken, specifylist of routers to visit
how much overhead with TCP?
❒ 20 bytes of TCP❒ 20 bytes of IP❒ = 40 bytes + app
layer overhead
27
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-53
Chapter 4: Network Layer
❒ 4. 1 Overview of Network layer❍ Data plane❍ Control plane
❒ 4.2 IP: Internet Protocol❍ IPv4 addressing and forwarding❍ Network Address Translation (NAT)❍ Datagram format❍ Fragmentation❍ IPv6
❒ 4.3 What’s inside a router
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-54
IP fragmentation, reassembly❒ network links have MTU (max
transfer unit) - 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 final
destination (why?)• non transparent
❍ note: fragments could also be fragmented again
fragmentation: in: one large datagramout: 3 smaller datagrams
reassembly
IP header bits needed to identify and reorder related fragments
28
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-55
IP fragmentation, reassembly (2)ID=x
offset=0
fragflag=0
length=4000
ID=x
offset=0
fragflag=1
length=1500
ID=x
offset=185
fragflag=1
length=1500
ID=x
offset=370
fragflag=0
length=1040
One large datagram becomesseveral smaller datagrams
Example❒ 4000 byte datagram❒ MTU = 1500 bytes
1480 bytes in data field
offset =1480/8
offset = 0 means it is the first fragmentfragflag = 0 means it is the last fragmentfragflag of last fragment is a copy of fragflag before fragmentation
Network Layer: Data Plane 4-56
❒ To avoid fragmentation, the source must know the minimal MTU of the path
❒ Path MTU discovery (trial and error)❍ Send an IP packet with the "Don't fragment flag" set❍ Routers may be forced to discard the packet❍ If the source receives an ICMP error message (see later), it tries
again with a size equal to the MTU indicated in the ICMP packet❒ Drawback
❍ Relies on routers properly returning ICMP error message❍ Also, congestion could discard ICMP messages❍ Also, the route may change afterwards❍ So fragmentation can happen anyway
Avoiding fragmentation
29
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-57
Chapter 4: Network Layer
❒ 4.1 Overview of Network layer❍ Data plane❍ Control plane
❒ 4.2 IP: Internet Protocol❍ IPv4 addressing and forwarding❍ Network Address Translation (NAT)❍ Datagram format❍ Fragmentation❍ IPv6
❒ 4.3 What’s inside a router
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-58
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
❒ No change in higher and lower protocol layers
❒ IPv6 datagram format: ❍ fixed-length 40-byte header❍ no fragmentation allowed in routers
30
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-59
IPv6 datagram formatPriority: identify priority among datagrams in flowFlow Label: identify datagrams in same “flow” (but concept of “flow” not well defined)Next header: allows to daisy chain several extension headers and finally identify upper layer protocol for data
data
destination address(128 bits)
source address(128 bits)
payload len next hdr hop limitflow labelpriver
32 bits
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-60
Other changes from IPv4
❒ (Header) 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
31
Network Layer: Data Plane 4-61
IPv6 addresses❒ 128 bits written as x:x:x:x:x:x:x:x
❍ where x is a 16-bit hexadecimal field❍ e.g., 2001:0000:130F:0000:0000:09C0:876A:130B
❒ Leading zeros in a field are optional:❍ 2001:0:130F:0:0:9C0:876A:130B
❒ Successive fields of 0 are represented as ::but only once in an address:❍ 2001:0:130F::9C0:876A:130B is allowed❍ 2001::130F::9C0:876A:130B is not allowed❍ FF01:0:0:0:0:0:0:1 can be written as FF01::1❍ 0:0:0:0:0:0:0:1 can be written as ::1 (loopback address)❍ 0:0:0:0:0:0:0:0 can be written as :: (this host)
Network Layer: Data Plane 4-62
IPv6 addresses
❒ Hierarchical addresses to allow for aggregation❍ Prefix of 64 bits identifies a site (initial part, typically 48 bits, e.g.
given by ISP)❍ Suffix of 64 bits identifies an interface in this site
• May be assigned in several ways: e.g. DHCPv6, or based on interface “layer 2” address (see chapter 6), or pseudo-random
• Pseudo-random by default in many operating systems
❒ Link-local addresses❍ Not routable, have a scope limited to a link❍ Suffix derived from 48-bit interface “layer 2” address❍ Prefix is FE80:0:0:0
32
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-63
Transition from IPv4 to IPv6
❒ Not all routers can be upgraded simultaneously❍ no “flag days”❍ how will the network operate with mixed IPv4 and IPv6
routers? ❒ One solution is Tunneling: IPv6 carried as payload
in IPv4 datagram among IPv4 routers
IPv4 source, dest addr IPv4 header fields
IPv4 datagramIPv6 datagram
IPv4 payload
UDP/TCP payloadIPv6 source dest addr
IPv6 header fields
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-64
Tunneling
physical view:IPv4 IPv4
A B
IPv6 IPv6
E
IPv6 IPv6
FC D
logical view:IPv4 tunnel
connecting IPv6 routers E
IPv6 IPv6
FA B
IPv6 IPv6
33
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-65
flow: Xsrc: Adest: F
data
A-to-B:IPv6
Flow: XSrc: ADest: F
data
src:Bdest: E
B-to-C:IPv6 inside
IPv4
E-to-F:IPv6
flow: Xsrc: Adest: F
data
D-to-E:IPv6 inside
IPv4
Flow: XSrc: ADest: F
data
src:Bdest: E
physical view:A B
IPv6 IPv6
E
IPv6 IPv6
FC D
logical view:IPv4 tunnel
connecting IPv6 routers E
IPv6 IPv6
FA B
IPv6 IPv6
Tunneling
IPv4 IPv4
IPv6: adoption
❒ Long (long!) time for deployment, use
• 20 years and counting!
❒ Oct 2018:❍ Google: 20% of clients
access services via IPv6
❍ Belgium’s adoption rate: ± 57% (according to APNIC)
4-66Network Layer: Data Plane
34
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-67
Chapter 4: Network Layer: Data Plane
❒ 4. 1 Overview of the Network Layer❍ Data plane❍ Control plane
❒ 4.2 IP: Internet Protocol❍ IPv4 addressing and forwarding❍ Network Address Translation (NAT)❍ Datagram format❍ Fragmentation❍ IPv6
❒ 4.3 What’s inside a router
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-68
Router architecture overviewHigh-level view of a generic router architecture:
high-speed switching
fabric
routing processor
router input ports router output ports
forwarding data plane (hardware),
operates in nanosecond
timeframe
routing, managementcontrol plane (software)
forwarding tables computed,pushed to input ports
35
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-69
link layer
protocol(receive)
lookup,forwarding
queueing
Input port functions
decentralized switching: ❒ using IP header fields values, lookup output
port using forwarding table in input port memory (“match plus action”)
❒ goal: complete input port processing at ‘line speed’(also decrement TTL, update packet count, …)
❒ queuing: if datagrams arrive faster than forwarding rate into switch fabric
physical layer:bit-level reception
data link layer:e.g., Ethernetsee chapter 6
switchfabric
physical layer(bit decoding)
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-70
physical layer(bit decoding)
link layer
protocol(receive)
lookup,forwarding
queueing
Input port functions
decentralized switching: ❒ using IP header fields 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
physical layer:bit-level reception
data link layer:e.g., Ethernetsee chapter 6
switchfabric
36
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-71
Switching fabrics❒ transfer packet from input buffer to appropriate
output buffer❒ switching rate: rate at which packets can be
transferred from inputs to outputs❍ often measured as multiple of input/output line rate❍ N inputs: switching rate N times line rate desirable
❒ three types of switching fabrics
memory
memory
bus crossbar
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-72
Switching Via MemoryFirst generation routers:❒ traditional computers with switching under direct
control of CPU❒ packet copied to system’s memory❒ speed limited by memory bandwidth, and 2 bus
crossings per datagram
inputport(e.g.,
Ethernet)memory
outputport(e.g.,
Ethernet)
system bus
37
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-73
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
bus
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-74
Switching Via An Interconnection Network
❒ overcome bus bandwidth limitations❍ use multiple buses in //
❒ Banyan networks, crossbar, other interconnection nets initially developed to connect processors in multiprocessor architectures
❒ advanced design: fragmenting datagram into fixed length cells, switch cells through the fabric
crossbar
38
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-75
Input port queuing❒ 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 datagram can be
transferred.lower red packet is blocked
switchfabric
one packet time later: green packet experiences HOL
blocking
switchfabric
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-76
Output Ports
❒ Buffering required when datagrams arrive from fabric faster than the transmission rate❍ datagrams can be lost due to congestion, lack of buffers
❒ Fragmentation (if needed)❒ Scheduling discipline chooses among queued datagrams for
transmission❍ E.g. FIFO queuing, priority scheduling, …
physical layer(bit encoding)
link layer
protocol(send)
switchfabric
datagrambuffer
queueing
See chapter 6 for details
39
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-77
Output port queueing
❒ buffering when arrival rate via switch exceeds output line speed
❒ queueing (delay) and loss due to output port buffer overflow!
at t, packets morefrom input to output
one packet time later
switchfabric
switchfabric
© From Computer Networking, by Kurose&Ross Network Layer: Data Plane 4-78
Chapter 4: Network Layer Data Plane❒ Data plane vs Control
Plane❒ IP: Internet Protocol
❍ IPv4 addressing• Subnets, CIDR• DHCP
❍ IP forwarding• Longest prefix match
❍ NAT❍ Fragmentation❍ IPv6
❒ Router architecture
Question: how are forwarding tables computed?
Answer: by the control plane (next chapter)