Chapter 4 Network Layer

cursefarmNetworking and Communications

Oct 24, 2013 (3 years and 7 months ago)

414 views

Network Layer

4
-
1

Chapter 4

Network Layer

A note on the use of these ppt slides:

We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you can add, modify, and delete slides
(including this one) and slide content to suit your needs. They obviously
represent a
lot

of work on our part. In return for use, we only ask the
following:



If you use these slides (e.g., in a class) in substantially unaltered form,
that you mention their source (after all, we’d like people to use our book!)



If you post any slides in substantially unaltered form on a www site, that
you note that they are adapted from (or perhaps identical to) our slides, and
note our copyright of this material.


Thanks and enjoy! JFK/KWR


All material copyright 1996
-
2007

J.F Kurose and K.W. Ross, All Rights Reserved

Computer Networking:
A Top Down Approach

4
th

edition.

Jim Kurose, Keith Ross

Addison
-
Wesley, July
2007.


Network Layer

4
-
2

Chapter 4: Network Layer

Chapter goals:



understand principles behind network layer
services:


network layer service models


forwarding versus routing


how a router works


routing (path selection)


dealing with scale


advanced topics: IPv6, mobility


instantiation, implementation in the Internet

Network Layer

4
-
3

Chapter 4: Network Layer


4. 1 Introduction


4.2 Virtual circuit and
datagram networks


4.3 What’s inside a
router


4.4 IP: Internet
Protocol


Datagram format


IPv4 functions


ICMP


IPv6


4.5 Routing algorithms


Link state


Distance Vector


Hierarchical routing


4.6 Routing in the
Internet


RIP


OSPF


BGP


4.7 Broadcast and
multicast routing


Network Layer

4
-
4

Network layer


transport segment from
sending to receiving host


on sending side encapsulates
segments into datagrams


on rcving side, delivers
segments to transport layer


network layer protocols in
every

host, router


router examines header
fields in all IP datagrams
passing through it





application

transport

network

data link

physical

application

transport

network

data link

physical


network

data link

physical


network

data link

physical


network

data link

physical


network

data link

physical


network

data link

physical


network

data link

physical


network

data link

physical


network

data link

physical


network

data link

physical


network

data link

physical


network

data link

physical

Network Layer

4
-
5

Network layer functions


Connection setup


connection
-
oriented, host
-
to
-
host connection


datagram


Delivery semantics:


Unicast, broadcast,
multicast, anycast


In
-
order, any
-
order


Security


secrecy, integrity,
authenticity


Demux to upper layer


next protocol


Can be either transport or
network (tunneling)


Quality
-
of
-
service


provide predictable
performance


Fragmentation


break
-
up packets based on
data
-
link layer properties


Routing


path selection and packet
forwarding


Addressing


flat vs. hierarchical


global vs. local


variable vs. fixed length

Network Layer

4
-
6

Chapter 4: Network Layer


4. 1 Introduction


4.2 Virtual circuit and
datagram networks


4.3 What’s inside a
router


4.4 IP: Internet
Protocol


Datagram format


IPv4 functions


ICMP


IPv6


4.5 Routing algorithms


Link state


Distance Vector


Hierarchical routing


4.6 Routing in the
Internet


RIP


OSPF


BGP


4.7 Broadcast and
multicast routing


Network Layer

4
-
7

Network service model

Combining the functions into a particular network

Q:

What
service model

for “channel” transporting
datagrams from sender to rcvr?

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
bandwidth to flow


restrictions on
changes in inter
-
packet spacing (jitter)


Network Layer

4
-
8

Network layer connection and
connection
-
less service


Datagram network provides network
-
layer
connectionless service


VC network provides network
-
layer
connection service


Analogous to the transport
-
layer services, but
on a host
-
to
-
host basis with an in
-
network
implementation

Network Layer

4
-
9

Connection
-
oriented virtual circuits


Circuit abstraction


Examples: ATM, frame relay, X.25, phone network


Model


call setup and signaling for each call
before

data can flow


guaranteed performance during call


call teardown and signaling to remove call


Network support


each packet carries circuit identifier (not destination host ID)


every

router on source
-
dest path maintains “state” for each passing
circuit


link, router resources (bandwidth, buffers)
allocated
to VC to
guarantee circuit
-
like performance

application

transport

network

data link

physical

application

transport

network

data link

physical

1. Initiate call

2. incoming call

3. Accept call

4. Call connected

5. Data flow begins

6. Receive data

Network Layer

4
-
10

Connectionless datagram service


Postal service abstraction (Internet)


Model


no call setup or teardown at network layer


no service guarantees


Network support


no state within network on end
-
to
-
end connections


packets forwarded based on destination host ID


packets between same source
-
dest pair may take different
paths

application

transport

network

data link

physical

application

transport

network

data link

physical

1. Send data

2. Receive data

Network Layer

4
-
11

Datagram or VC network: why?

Internet


data exchange among
computers


“elastic” service, no strict
timing req.


“smart” end systems
(computers)


can adapt, perform
control, error recovery


simple inside network,
complexity at “edge”


many link types


different characteristics


uniform service difficult

ATM


evolved from telephony


human conversation:


strict timing, reliability
requirements


need for guaranteed
service


“dumb” end systems


telephones


complexity inside
network


only network provider
can deploy new services!

Network Layer

4
-
12

Network layer service models:

Network

Architecture


Internet


ATM


ATM


ATM


ATM

Service

Model


best effort


CBR


VBR


ABR


UBR

Bandwidth


none


constant

rate

guaranteed

rate

guaranteed

minimum

none

Loss


no


yes


yes


no


no

Order


no


yes


yes


yes


yes

Timing


no


yes


yes


no


no

Congestion

feedback


no (inferred

via loss)

no

congestion

no

congestion

yes


no

Guarantees ?

Network Layer

4
-
13

Adding circuits to the Internet


Intserv, Diffserv, RSVP


At the end of course if time permits


Chapter 7 in book

Network Layer

4
-
14

Chapter 4: Network Layer


4. 1 Introduction


4.2 Virtual circuit and
datagram networks


4.3 What’s inside a
router


4.4 IP: Internet
Protocol


Datagram format


IPv4 functions


ICMP


IPv6


4.5 Routing algorithms


Link state


Distance Vector


Hierarchical routing


4.6 Routing in the
Internet


RIP


OSPF


BGP


4.7 Broadcast and
multicast routing


Network Layer

4
-
15

The Internet Network layer

forwarding

table

Host, router network layer functions:

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

Network

layer

Network Layer

4
-
16

Chapter 4: Network Layer


4. 1 Introduction


4.2 Virtual circuit and
datagram networks


4.3 What’s inside a
router


4.4 IP: Internet
Protocol


Datagram format


IPv4 functions


ICMP


IPv6


4.5 Routing algorithms


Link state


Distance Vector


Hierarchical routing


4.6 Routing in the
Internet


RIP


OSPF


BGP


4.7 Broadcast and
multicast routing


Network Layer

4
-
17

IP datagram format

ver

length

32 bits

data

(variable length,

typically a TCP

or UDP segment)

16
-
bit identifier

Internet


checksum

time to

live

32 bit source IP address

IP protocol version

number

header length


(bytes)

max number

remaining hops

(decremented at

each router)

for

fragmentation/

reassembly

total datagram

length (bytes)

upper layer protocol

to deliver payload to

head.

len

type of

service

“type” of data

flgs

fragment


offset

upper


layer

32 bit destination IP address

Options (if any)

E.g. timestamp,

record route

taken, specify

list of routers

to visit.

how much overhead
with TCP?


20 bytes of TCP


20 bytes of IP


= 40 bytes + app
layer overhead

Network Layer

4
-
18

IP header


Version


Currently at 4, next
version 6


Header length


Length of header (20
bytes plus options)


Type of Service


Typically ignored


Replaced by DiffServ
and ECN


Length


Length of IP fragment
(payload)


Identification


To match up with other
fragments


Flags


Don’t fragment flag


More fragments flag


Fragment offset


Where this fragment
lies in entire IP
datagram


Measured in 8 octet
units (11 bit field)

Network Layer

4
-
19

IP header (cont)


Time to live


Ensure packets exit the
network


Protocol


Demultiplexing to
higher layer protocols
(TCP, UDP, SCTP)


Header checksum


Ensures some degree of
header integrity


Relatively weak


16 bit


Source IP, Destination
IP (32 bit addresses)


Options


E.g. Source routing,
record route, etc.


Performance issues


Poorly supported

Network Layer

4
-
20

Chapter 4: Network Layer


4. 1 Introduction


4.2 Virtual circuit and
datagram networks


4.3 What’s inside a
router


4.4 IP: Internet
Protocol


Datagram format


IPv4 functions


ICMP


IPv6


4.5 Routing algorithms


Link state


Distance Vector


Hierarchical routing


4.6 Routing in the
Internet


RIP


OSPF


BGP


4.7 Broadcast and
multicast routing


Network Layer

4
-
21

Recall network layer functions


How does IPv4 support..


Connection setup


Delivery semantics


Security


Demux to upper layer


Quality
-
of
-
service


Fragmentation


Addressing


Routing

Network Layer

4
-
22

IP connection setup


Hourglass design


No support for network layer connections


Unreliable datagram service


Out
-
of
-
order delivery possible


Connection semantics only at higher layer


Compare to ATM and phone network…

Network Layer

4
-
23

IP delivery semantics


No reliability guarantees


Loss


No ordering guarantees


Out
-
of
-
order delivery possible


Unicast mostly


IP broadcast (255.255.255.255) not forwarded


IP multicast supported, but not widely used


224.0.0.0 to 239.255.255.255


Network Layer

4
-
24

IP security


Weak support for integrity


IP checksum


IP has a header checksum, leaves data integrity to TCP/UDP


Catch errors within router or bridge that are not detected
by link layer


Incrementally updated as routers change fields


http://www.rfc
-
editor.org/rfc/rfc1141.txt


No support for secrecy, authenticity


IPsec


Retrofit IP network layer with encryption and
authentication


http://www.rfc
-
editor.org/rfc/rfc2411.txt

Network Layer

4
-
25

Internet checksum
(review)

Sender:


treat segment contents
as sequence of 16
-
bit
integers (See TCP
checksum)


checksum: addition (1’s
complement sum) of
segment contents


sender puts checksum
value into UDP checksum
field



Receiver:


compute checksum of
received segment


check if computed checksum
equals checksum field value:


NO
-

error detected


YES
-

no error detected.
But maybe errors
nonetheless?


Goal:

detect “errors” (e.g., flipped bits) in transmitted
packet (note: used at transport layer

only
)


Network Layer

4
-
26

IP demux to upper layer


http://www.rfc
-
editor.org/rfc/rfc1700.txt


Protocol type field


1 =
ICMP


2 = IGMP


3 = GGP


4 = IP in IP


6 =
TCP


8 = EGP


9 = IGP


17 =
UDP


29 = ISO
-
TP4



80 = ISO
-
IP


88 = IGRP


89 = OSPFIGP


94 = IPIP
http://www.rfc
-
editor.org/rfc/rfc2003.txt

Network Layer

4
-
27

IP quality of service


IP originally had “type
-
of
-
service” (TOS) field to
eventually support quality


Not used, ignored by most routers


Mid 90s


Integrated services (intserv) and RSVP signalling


Per
-
flow end
-
to
-
end QoS support


Per
-
flow signaling


Per
-
flow network resource allocation (*FQ, *RR scheduling
algorithms)


Setup and match flows on connection ID


Network Layer

4
-
28

IP quality of service


RSVP


http://www.rfc
-
editor.org/rfc/rfc2205.txt


Provides end
-
to
-
end signaling to network elements


General purpose protocol for signaling information


Not used now on a per
-
flow basis to support int
-
serv,
but being reused for diff
-
serv.


intserv


Defines service model (guaranteed, controlled
-
load)


http://www.rfc
-
editor.org/rfc/rfc2210.txt


http://www.rfc
-
editor.org/rfc/rfc2211.txt


http://www.rfc
-
editor.org/rfc/rfc2212.txt


Dozens of scheduling algorithms to support these
services


WFQ, W
2
FQ, STFQ, Virtual Clock, DRR, etc.

Network Layer

4
-
29

IP quality of service


Why did RSVP, intserv fail?


Complexity


Scheduling


Routing (pinning routes)


Per
-
flow signaling overhead


Lack of scalability


Per
-
flow state


Economics


Providers with no incentive to deploy


SLA, end
-
to
-
end billing issues


QoS a weak
-
link property


Requires every device on an end
-
to
-
end basis to support flow

Network Layer

4
-
30

IP quality of service


Now it’s diffserv…


Use the “type
-
of
-
service” bits as a priority marking


http://www.rfc
-
editor.org/rfc/rfc2474.txt


http://www.rfc
-
editor.org/rfc/rfc2475.txt


http://www.rfc
-
editor.org/rfc/rfc2597.txt


http://www.rfc
-
editor.org/rfc/rfc2598.txt


Core network relatively stateless


AF


Assured forwarding (drop precedence)


EF


Expedited forwarding (strict priority handling)

Network Layer

4
-
31

IP Fragmentation & Reassembly


network links have MTU
(max.transfer unit)
-

largest
possible link
-
level frame.


different link types,
different MTUs


large IP datagram (can be
64KB) “fragmented” within
network


one datagram becomes
several datagrams


IP header on each
fragment


IP identifier and offset
fields to identify and
order fragments

fragmentation:

in:

one large datagram

out:

3 smaller datagrams

reassembly

Network Layer

4
-
32

IP Fragmentation & Reassembly


Where to do
reassembly?


End nodes


avoids unnecessary
work


Dangerous to do at
intermediate nodes


Buffer space


Must assume single
path through network


May be re
-
fragmented
later on in the route
again

fragmentation:

in:

one large datagram

out:

3 smaller datagrams

reassembly

Network Layer

4
-
33

IP Fragmentation and Reassembly

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 becomes

several smaller datagrams

Example


4000 byte
datagram


MTU = 1500 bytes


1480 bytes in

data field

offset =

1480/8

Network Layer

4
-
34

Fragmentation is Harmful


Uses resources poorly


Forwarding costs per packet


Best if we can send large chunks of data


Worst case: packet just bigger than MTU


Poor end
-
to
-
end performance


Loss of a fragment makes other fragments
useless


Reassembly is hard


Buffering constraints

Network Layer

4
-
35

Fragmentation


Path MTU Discovery


Remove fragmentation from the network


Mandatory in IPv6


Network layer does no fragmentation


Hosts dynamically discover smallest MTU of path


http://www.rfc
-
editor.org/rfc/rfc1191.txt


Algorithm:


Initialize MTU to MTU for first hop


Send datagrams with Don’t Fragment bit set


If ICMP “pkt too big” msg, decrease MTU


What happens if path changes?


Periodically (>5mins, or >1min after previous increase), increase
MTU


Some routers will return proper MTU

Network Layer

4
-
36

Fragmentation


References


Characteristics of Fragmented IP Traffic on Internet
Links
. Colleen Shannon, David Moore, and k claffy
--

CAIDA, UC San Diego. ACM SIGCOMM Internet
Measurement Workshop 2001.
http://www.aciri.org/vern/sigcomm
-
imeas
-
2001.program.html


C. A. Kent and J. C. Mogul, "
Fragmentation considered
harmful
," in
Proceedings

of the ACM Workshop on Frontiers
in Computer Communications Technology, pp. 390
--
401,
Aug. 1988.

http://www.research.compaq.com/wrl/techreports/abstr
acts/87.3.html

Network Layer

4
-
37

IP Addressing


IP address:



32
-
bit identifier for
host/router
interface



interface:

connection
between host, router
and physical link


routers typically have
multiple interfaces


host may have multiple
interfaces


IP addresses associated
with interface, not host,
router

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

223.1.1.1 = 11011111 00000001 00000001 00000001

223

1

1

1

Network Layer

4
-
38

IP Addressing


IP address:



network part (high order
bits)


host part (low order bits)


What’s a network ?


all interfaces that can
physically reach each
other without intervening
router


each interface shares
the same network part of
IP address

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

network consisting of 3 IP networks

(for IP addresses starting with 223,

first 24 bits are network address)

LAN

Network Layer

4
-
39

Subnets

How to find the networks
(subnets)?


Detach each interface from
router, host


create “islands of isolated
networks


Each isolated network is called
a subnet


Notation:


Interfaces on a subnet share
identical “bits” as prefix


Bits identified by mask


255.255.255.0


machine addresses all begin
with the same 24 bits


Also denoted by /24



223.1.1.0/24

223.1.2.0/24

223.1.3.0/24

Subnet mask: /24

Network Layer

4
-
40

Subnets

How many?

223.1.1.1

223.1.1.3

223.1.1.4

223.1.2.2

223.1.2.1

223.1.2.6

223.1.3.2

223.1.3.1

223.1.3.27

223.1.1.2

223.1.7.0

223.1.7.1

223.1.8.0

223.1.8.1

223.1.9.1

223.1.9.2

Network Layer

4
-
41

How do networks get IP addresses?


Total IP address size: 4 billion


Initially one large class (8
-
bit network, 24
-
bit host)


ISP given an 8
-
bit network number to manage


Each router keeps track of each network (2
8
=256 routes)


Each network has 16 million hosts


Problem: one size does not fit all


Classful addressing


Accomodate smaller networks (LANs)


Class A: 128 networks, 16M hosts


Class B: 16K networks, 64K hosts


Class C: 2M networks, 256 hosts


Total routes potentially > 2,113,664 routes !

High Order Bits

0

10

110

Format

7 bits of net, 24 bits of host (/8)

14 bits of net, 16 bits of host (/16)

21 bits of net, 8 bits of host (/24)

Class

A

B

C

Network Layer

4
-
42

IP address classes

Network ID

Host ID

8

16

Class A

32

0

Class B

10

Class C

110

Multicast Addresses

Class D

1110

Reserved for experiments

Class E

1111

24

Network ID

Network ID

Host ID

Host ID

1.0.0.0 to 127.255.255.255

128.0.0.0 to 191.255.255.255

192.0.0.0 to 223.255.255.255

224.0.0.0 to 239.255.255.255

Network Layer

4
-
43

Special IP Addresses


Private addresses


http://www.rfc
-
editor.org/rfc/rfc1918.txt


Class A: 10.0.0.0
-

10.255.255.255 (10.0.0.0/8 prefix)


Class B: 172.16.0.0
-

172.31.255.255 (172.16.0.0/12 prefix)


Class C: 192.168.0.0
-

192.168.255.255 (192.168.0.0/16 prefix)


127.0.0.1: local host (a.k.a. the loopback address)


255.255.255.255


IP broadcast to local hardware that must not be forwarded


http://www.rfc
-
editor.org/rfc/rfc919.txt


0.0.0.0


IP address of unassigned host (BOOTP, ARP, DHCP)


Default route advertisement

Network Layer

4
-
44

IP Addressing Problem #1 (1984)


Inefficient use of address space


Class A (rarely given out, sparse usage)


Class B = 64k hosts


Very few LANs have close to 64K hosts


Electrical/LAN limitations, performance or administrative reasons


e.g., class B net allocated enough addresses for 64K hosts, even if
only 2K hosts in that network


Need simple/address
-
efficient way to get multiple “networks”


Reduce the number of addresses that are assigned, but not used


Subnet addressing


http://www.rfc
-
editor.org/rfc/rfc917.txt


Split large address ranges into multiple smaller ones (subnet)


Dramatically increases potential number of routes!

Network Layer

4
-
45

Subnetting


Variable length subnet masks


Subnet a class B address space into several chunks

Network

Host

Network

Host

Subnet

1111..

00000000

..1111

Mask

Network Layer

4
-
46

Subnetting Example


Assume an organization was assigned a class B
address 150.100


Assume it has < 100 hosts per subnet


How many host bits do we need? Seven


What is the network mask?


11111111 11111111 11111111 10000000


255.255.255.128 or /25


How many subnets of this size can be created within this
address space?



List them


Network Layer

4
-
47

Subnetting Example


Assume an organization was assigned a class B
address 150.100


Assume it has < 100 hosts per subnet


How many host bits do we need? Seven


What is the network mask?


11111111 11111111 11111111 10000000


255.255.255.128 or /25


How many subnets of this size can be created within this
address space?


512

(/16 = 2
16

hosts, /25 = 2
7

hosts … 2
16
/2
7

= 2
9

= 512)


List them

150.100.0.0/25


(…00000000.0*******)

150.100.0.128/25


(…00000000.1*******)

150.100.1.0/25


(…00000001.0*******)

150.100.1.128/25


(…00000001.1*******)



150.100.255.0/25


(…11111111.0*******)

150.100.255.128/25

(…11111111.1*******)

Network Layer

4
-
48

Subnetting Example


Split the following network into 16 equal
subnetworks


131.252.128.0/17

Network Layer

4
-
49

Subnetting Example


Split the following network into 16 equal
subnetworks


131.252.128.0/17


10000011 . 11111100 . 1
0000000 . 00000000


Split into 16 parts using next 4 significant bits


10000011 . 11111100 . 1
0000
000 . 00000000


10000011 . 11111100 . 1
0001
000 . 00000000


10000011 . 11111100 . 1
0010
000 . 00000000


10000011 . 11111100 . 1
0011
000 . 00000000


etc.


Solution


131.252.128.0/21


131.252.136.0/21


131.252.144.0/21


etc.

Network Layer

4
-
50

IP Address Problem #2 (1991)


Address space depletion


In danger of running out of classes A and B


Class A


very few in number, IANA frugal in giving them out


Class B


subnetting only applied to new allocations of class B


existing class B networks sparsely populated


people refuse to give it back


Class C


plenty available, but too small for most domains


Supernetting


Assign multiple consecutive class C blocks as one block


Allows class C usage while limiting number of routes used


http://www.rfc
-
editor.org/rfc/rfc1338.txt

Network Layer

4
-
51

IP Address Problem #2 (1991)


Example


Combine the following class C networks into one larger
network


131.252.0.0/24


131.252.1.0/24


131.252.2.0/24


131.252.3.0/24


131.252.4.0/24


131.252.5.0/24


131.252.6.0/24


131.252.7.0/24

Answer:

131.252.0.0/21


.00000
000.*


.00000
001.*


.00000
010.*


.00000
011.*


.00000
100.*


.00000
101.*


.00000
110.*


.00000
111.*

Network Layer

4
-
52

IP Address Problem #3 (1991)


Explosion of routes


Subnetting class B


Increasing use of class C explodes # of routes


Remove classes


Classless Inter
-
Domain Routing (CIDR)


Arbitrary aggregation of contiguous addresses


http://www.rfc
-
editor.org/rfc/rfc1518.txt


http://www.rfc
-
editor.org/rfc/rfc1519.txt

Network Layer

4
-
53

IP addressing: CIDR


Original classful addressing


Use class structure (A, B, C) to determine
network ID for route lookup


CIDR:

C
lassless
I
nter
D
omain
R
outing


Do not use classes to determine network ID


network portion of address of arbitrary length


route format:
a.b.c.d/x
, where x is # bits in
network portion of address

11001000 00010111

0001000
0 00000000

network

part

host

part

200.23.16.0/23

Network Layer

4
-
54

CIDR


Assign any range of addresses to network


Use common part of address as network number


e.g., addresses 192.4.16.* to 192.4.31.* have the
first 20 bits in common. Thus, we use this as the
network number


netmask is /20, /xx is valid for almost any xx


192.4.16.0/20


Enables more efficient usage of address space
(and router tables)


More on how this impacts routing later….

Network Layer

4
-
55

CIDR example


Consider the following sets of /24 networks


194.252.10.0/24


194.252.11.0/24


194.252.12.0/24


194.252.13.0/24


194.252.14.0/24


194.252.15.0/24


194.252.16.0/24


194.252.17.0/24


Using CIDR, what is the minimum number of prefixes
that can be used to represent this range exactly?


Network Layer

4
-
56

CIDR example


Consider the following sets of /24 networks


194.252.10.0/24 = .00001010.*


194.252.11.0/24 = .00001011.* 194.252.10.0/23


194.252.12.0/24 = .00001100.*


194.252.13.0/24 = .00001101.*


194.252.14.0/24 = .00001110.*


194.252.15.0/24 = .00001111.* 194.252.12.0/22


194.252.16.0/24 = .00010000.*


194.252.17.0/24 = .00010001.* 194.252.16.0/23


Using CIDR, what is the minimum number of prefixes
that can be used to represent this range exactly?


Network Layer

4
-
57

CIDR example


Consider the following sets of /24 networks


194.252.0.0/24


194.252.1.0/24


194.252.2.0/24


194.252.3.0/24


194.252.4.0/24


194.252.5.0/24


194.252.6.0/24


194.252.7.0/24


Using CIDR, what is the minimum number of
prefixes that can be used to represent this range
exactly?

Network Layer

4
-
58

CIDR example


Consider the following sets of /24 networks


194.252.0.0/24 = .00000000.*


194.252.1.0/24 = .00000001.* = 194.252.1.0/24


194.252.2.0/24 = .00000010.* =


194.252.3.0/24 = .00000011.* = 194.252.2.0/23


194.252.4.0/24 = .00000100.* =


194.252.5.0/24 = .00000101.* =


194.252.6.0/24 = .00000110.* =


194.252.7.0/24 = .00000111.* = 194.252.4.0/22


Using CIDR, what is the minimum number of
prefixes that can be used to represent this range
exactly?

Network Layer

4
-
59

CIDR route aggregation

“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

Fly
-
By
-
Night
-
ISP

Organization 0

Organization 7

Internet

Organization 1

ISPs
-
R
-
Us

“Send me anything

with addresses

beginning

199.31.0.0/16”

200.23.20.0/23

Organization 2

.

.

.

.

.

.

Hierarchical addressing allows efficient advertisement of routing

information:

Network Layer

4
-
60

CIDR route aggregation

ISP X given 16 class C networks

200.23.16.* to 200.23.31.* (or 200.23.16/20)

200.23.16.0/24, 200.200.17.0/24

200.23.18.0/24, 200.200.19.0/24

200.23.20.0/24, 200.200.21.0/24

200.23.22.0/24, 200.200.23.0/24

Large
company

200.23.16.0/
21

Medium
company

200.23.24.0/
22

200.23.24.0/24

200.23.25.0/24

200.23.26.0/24

200.23.27.0/24

Small
company

200.23.28.0
/23

200.23.28.0/24

200.23.29.0/24

Tiny
company

200.23.30.0/
24

Adjacent
ISP

router

ISP X

Route Interface

200.23.16/20 1

1

Route Interface

200.23.16/21 2

200.23.24/22 3

200.23.28/23 4

200.23.30/24 5

1

2

3

4

5

Network Layer

4
-
61

CIDR Shortcomings


Customer selecting a new provider


Renumbering required

201.10.0.0/21

201.10.0.0/22

201.10.4.0/24

201.10.5.0/24

201.10.6.0/23

Provider 1

Provider 2

199.31.0.0/16

Network Layer

4
-
62

CIDR shortcomings


Multi
-
homing


ISPs
-
R
-
Us has a more specific route to Organization 1

“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

Fly
-
By
-
Night
-
ISP

Organization 0

Organization 7

Internet

Organization 1

ISPs
-
R
-
Us

“Send me anything

with addresses

beginning 199.31.0.0/16

or 200.23.18.0/23”

200.23.20.0/23

Organization 2

.

.

.

.

.

.

Network Layer

4
-
63

Getting IP addresses

Q:

How does
network

get IP addresses?

A:

organization gets allocated portion of its provider
ISP’s address space


ISPs get it from

ICANN
:
I
nternet
C
orporation for
A
ssigned
N
ames and
N
umbers


Allocates addresses, manages DNS, resolves disputes


Customers get sub
-
blocks from ISPs

ISP's block
11001000 00010111 0001
0000 00000000 200.23.16.0/20


Organization 0
11001000 00010111 0001000
0 00000000 200.23.16.0/23

Organization 1
11001000 00010111 0001001
0 00000000 200.23.18.0/23

Organization 2
11001000 00010111 0001010
0 00000000 200.23.20.0/23


... ….. …. ….

Organization 7
11001000 00010111 0001111
0 00000000 200.23.30.0/23



Network Layer

4
-
64

CIDR and IP route lookup
(forwarding)


IP routing


Done only based on destination IP address


Lookup route in forwarding table


Classful IP Route Lookup


In the early days, address classes made it easy


A: 0 | 7 bit network | 24 bit host (16M each)


B: 10 | 14 bit network | 16 bit host (64K)


C: 110 | 21 bit network | 8 bit host (255)


Address would specify prefix for forwarding
table


Simple lookup

Network Layer

4
-
65

Classful IP forwarding


www.pdx.edu

address 131.252.120.50


Class B address


route prefix is 131.252


Lookup 131.252 in class B forwarding table


Prefix


part of address that really matters for
routing


Forwarding table contains


List of prefix entries


A few fixed prefix lengths (8/16/24)


Large tables


2 Million class C networks


Sites with multiple class C networks have multiple
route entries at every router

Network Layer

4
-
66

CIDR and IP forwarding


CIDR advantages


Saves space in route tables


Makes more efficient use of address space


ISP allocated 8 class C chunks, 201.10.0.0 to
201.10.7.255


201.10.0.0/24 201.10.1.0/24 201.10.2.0/24 201.10.3.0/24


201.10.4.0/24 201.10.5.0/24 201.10.6.0/24 201.10.7.0/24


Combine 8 class C entries with 1 combined entry


First 21 bits are network number


Written as 201.10.0.0/21


Routing protocols carry prefix length with
destination network address


Network Layer

4
-
67

CIDR and IP forwarding


CIDR disadvantage


Makes route lookup more complex


CIDR fundamentally changes route lookup algorithm


Before CIDR


Separate class A/B/C route tables each with O(1) lookup


Table lookup based on class (A,B,C)


After CIDR


One table containing many prefix lengths


Must find the most specific route that matches the
destination IP address in packet


Must match against all routes simultaneously via
longest
prefix match

Network Layer

4
-
68

Longest prefix matching


Prefix

Match

Link

Interface


11001000

00010111

00010

0



11001000

00010111

00011000

1


11001000

00010111

00011

2


otherwise

3

DA: 11001000 00010111 00011000 10101010

Examples

DA: 11001000 00010111 00010110 10100001

Which interface?

Which interface?

Network Layer

4
-
69

CIDR example

Provider


Routing to the network



Packet to 10.1.1.3
arrives


Path is R2


R1


H1


H2

H2

H3

H4

R1

10.1.1/24

10.1.1.2

10.1.1.4

10.1.16/24

10.1.8/24

10.1.3/24

10.1.1.3

10.1.2/24

R2

10.1.3.2

10.1.8.4

10.1.1.1

10.1.2.2

10.1.3.1

10.1.8.1

10.1.2.1

10.1.16.1

H1

10.1.1.2/31

Network Layer

4
-
70

CIDR example

Routing table at R2

Destination

Next Hop

Interface

127.0.0.1

127.0.0.1

lo0

Default or 0/0

provider

10.1.16.1

10.1.8.0/24

10.1.8.1

10.1.8.1

10.1.2.0/24

10.1.2.1

10.1.2.1

10.1.0.0/22

10.1.2.2

10.1.2.1


Subnet Routing


Packet to 10.1.1.3


Matches 10.1.0.0/22

H2

H3

H4

R1

10.1.1/24

10.1.1.2

10.1.1.4

10.1.16/24

10.1.8/24

10.1.3/24

10.1.1.3

10.1.2/24

R2

10.1.3.2

10.1.8.4

10.1.1.1

10.1.2.2

10.1.3.1

10.1.8.1

10.1.2.1

10.1.16.1

H1

10.1.1.2/31

10.1.16.0/24

10.1.16.1

10.1.16.1

Network Layer

4
-
71

CIDR example

Routing table at R1

Destination

Next Hop

Interface

127.0.0.1

127.0.0.1

lo0

Default or 0/0

10.1.2.1

10.1.2.2

10.1.3.1

10.1.3.1

10.1.1.0/24

10.1.1.1

10.1.1.1

10.1.2.2

10.1.2.2


Subnet Routing


Packet to 10.1.1.3


Matches 10.1.1.2/31


Longest prefix match

10.1.1.4

10.1.1.1

10.1.2.0/24

10.1.1.2/31

10.1.3.0/24

H2

H3

H4

R1

10.1.1/24

10.1.1.2

10.1.1.4

10.1.16/24

10.1.8/24

10.1.3/24

10.1.1.3

10.1.2/24

R2

10.1.3.2

10.1.8.4

10.1.1.1

10.1.2.2

10.1.3.1

10.1.8.1

10.1.2.1

10.1.16.1

H1

10.1.1.2/31

10.1.1.3 matches both routes, use longest prefix match

Network Layer

4
-
72

CIDR example

Routing table at H1

Destination

Next Hop

Interface

127.0.0.1

127.0.0.1

lo0

Default or 0/0

10.1.1.1

10.1.1.4

10.1.1.0/24

10.1.1.4

10.1.1.4

10.1.1.2/31

10.1.1.2

10.1.1.2


Subnet Routing


Packet to 10.1.1.3


Direct route


Longest prefix match

H2

H3

H4

R1

10.1.1/24

10.1.1.2

10.1.1.4

10.1.16/24

10.1.8/24

10.1.3/24

10.1.1.3

10.1.2/24

R2

10.1.3.2

10.1.8.4

10.1.1.1

10.1.2.2

10.1.3.1

10.1.8.1

10.1.2.1

10.1.16.1

H1

10.1.1.2/31

10.1.1.3 matches both routes, use longest prefix match

Network Layer

4
-
73

Longest
-
prefix matching


Algorithms and data structures for CIDR
-
based IP forwarding


Ruiz
-
Sanchez, Biersack, Dabbous, “Survey and Taxonomy of IP
address Lookup Algorithms”, IEEE Network, Vol. 15, No. 2,
March 2001


Binary tree


Multi
-
bit tree


LC tree


Lulea tree


Full expansion/compression


Binary search on prefix lengths


Binary range search


Multiway range search


Multiway range trees


Binary search on hash tables (Waldvogel


SIGCOMM 97)

Network Layer

4
-
74

Binary tree

Route Prefixes

A 0*

B 01000*

C 011*

D 1*

E 100*

F 1100*

G 1101*

H 1110*

I 1111*

A

0

0

0

0

1

1

0

0

0

0

0

1

1

1

1

1

B

C

D

E

F

G

H

I


Data structure to support longest
-
prefix match for forwarding


Bit
-
wise traversal from left
-
to
-
right


Continue as far as possible while keeping track of deepest match

Example: 000000

Example: 101000

Network Layer

4
-
75

Path
-
compressed binary tree


Eliminate single branch point nodes


Saves unnecessary memory lookups


Branches labelled by bit to examine


Continue as far as possible while keeping track of deepest match


Variants include PATRICIA and BSD trees

Route Prefixes

A 0*

B 01000*

C 011*

D 1*

E 100*

F 1100*

G 1101*

H 1110*

I 1111*

A

0

1

0

0

0

0

1

1

1

1

1

B

C

D

E

F

G

H

I

0

Bit=3

Bit=2

Bit=3

Bit=4

Bit=4

Bit=1

Example: 010100

x

Network Layer

4
-
76

Example #2


Create a binary tree that implements the
following forwarding table

Route Prefixes

A 0*

B 00010*

C 00011*

D *

Network Layer

4
-
77

Example #2: Binary tree

Route Prefixes

A 0*

B 00010*

C 00011*

D *

A

0

0

0

1

B

0

C

D

Network Layer

4
-
78

Example #2


Create a path
-
compressed binary tree that
implements the following forwarding table

Route Prefixes

A 0*

B 00010*

C 00011*

D *

Network Layer

4
-
79

Example #2:

Path
-
compressed binary tree

Route Prefixes

A 0*

B 00010*

C 00011*

D *

A

0

B

0

C

Bit=1

Bit=5

1

D

Network Layer

4
-
80

Multi
-
bit trees


Problem with all single
-
bit trees


Still incur too many memory accesses per lookup


Lookup done a single bit at a time


CPUs access 32
-
bits at a time


Multi
-
bit trees


Compare multiple bits at a time


Stride = number of bits being examined


Reduces memory accesses


Increases memory required


Forces table expansion for prefixes falling in between strides


Two types


Variable stride multi
-
bit trees


Fixed stride multi
-
bit trees


Most route entries are Class C


Optimize “stride” based on this

Network Layer

4
-
81

Variable stride multi
-
bit tree


Single level has variable stride lengths

Route Prefixes

A 0*

B 01000*

C 011*

D 1*

E 100*

F 1100*

G 1101*

H 1110*

I 1111*

A

0

1

0

1

00

01

10

11

A

D

D

B

C

C

E

00

01

10

11

G

F

I

H

00

01

10

11

Route for C expanded/duplicated

Stride either 1 or 2 bits

Network Layer

4
-
82

Fixed stride multi
-
bit tree


Single level has equal strides

Route Prefixes

A 0*

B 01000*

C 011*

D 1*

E 100*

F 1100*

G 1101*

H 1110*

I 1111*

A

000

001

010

011

100

101

110

111

A

A

00

01

10

11

00

01

10

11

00

01

10

11

C

E

D

D

D

B

F

F

G

H

G

H

I

I

Network Layer

4
-
83

Issues


Scaling


IPv6?


Stride choice


Tuning stride to route table

Network Layer

4
-
84

IP Address Problem #4 (1994)


Even with CIDR, address space running out


IPv6 still being developed, a long way from being deployed


Network Address Translation (NAT)


Alternate solution to address space depletion problem


Kludge (but useful)


Sits between your network and the Internet


Dynamically assign source address from a pool of available
addresses


“Statistically multiplex” address usage


Each machine gets unique, external IP address out of pool


Replaces local, private, network layer source IP addresses to global
IP addresses


Has a pool of global IP addresses (less than number of hosts on
your network)

Network Layer

4
-
85

NAT Illustration

Global
Internet

Private

Network

Pool of global IP
addresses


Operation: Source (S)

wants to talk to Destination (D):


Create S
g
-
S
p

mapping


Replace S
p

with S
g

for outgoing packets


Replace S
g

with S
p

for incoming packets

P

G

D
g

S
p

Data

NAT

Destination

Source

D
g

S
g

Data

Network Layer

4
-
86

IP addressing and NAT


What if we only have one IP address?


Add port translation to NAT


Sometimes referred to as NAPT (Network Address Port
Translator)


Both addresses and ports are translated


Translates Paddr + flow info to Gaddr + new flow info


Uses TCP/UDP port numbers


Potentially thousands of simultaneous connections
with one global IP address


16
-
bit port
-
number field:


60,000 simultaneous connections with a single LAN
-
side
address!

Network Layer

4
-
87

NAT with port 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 of

Internet

Datagrams with source or

destination in this network

have 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

Network Layer

4
-
88

NAT


Advantages


range of addresses not needed from ISP: just a
small set of IP addresses for all devices


can change addresses of devices in local network
without notifying outside world


can change ISP without changing addresses of
devices in local network


devices inside local net not explicitly addressable,
visible by outside world (a security plus).


Network Layer

4
-
89

NAT

Implementation:

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 addr.



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


Network Layer

4
-
90

NAT example

10.0.0.1

10.0.0.2

10.0.0.3

S: 10.0.0.1, 3345

D: 128.119.40.186, 80

1

10.0.0.4

138.76.29.7

1:

host 10.0.0.1

sends datagram to

128.119.40.186, 80

NAT translation table

WAN side addr LAN side addr

138.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, 5001

D: 128.119.40.186, 80

2

2:

NAT router

changes datagram

source addr from

10.0.0.1, 3345 to

138.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 router

changes datagram

dest addr from

138.76.29.7, 5001 to 10.0.0.1, 3345



Network Layer

4
-
91

NAT is controversial


Routers should only process up to layer 3


violates network transparency


key feature that allows one to deploy any application
without coordinating with network infrastructure


implicit assumption that network header is unchanged in
network


address shortage should instead be solved by IPv6


Other problems


No inbound connections


Must be taken into account by app designers, eg, P2P
applications


Some protocols carry addresses


e.g., FTP carries addresses in text


What is the problem?


Encryption

Network Layer

4
-
92

NAT problem #1: traversal


Incoming connections


client want 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 addr)


only one externally visible
NATted address: 138.76.29.7


solution 1: statically configure
NAT to forward incoming
connection requests at given port
to server


e.g., (123.76.29.7, port 2500)
always forwarded to 10.0.0.1 port
25000


Or use DMZ host

10.0.0.1

10.0.0.4

NAT

router

138.76.29.7

Client

?

Network Layer

4
-
93

NAT problem #1: traversal


solution 2: Universal Plug and
Play (UPnP) Internet Gateway
Device (IGD) Protocol. Allows
NATted host to:


learn public IP address
(138.76.29.7)


enumerate existing port
mappings


add/remove port mappings
(with lease times)


i.e., automate static NAT port
map configuration

10.0.0.1

10.0.0.4

NAT

router

138.76.29.7

IGD

Network Layer

4
-
94

NAT problem #1: traversal


solution 3: relaying (used in Skype)


NATed server establishes connection to relay


External client connects to relay


relay bridges packets between to connections


10.0.0.1

NAT

router

138.76.29.7

Client

1.

connection to

relay initiated

by NATted host

2.

connection to

relay initiated

by client

3.

relaying

established

Network Layer

4
-
95

NAT problem #2: loss of
transparency


Breaks applications that assume network
does not modify packets


Prevents new applications that make the
same assumption


Example


ftp, NAT, and PORT command

Network Layer

4
-
96

ftp, NAT and PORT command


Normal FTP mode


Server has port 20, 21 reserved


Client initiates control connection to port 21 on
server


Client allocates port X for data connection


Client passes its IP address and the data
connection port (X) in a PORT command to
server


Server parses PORT command and initiates
connection from its own port 20 to the client on
port X


What if client is behind a NAT device?

Network Layer

4
-
97

ftp, NAT and PORT command


Problem


ftp server connects to a private IP address!

192.168.0.1

192.168.0.2

Packet #1

SrcIP=192.168.0.1

SrcPort=1312

DstIP=131.252.220.66

DstPort=21

-------------------

PORT command

“Connect to me at


IP=192.168.0.1


Port=20”

NAPT translator

ExternalIP=129.95.50.3

Packet #1 after NAPT

SrcIP=129.95.50.3

SrcPort=2000

DstIP=131.252.220.66

DstPort=21

--------------------

PORT command

“Connect to me at


IP=192.168.0.1


Port=20”

Network Layer

4
-
98

ftp, NAT and PORT command


Solution #1


Modify packets at NAT


NAT must captures outgoing connections destined for
port 21


Looks for PORT command and translates
address/port payload


http://www.practicallynetworked.com/support/linksys_ftp
_port.htm


What if NAT doesn’t parse PORT command correctly?


What if ftp server is running on a different port than
21?

Network Layer

4
-
99

ftp, NAT and PORT command


Need to rewrite points to bigger problem!


Loss of network transparency


Network must modify application data in order for
application to run correctly!

192.168.0.1

192.168.0.2

Packet #1

SrcIP=192.168.0.1

SrcPort=1312

DstIP=131.252.220.66

DstPort=21

-------------------

PORT command

“Connect to me at


IP=192.168.0.1


Port=20”

NAPT translator

ExternalIP=129.95.50.3

Packet #1 after NAPT

SrcIP=129.95.50.3

SrcPort=2000

DstIP=131.252.220.66

DstPort=21

--------------------

PORT command

“Connect to me at


IP=129.95.50.3


Port=2001”

Network Layer

4
-
100

ftp, NAT, and PORT command


Solution #2


Passive (PASV) mode


Client initiates control connection to port 21 on server


Client enables “Passive” mode


Server responds with PORT command giving client the
IP address and port to use for subsequent data
connection (usually port 20, but can be bypassed)


Client initiates data connection by connecting to
specified port on server


Most web browsers do PASV
-
mode ftp

Network Layer

4
-
101

ftp, NAT, and PORT command


PASV mode transfers

192.168.0.1

192.168.0.2

NAPT translator

ExternalIP=129.95.50.3

After PASV command

SrcIP=131.252.220.66

SrcPort=21

DstIP=129.95.50.3

DstPort=2000

--------------------

PORT command

“Connect to me at


IP=131.252.220.66


Port=20”

Network Layer

4
-
102

ftp, NAT, and PORT command


Solution #2


What if server is behind a NAT device?


See client issues


What if both client and server are behind NAT
devices?


Problem


Similar to P2P xfers and Skype


See IETF STUN WG


Network Layer

4
-
103

Chapter 4: Network Layer


4. 1 Introduction


4.2 Virtual circuit and
datagram networks


4.3 What’s inside a
router


4.4 IP: Internet
Protocol


Datagram format


IPv4 addressing


ICMP


IPv6


4.5 Routing algorithms


Link state


Distance Vector


Hierarchical routing


4.6 Routing in the
Internet


RIP


OSPF


BGP


4.7 Broadcast and
multicast routing


Network Layer

4
-
104

ICMP: Internet Control Message Protocol


Essentially a network
-
layer
protocol for passing control
messages


used by hosts & routers to
communicate network
-
level
information


error reporting: unreachable
host, network, port, protocol


echo request/reply (used by
ping)


network
-
layer “above” IP:


ICMP msgs carried in IP
datagrams


ICMP message:

type, code plus
first 8 bytes of IP datagram
causing error


http://www.rfc
-
editor.org/rfc/rfc792.txt

Type

Code

description

0 0 echo reply (ping)

3 0 dest. network unreachable

3 1 dest host unreachable

3 2 dest protocol unreachable

3 3 dest port unreachable

3 6 dest network unknown

3 7 dest host unknown

4 0 source quench (congestion


control
-

not used)

8 0 echo request (ping)

9 0 route advertisement

10 0 router discovery

11 0 TTL expired

12 0 bad IP header


Network Layer

4
-
105

ICMP and traceroute


What do “real” Internet delay & loss look like?


Traceroute

program:

provides delay
measurement from source to router along end
-
end
Internet path towards destination. For all
i:


sends three packets that will reach router
i

on path
towards destination


router
i

will return packets to sender


sender times interval between transmission and reply.


3 probes

3 probes

3 probes

Network Layer

4
-
106

ICMP and traceroute


Source sends series of
UDP segments to dest


First has TTL =1


Second has TTL=2, etc.


Unlikely port number


When nth datagram arrives
to nth router:


Router discards datagram


And sends to source an
ICMP message (type 11,
code 0)


Message includes name of
router& IP address


When ICMP message
arrives, source calculates
RTT


Traceroute does this 3
times

Stopping criterion


UDP segment eventually
arrives at destination host


Destination returns ICMP
“host unreachable” packet
(type 3, code 3)


When source gets this
ICMP, stops.

Network Layer

4
-
107

Examples

1 cs
-
gw (128.119.240.254) 1 ms 1 ms 2 ms

2 border1
-
rt
-
fa5
-
1
-
0.gw.umass.edu (128.119.3.145) 1 ms 1 ms 2 ms

3 cht
-
vbns.gw.umass.edu (128.119.3.130) 6 ms 5 ms 5 ms

4 jn1
-
at1
-
0
-
0
-
19.wor.vbns.net (204.147.132.129) 16 ms 11 ms 13 ms

5 jn1
-
so7
-
0
-
0
-
0.wae.vbns.net (204.147.136.136) 21 ms 18 ms 18 ms

6 abilene
-
vbns.abilene.ucaid.edu (198.32.11.9) 22 ms 18 ms 22 ms

7 nycm
-
wash.abilene.ucaid.edu (198.32.8.46) 22 ms 22 ms 22 ms

8 62.40.103.253 (62.40.103.253) 104 ms 109 ms 106 ms

9 de2
-
1.de1.de.geant.net (62.40.96.129) 109 ms 102 ms 104 ms

10 de.fr1.fr.geant.net (62.40.96.50) 113 ms 121 ms 114 ms

11 renater
-
gw.fr1.fr.geant.net (62.40.103.54) 112 ms 114 ms 112 ms

12 nio
-
n2.cssi.renater.fr (193.51.206.13) 111 ms 114 ms 116 ms

13 nice.cssi.renater.fr (195.220.98.102) 123 ms 125 ms 124 ms

14 r3t2
-
nice.cssi.renater.fr (195.220.98.110) 126 ms 126 ms 124 ms

15 eurecom
-
valbonne.r3t2.ft.net (193.48.50.54) 135 ms 128 ms 133 ms

16 194.214.211.25 (194.214.211.25) 126 ms 128 ms 126 ms

17 * * *

18 * * *

19 fantasia.eurecom.fr (193.55.113.142) 132 ms 128 ms 136

ms

traceroute:

gaia.cs.umass.edu to www.eurecom.fr

Three delay measurements from

gaia.cs.umass.edu to cs
-
gw.cs.umass.edu

* means no response (probe lost, router not replying)

trans
-
oceanic

link

Network Layer

4
-
108

Try it


Some routers labeled with airport code of
city they are located in


traceroute
www.yahoo.com


Packets go to SEA, back to PDX, SJC


traceroute
www.oregonlive.com


Packets go to SMF, SFO, SJC, NYC, EWR.


traceroute
www.uoregon.edu


Packets go to Pittock block to Eugene


traceroute
www.lclark.edu


Packets go to SEA and back to PDX


Network Layer

4
-
109

Chapter 4: Network Layer


4. 1 Introduction


4.2 Virtual circuit and
datagram networks


4.3 What’s inside a
router


4.4 IP: Internet
Protocol


Datagram format


IPv4 addressing


ICMP


IPv6


4.5 Routing algorithms


Link state


Distance Vector


Hierarchical routing


4.6 Routing in the
Internet


RIP


OSPF


BGP


4.7 Broadcast and
multicast routing


Network Layer

4
-
110

IPv6


Redefine functions of IP (version 4)


What changes should be made in….


IP addressing


IP delivery semantics


IP quality of service


IP security


IP routing


IP fragmentation


IP error detection

Network Layer

4
-
111

IPv6


Initial motivation:

32
-
bit address space soon
to be completely allocated (est. 2008)


Additional motivation:


Remove ancillary functionality


Speed processing/forwarding


Add missing, but essential functionality



header changes to facilitate QoS


new “anycast” address: route to “best” of several
replicated servers

IPv6 datagram format:



fixed
-
length 40 byte header


no fragmentation allowed

Network Layer

4
-
112

IPv6 Header (Cont)

Priority:

identify priority among datagrams in flow

Flow Label:

identify datagrams in same “flow.”


(concept of“flow” not well defined).

Next header:

identify next protocol for data

Network Layer

4
-
113

IPv6 Changes


Scale


addresses are 128bit


Header size?


Simplification


Removes infrequently used parts of header


40 byte fixed header vs. 20+ byte variable header


IPv6 removes checksum


IPv4 checksum = provide extra protection on top of data
-
link layer and below transport layer


End
-
to
-
end principle


Is this necessary?


IPv6 answer =>No


Relies on upper layer protocols to provide integrity


Reduces processing time at each hop

Network Layer

4
-
114

IPv6 Changes


IPv6 eliminates fragmentation


Requires path MTU discovery


ICMPv6:
new version of ICMP


additional message types, e.g. “Packet Too Big”


Protocol field replaced by next header field


Unify support for protocol demultiplexing as well as
option processing


Option processing


Options allowed, but only outside of header, indicated by
“Next Header” field


Options header does not need to be processed by every
router


Large performance improvement


Makes options practical/useful

Network Layer

4
-
115

IPv6 Changes


TOS replaced with traffic class octet


Support QoS via DiffServ


FlowID field


Help soft state systems, accelerate flow classification


Maps well onto TCP connection or stream of UDP packets
on host
-
port pair


Additional requirements


Support for security


Support for mobility


Easy auto
-
configuration

Network Layer

4
-
116

Transition From IPv4 To IPv6


Not all routers can be upgraded simultaneous


no “flag days”


How will the network operate with mixed IPv4 and
IPv6 routers?


Two proposed approaches:


Dual Stack
: some routers with dual stack (v6, v4) can
“translate” between formats


Tunneling:

IPv6 carried as payload in an IPv4
datagram among IPv4 routers

Network Layer

4
-
117

Tunneling

A

B

E

F

IPv6

IPv6

IPv6

IPv6

tunnel

Logical view:

Physical view:

A

B

E

F

IPv6

IPv6

IPv6

IPv6

IPv4

IPv4

Network Layer

4
-
118

Tunneling

A

B

E

F

IPv6

IPv6

IPv6

IPv6

tunnel

Logical view:

Physical view:

A

B

E

F

IPv6

IPv6

IPv6

IPv6

C

D

IPv4

IPv4

Flow: X

Src: A

Dest: F



data

Flow: X

Src: A

Dest: F



data

Flow: X

Src: A

Dest: F



data

Src:B

Dest: E

Flow: X

Src: A

Dest: F



data

Src:B

Dest: E

A
-
to
-
B:

IPv6

E
-
to
-
F:

IPv6

B
-
to
-
C:

IPv6 inside

IPv4

B
-
to
-
C:

IPv6 inside

IPv4

Network Layer

4
-
119

Dual Stack Approach


Dual
-
stack router translates b/w v4 and v6


v4 addresses have special v6 equivalents


Issue: how to translate “FlowField” of v6 ?

Network Layer

4
-
120

Chapter 4: Network Layer


4. 1 Introduction


4.2 Virtual circuit and
datagram networks


4.3 What’s inside a
router


4.4 IP: Internet
Protocol


Datagram format


IPv4 addressing


ICMP


IPv6


4.5
Routing algorithms


Link state


Distance Vector


Hierarchical routing


4.6 Routing in the
Internet


RIP


OSPF


BGP


4.7 Broadcast and
multicast routing


Network Layer

4
-
121

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 dest.


routing algorithms


analogy:


routing:

process of
planning trip from
source to dest


forwarding:

process
of getting through
single interchange


Network Layer

4
-
122

1

2

3

0111

value in arriving

packet’s header

routing algorithm

local forwarding table

header value

output link

0100

0101

0111

1001

3

2

2

1

Interplay between routing, forwarding


Previously: Forward
based on forwarding
table


Q: How to generate
forwarding tables?


Routing algorithms
and protocols

Network Layer

4
-
123

Who handles IP routing functions?


Source (IP source routing)


Network edge devices


Network routers

Network Layer

4
-
124

Source Routing


IP source route option


Packet carries path to destination


Entire path (strict)


Partial path (loose)


Attach list of IP addresses within header


Router processing


Examine first step in directions


Increment pointer offset in header


Forward to step


Copy entire source route header on fragmentation

Network Layer

4
-
125

Source Routing Example

Receiv
er

Packet

R1/R2/R3

Sender

2

3

4

1

2

3

4

1

2

3

4

1

R2

R3

R1

R2/R3

R3

Network Layer

4
-
126

Source Routing


Advantages


Switches can be very simple and fast


Disadvantages


Variable (unbounded) header size


Sources must know or discover topology (e.g., failures)


Typical use


Ad
-
hoc networks (DSR)


Machine room networks (Myrinet)

Network Layer

4
-
127

Network edge device routing


Virtual circuits, tag switching


Connection setup phase


Map IP route into appropriate label, wavelength,
circuit at the network edge


Switch on label, wavelength, circuit ID in core


ATM, MPLS, lambda switching


In
-
network processing


Lookup flow ID


simple table lookup


Potentially replace flow ID with outgoing flow ID


Forward to output port

Network Layer

4
-
128

Virtual Circuits Examples

Receiver

edge

Packet

1,5


3,7

Sender

edge

2

3

4

1

1,7


4,2

2

3

4

1

2

3

4

1

2,2


3,6

R2

R3

R1

5

7

2

6

Network Layer

4
-
129

Virtual Circuits


Advantages


More efficient lookup (simple table lookup)


Easier for hardware implementations


More flexible (different path for each flow)


Can reserve bandwidth at connection setup


Disadvantages


Still need to route connection setup request


More complex failure recovery


must recreate
connection state


Typical uses


ATM


combined with fix sized cells


MPLS


tag switching for IP networks

Network Layer

4
-
130

IP Datagrams on Virtual Circuits


Challenge


when to setup connections


At bootup time


permanent virtual circuits (PVC)


Large number of circuits


For every packet transmission


Connection setup is expensive


For every connection


What is a connection?


How to route connectionless traffic?


Based on traffic


VC for long
-
lived flows


Normal IP forwarding for all other flows

Network Layer

4
-
131

Network routers (Global IP addresses)


Hop
-
by
-
hop forwarding based on destination IP
carried by packet


Each packet has destination IP address


Each router has forwarding table of