You are on page 1of 26

Chapter 4

Network Layer

Computer
Networking: A Top
Down Approach
6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012

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)
 broadcast, multicast
instantiation, implementation in the Internet

Network Layer 4-3


Chapter 4: outline
4.5 routing
4.1 introduction
algorithms
• link state
4.2 virtual circuit and datagram networks
• distance vector
4.3 what’s insiderouting
• hierarchical a router
4.4
4.6 IP: Internet
routing Protocol
in the Internet
•• datagram
RIP format
•• IPv4
OSPFaddressing
•• ICMP
BGP
• IPv6
4.7 broadcast and multicast routing

Network Layer 4-4


Network layer
application

• transport segment from transport


network
data link
sending to receiving host physical
network network
data link data link
• on sending side network
data link
physical physical
physical network
encapsulates segments into network
data link
physical
data link
physical
datagrams
network network

• on receiving side, delivers data link


physical
network
data link
physical

segments to transport layer data link


physical
application
• network layer protocols in network
data link network
transport
network
physical data link
every host, router network
data link
data link
physical physical
physical

• router examines header


fields in all IP datagrams
passing through it
Network Layer 4-5
Two key network-layer functions
• forwarding: move packets analogy:
from router’s input to
appropriate router output
 routing: process of
planning trip from source
• routing: determine route to dest
taken by packets from  forwarding: process of
source to dest. getting through single
• routing algorithms interchange

Network Layer 4-6


Interplay between routing and forwarding

routing algorithm routing algorithm determines


end-end-path through network

local forwarding table forwarding table determines


header value output link local forwarding at this router
0100 3
0101 2
0111 2
1001 1

value in arriving
packet’s header
0111 1

3 2

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 example services for a
individual datagrams: flow of datagrams:
guaranteed delivery • in-order datagram delivery
guaranteed delivery with • guaranteed minimum
less than 40 msec delay bandwidth to flow
• restrictions on changes in
inter-packet spacing

Network Layer 4-9


Network layer service models:
Guarantees ?
Network Service Congestion
Architecture Model Bandwidth Loss Order Timing feedback

Internet best effort none no no no no (inferred


via loss)
ATM CBR constant yes yes yes no
rate congestion
ATM VBR guaranteed yes yes yes no
rate congestion
ATM ABR guaranteed no yes no yes
minimum
ATM UBR none no yes no no

Network Layer 4-10


Chapter 4: outline
4.5 routing
4.1 introduction
algorithms
• link state
4.2 virtual circuit and datagram networks
• distance vector
4.3 what’s insiderouting
• hierarchical a router
4.4
4.6 IP: Internet
routing Protocol
in the Internet
•• datagram
RIP format
•• IPv4
OSPFaddressing
•• ICMP
BGP
• IPv6
4.7 broadcast and multicast routing

Network Layer 4-11


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-12


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-13


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

Network Layer 4-14


VC forwarding table
12 22 32

1 3
2
VC number
interface
forwarding table in number
northwest router:
Incoming interface Incoming VC # Outgoing interface Outgoing VC #

1 12 3 22
2 63 1 18
3 7 2 17
1 97 3 87
… … … …

VC routers maintain connection state information!


Network Layer 4-15
Virtual circuits: signaling protocols
• used to setup, maintain teardown VC
• used in ATM, frame-relay, X.25
• not used in today’s Internet

application application
5. data flow begins 6. receive data
transport transport
network 4. call connected 3. accept call
1. initiate call network
data link 2. incoming call
data link
physical physical

Network Layer 4-16


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 application
transport transport
network 1. send datagrams 2. receive datagrams network
data link data link
physical physical

Network Layer 4-17


Datagram forwarding table
4 billion IP addresses, so
routing algorithm rather than list individual
destination address
local forwarding table
list range of addresses
dest address output (aggregate table entries)
address-range 1 3 link
address-range 2 2
address-range 3 2
address-range 4 1

IP destination address in
arriving packet’s header
1
3 2

Network Layer 4-18


Datagram or VC network: why?
Internet (datagram) ATM (VC)
• data exchange among • evolved from telephony
computers • human conversation:
• “elastic” service, no strict timing • strict timing, reliability
req. requirements
• many link types • need for guaranteed service
• different characteristics • “dumb” end systems
• uniform service difficult • telephones
• complexity inside network
• “smart” end systems
(computers)
• can adapt, perform control, error
recovery
• simple inside network,
complexity at “edge”

Network Layer 4-19


Chapter 4: outline
4.5 routing
4.1 introduction
algorithms
• link state
4.2 virtual circuit and datagram networks
• distance vector
4.3 what’s insiderouting
• hierarchical a router
4.4
4.6 IP: Internet
routing Protocol
in the Internet
•• datagram
RIP format
•• IPv4
OSPFaddressing
•• ICMP
BGP
• IPv6
4.7 broadcast and multicast routing

Network Layer 4-20


Chapter 4: outline
4.5 routing
4.1 introduction
algorithms
• link state
4.2 virtual circuit and datagram networks
• distance vector
4.3 what’s insiderouting
• hierarchical a router
4.4
4.6 IP: Internet
routing Protocol
in the Internet
•• datagram
RIP format
•• IPv4
OSPFaddressing
•• ICMP
BGP
• IPv6
4.7 broadcast and multicast routing

Network Layer 4-21


The Internet network layer
host, router network layer functions:

transport layer: TCP, UDP

routing protocols IP protocol


 path selection  addressing conventions
 RIP, OSPF, BGP  datagram format
network  packet handling conventions
layer forwarding
table
ICMP protocol
 error reporting
 router
“signaling”
link layer

physical layer

Network Layer 4-22


IP datagram format
IP protocol version 32 bits
number total datagram
header length length (bytes)
ver head. type of length
(bytes) len service for
“type” of data fragment fragmentation/
16-bit identifier flgs
offset reassembly
max number time to upper header
remaining hops live layer checksum
(decremented at
32 bit source IP address
each router)
32 bit destination IP address
upper layer protocol
to deliver payload to options (if any) e.g. timestamp,
record route
how much overhead? data taken, specify
 20 bytes of TCP (variable length, list of routers
 20 bytes of IP
typically a TCP to visit.
 = 40 bytes + app
or UDP segment)
layer overhead

Network Layer 4-23


IP fragmentation, reassembly
• network links have MTU
(max.transfer size) - largest
possible link-level frame fragmentation:


• different link types, in: one large datagram
out: 3 smaller datagrams
different MTUs
• large IP datagram divided
(“fragmented”) within net
reassembly
• one datagram becomes
several datagrams
• “reassembled” only at …
final destination
• IP header bits used to
identify, order related
fragments
Network Layer 4-24
IP fragmentation, reassembly
length ID fragflag offset
example: =4000 =x =0 =0
 4000 byte datagram
one large datagram becomes
 MTU = 1500 bytes
several smaller datagrams

1480 bytes in length ID fragflag offset


data field =1500 =x =1 =0

offset = length ID fragflag offset


1480/8 =1500 =x =1 =185

length ID fragflag offset


=1040 =x =0 =370

Network Layer 4-25


Chapter 4: outline
4.5 routing
4.1 introduction
algorithms
• link state
4.2 virtual circuit and datagram networks
• distance vector
4.3 what’s insiderouting
• hierarchical a router
4.4
4.6 IP: Internet
routing Protocol
in the Internet
•• datagram
RIP format
•• IPv4
OSPFaddressing
•• ICMP
BGP
• IPv6
4.7 broadcast and multicast routing

Network Layer 4-26

You might also like