Transcript network
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 see the animations; and 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) that you mention their source
(after all, we’d like people to use our book!)
If you post any slides 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.
Computer
Networking: A Top
Down Approach
6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012
Thanks and enjoy! JFK/KWR
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
Network Layer 4-1
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)
broadcast, multicast
instantiation, implementation in the Internet
Network Layer 4-2
Chapter 4: outline
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-3
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
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
application
transport
network
data link
physical
Network Layer 4-4
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-5
Interplay between routing and forwarding
routing algorithm
routing algorithm determines
end-end-path through network
local forwarding table
header value output link
forwarding table determines
local forwarding at this router
0100
0101
0111
1001
3
2
2
1
value in arriving
packet’s header
0111
1
3 2
Network Layer 4-6
Interplay between routing and forwarding
The routing algorithm may be centralized
with an algorithm executing on a central site and
downloading routing information to each of the
routers)
or may be decentralized
with a piece of the distributed routing algorithm
running in each router
In either case, a router receives routing protocol
messages, which are used to configure its
forwarding table.
Network Layer 4-7
Connection setup
3rd important function in some network
architectures:
ATM, frame relay, X.25
before datagrams flow, two end hosts and
intervening routers establish virtual connection
routers get involved
network vs transport layer connection service:
network: between two hosts (may also involve intervening
routers in case of VCs)
transport: between two processes
Network Layer 4-8
Network service model
Q: What service model for “channel” transporting
datagrams from sender to receiver?
example services for
individual datagrams:
guaranteed delivery
guaranteed delivery with
with bounded delay
example services for a flow
of datagrams:
less than 40 msec delay
in-order datagram
delivery
guaranteed minimum
bandwidth to flow
restrictions on changes in
inter-packet spacing
security services
Network Layer 4-9
Network layer service models:
Network
Architecture
Internet
Service
Model
Guarantees ?
Congestion
Bandwidth Loss Order Timing feedback
best effort none
ATM
CBR
ATM
VBR
ATM
ABR
ATM
UBR
constant
rate
guaranteed
rate
guaranteed
minimum
none
no
no
no
yes
yes
yes
yes
yes
yes
no
yes
no
no (inferred
via loss)
no
congestion
no
congestion
yes
no
yes
no
no
Network Layer 4-10
ATM Network Services
Constant bit rate (CBR) ATM network service
the first ATM service model to be standardized,
service for carrying real-time, constant bit rate audio and video
traffic.
Goal: to provide a flow of packets with a virtual pipe whose
properties are the same as if a dedicated fixed-bandwidth
transmission link existed between sending and receiving hosts
Available bit rate (ABR) ATM network service
a minimum cell transmission rate is guaranteed to a connection
using ABR service
Variable Bit Rate (VBR) ATM network service
transport traffic at variable rates
Unspecified Bit Rate (UBR) ATM network service
used for applications that are very tolerant of delay and cell loss
Network Layer 4-11
Chapter 4: outline
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-12
Connection, connection-less service
datagram network provides network-layer
connectionless service
virtual-circuit network provides network-layer
connection service
analogous to TCP/UDP connecton-oriented /
connectionless transport-layer services, but:
service: host-to-host
no choice: network provides one or the other
implementation: in network core
Network Layer 4-13
Virtual circuits
“source-to-dest path behaves much like telephone
circuit”
performance-wise
network actions along source-to-dest path
call setup, teardown for each call before data can flow
each packet carries VC identifier (not destination host
address)
every router on source-dest path maintains “state” for
each passing connection
link, router resources (bandwidth, buffers) may be
allocated to VC (dedicated resources = predictable
service)
Network Layer 4-14
VC implementation
a VC consists of:
1. path from source to destination
2. VC numbers, one number for each link along path
3. entries in forwarding tables in routers along path
packet belonging to VC carries VC number
(rather than dest address)
VC number can be changed on each link.
new VC number comes from forwarding table
If a common VC number were required for all links
along the path, the routers would have to exchange
and process a substantial number of messages to
agree on a common VC number
Network Layer 4-15
VC forwarding table
22
12
1
1
2
3
1
…
3
VC number
interface
number
forwarding table in
northwest router:
Incoming interface
2
32
Incoming VC #
12
63
7
97
…
Outgoing interface
Outgoing VC #
3
1
2
3
22
18
17
87
…
…
VC routers maintain connection state information!
Network Layer 4-16
Virtual circuits: signaling protocols
used to setup, maintain, teardown VC
The messages that the end systems send into the
network to initiate or terminate a VC, and the
messages passed between the routers to set up the VC
are known as signaling messages
used in ATM, frame-relay, X.25
not used in today’s Internet
application
5. data flow begins
transport
4. call connected
network
1. initiate call
data link
physical
application
transport
3. accept call
network
2. incoming call
data link
physical
6. receive data
Network Layer 4-17
Datagram networks
no call setup at network layer
routers: no state about end-to-end connections
no network-level concept of “connection”
packets forwarded using destination host address
application
transport
network 1. send datagrams
data link
physical
application
transport
2. receive datagrams network
data link
physical
Network Layer 4-18
Datagram forwarding table
routing algorithm
local forwarding table
dest address output link
address-range 1
address-range 2
address-range 3
address-range 4
4 billion IP addresses, so
rather than list individual
destination address
list range of addresses
(aggregate table entries)
3
2
2
1
IP destination address in
arriving packet’s header
1
3 2
Network Layer 4-19
Datagram forwarding table
Destination Address Range
Link Interface
11001000 00010111 00010000 00000000
through
11001000 00010111 00010111 11111111
0
11001000 00010111 00011000 00000000
through
11001000 00010111 00011000 11111111
1
11001000 00010111 00011001 00000000
through
11001000 00010111 00011111 11111111
2
otherwise
3
Q: but what happens if ranges don’t divide up so nicely?
Network Layer 4-20
Longest prefix matching
longest prefix matching
when looking for forwarding table entry for given
destination address, use longest address prefix that
matches destination address.
Destination Address Range
Link interface
11001000 00010111 00010*** *********
0
11001000 00010111 00011000 *********
1
11001000 00010111 00011*** *********
2
otherwise
3
examples:
DA: 11001000 00010111 00010110 10100001
DA: 11001000 00010111 00011000 10101010
which interface?
which interface?
Network Layer 4-21
Maintaining Forwarding Tables
Routers in datagram networks maintain no
connection state information, but:
they maintain forwarding state information in their
forwarding tables.
The time scale at which this forwarding state
information changes is relatively slow.
forwarding tables are modified by the routing
algorithms, which typically update a forwarding table
every one-to-five minutes
Network Layer 4-22
Datagram or VC network: why?
Internet (datagram)
data exchange among
computers
ATM (VC)
strict timing, reliability
requirements
need for guaranteed service
“elastic” service, no strict
timing req.
many link types
different characteristics
uniform service difficult
“smart” end systems
(computers)
can adapt, perform control,
error recovery
A new service can be
deployed in a remarkably
short period of time
simple inside network,
complexity at “edge”
evolved from telephony
human conversation:
“dumb” end systems
telephones
complexity inside
network
Network Layer 4-23
Chapter 4: outline
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-24
Router architecture overview
two key router functions:
run routing algorithms/protocol (RIP, OSPF, BGP)
forwarding datagrams from incoming to outgoing link
forwarding tables computed,
pushed to input ports
routing
processor
executes
routing
algorithms
routing, management
control plane (software)
forwarding data
plane (hardware)
high-seed
switching
fabric
router input ports
router output ports
Network Layer 4-25
Router architecture overview
router’s input ports, output ports, and switching
fabric together implement the forwarding
function and are almost always implemented in
hardware
referred to as the router forwarding plane
forwarding plane operates at the nanosecond time
scale
a router’s control functions: executing the routing
protocols, responding to attached links that go up
or down, and performing management functions
These router control plane functions are usually
implemented in software
operate at the millisecond or second timescale
Network Layer 4-26
Input port functions
link
layer
protocol
(receive)
line
termination
lookup,
forwarding
switch
fabric
queueing
physical layer:
bit-level reception
data link layer:
e.g., Ethernet
see chapter 5
decentralized switching:
given datagram dest., lookup output port
using forwarding table in input port
memory (“match plus action”)
goal: complete input port processing at
‘line speed’
queuing: if datagrams arrive faster than
forwarding rate into switch fabric
Network Layer 4-27
Input port functions
The lookup performed in the input port is central to the
router’s operation
it is here that the router uses the forwarding table to look up the
output port
port here— referring to the physical input and output router
interfaces
The forwarding table is copied from the routing processor
to the input line cards over a separate bus
Besides lookup, many other actions must be taken:
(1) physical- and link-layer processing must occur
(2) the packet’s version number, checksum and time-to-live field
(3) counters used for network management (such as the number
of IP datagrams received) must be updated
Network Layer 4-28
Switching fabrics
transfer packet from input buffer to appropriate
output buffer
switching rate: rate at which packets can be
transfer 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
Network Layer 4-29
Switching via memory
first generation routers:
traditional
computers with switching under direct control
of CPU
packet copied to system’s memory
speed limited by memory bandwidth
if the memory bandwidth is such that B packets per second can be written
into, or read from, memory, then the overall forwarding throughput must
be less than B/2
input
port
(e.g.,
Ethernet)
memory
output
port
(e.g.,
Ethernet)
system bus
Network Layer 4-30
Switching via a bus
datagram from input port memory
to output port memory via a
shared bus
If multiple packets arrive to the
router at the same time, each at a
different input port, all but one must
wait since only one packet can cross
the bus at a time
bus
bus contention: switching speed
limited by bus bandwidth
32 Gbps bus, Cisco 5600: sufficient
speed for access and enterprise
routers
Network Layer 4-31
Switching via interconnection network
overcome bus bandwidth limitations
interconnection networks initially
developed to connect processors in
multiprocessor
A crossbar switch is an interconnection
network consisting of 2N buses that
connect N input ports to N output ports
A-to-Y and B-to-X packets can be forwarded at
crossbar
the same time
Cisco 12000: switches 60 Gbps through
the interconnection network
allow packets from different input ports to
proceed towards the same output port at the
same time
Network Layer 4-32
Output ports
switch
fabric
datagram
buffer
queueing
link
layer
protocol
(send)
line
termination
takes packets that have been stored in the output
port’s memory and transmits them over the
output link
buffering required when datagrams arrive from
fabric faster than the transmission rate
scheduling discipline chooses among queued
datagrams for transmission
Network Layer 4-33
Output port queueing
switch
fabric
at t, packets more
from input to output
switch
fabric
one packet time later
buffering when arrival rate via switch exceeds
output line speed
queueing (delay) and loss due to output port buffer
overflow!
Network Layer 4-34
How much buffering?
RFC 3439 rule of thumb: average buffering equal to
“typical” RTT (say 250 msec) times link capacity C
e.g., C = 10 Gpbs link: 2.5 Gbit buffer
recent recommendation: with N flows, buffering equal to
RTT . C
N
if there is not enough memory to buffer an incoming
packet, a decision must be made to either
drop the arriving packet (a policy known as drop-tail) or
remove one or more already-queued packets to make room for
the newly arrived packet
In some cases, it may be advantageous to drop a packet
before the buffer is full in order to provide a congestion
signal to the sender
Network Layer 4-35
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
switch
fabric
output port contention:
only one red datagram can be
transferred.
lower red packet is blocked
switch
fabric
one packet time later:
green packet
experiences HOL
blocking
Network Layer 4-36
Chapter 4: outline
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-37
The Internet network layer
host, router network layer functions:
transport layer: TCP, UDP
IP protocol
routing protocols
network
layer
• addressing conventions
• datagram format
• packet handling conventions
• path selection
• RIP, OSPF, BGP
forwarding
table
ICMP protocol
• error reporting
• router
“signaling”
link layer
physical layer
Network Layer 4-38
IP datagram format
IP protocol version
number
header length
(bytes)
“type” of data
max number
remaining hops
(decremented at
each router)
upper layer protocol
to deliver payload to
how much overhead?
20 bytes of TCP
20 bytes of IP
= 40 bytes + app
layer overhead
32 bits
head. type of
length
ver
len service
fragment
flgs
16-bit identifier
offset
upper
time to
header
layer
live
checksum
32 bit source IP address
32 bit destination IP address
options (if any)
data
(variable length,
typically a TCP
or UDP segment)
total datagram
length (bytes)
for
fragmentation/
reassembly
used only
when an IP
datagram
reaches its
final
destination
e.g. timestamp,
record route
taken, specify
list of routers
to visit.
Network Layer 4-39
IP fragmentation, reassembly
fragmentation:
in: one large datagram
out: 3 smaller datagrams
…
reassembly
…
network links have MTU
(max.transfer size) 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
IP header bits used to
identify, order related
fragments
Network Layer 4-40
IP fragmentation, reassembly
example:
4000 byte datagram
MTU = 1500 bytes
1480 bytes in
data field
offset =
1480/8
length ID fragflag
=4000 =x
=0
offset
=0
one large datagram becomes
several smaller datagrams
length ID fragflag
=1500 =x
=1
offset
=0
length ID fragflag
=1500 =x
=1
offset
=185
length ID fragflag
=1040 =x
=0
offset
=370
Network Layer 4-41
Chapter 4: outline
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-42
IP addressing: introduction
IP address: 32-bit
223.1.1.1
identifier for host, router
interface
223.1.1.2
interface: connection
between host/router and
physical link
223.1.2.1
223.1.1.4
223.1.3.27
223.1.1.3
223.1.2.2
router’s 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.2.9
223.1.3.1
223.1.3.2
223.1.1.1 = 11011111 00000001 00000001 00000001
223
1
1
1
Network Layer 4-43
IP addressing: introduction
Q: how are interfaces
actually connected?
A: we’ll learn about that
in chapter 5, 6.
223.1.1.1
223.1.2.1
223.1.1.2
223.1.1.4
223.1.1.3
223.1.2.9
223.1.3.27
223.1.2.2
A: wired Ethernet interfaces
connected by Ethernet switches
223.1.3.1
For now: don’t need to worry
about how one interface is
connected to another (with no
intervening router)
223.1.3.2
A: wireless WiFi interfaces
connected by WiFi base station
Network Layer 4-44
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
can physically reach
each other without
intervening router
223.1.1.1
223.1.1.2
223.1.1.4
223.1.2.1
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.27
subnet
223.1.3.1
223.1.3.2
network consisting of 3 subnets
Network Layer 4-45
Subnets
223.1.1.0/24
223.1.2.0/24
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
223.1.1.1
223.1.1.2
223.1.1.4
223.1.2.1
223.1.2.9
223.1.2.2
223.1.1.3
223.1.3.27
subnet
223.1.3.1
223.1.3.2
223.1.3.0/24
subnet mask: /24
Network Layer 4-46
Subnets
223.1.1.2
how many?
223.1.1.1
223.1.1.4
223.1.1.3
223.1.9.2
223.1.7.0
223.1.9.1
223.1.7.1
223.1.8.1
223.1.8.0
223.1.2.6
223.1.2.1
223.1.3.27
223.1.2.2
223.1.3.1
223.1.3.2
Network Layer 4-47
IP addressing: CIDR
CIDR: 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
subnet
part
host
part
11001000 00010111 00010000 00000000
200.23.16.0/23
Network Layer 4-48
IP addressing: CIDR
The x most significant bits of an address of the
form a.b.c.d/x constitute the network portion of
the IP address, and are often referred to as the
prefix (or network prefix) of the address.
An organization is typically assigned a block of
contiguous addresses, that is, a range of addresses with
a common prefix
when a router outside the organization forwards
a datagram whose destination address is inside
the organization, only the leading x bits of the
address need be considered.
This considerably reduces the size of the forwarding
table in these routers
Network Layer 4-49
IP addressing: CIDR
Another type of IP address, the IP broadcast
address 255.255.255.255
When a host sends a datagram with destination
address 255.255.255.255, the message is delivered
to all hosts on the same subnet
Network Layer 4-50
Next week
Having now studied IP addressing in detail
Next week
how hosts and subnets get their addresses in the first
place
Network Layer 4-51