0% found this document useful (0 votes)
52 views

Handouts

Uploaded by

Vijay Gadicha
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Handouts

Uploaded by

Vijay Gadicha
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 40

Unit #03

Network Layer

4-1
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:
1.
outline
introduction 5. routing algorithms
2. virtual circuit and  link state
datagram networks  distance vector
 hierarchical routing
3. what’s inside a
router 6. routing in the
 RIP
Internet
4. IP: Internet  OSPF
Protocol  BGP
 datagram format

4.7 broadcast and
IPv4 addressing

multicast routing
ICMP
 IPv6

Network Layer 4-3


Network
layersegment
 transport
application
transport
network

from sending to data link


physical
network
receiving host
network
data link data link
network physical
physical
data link
 on sending side physical network
data link
network
data link

encapsulates segments physical physical

into datagrams network


data link
network
data link

on receiving side,
physical physical
 ne twork
data link

delivers segments to physical


application

transport layer
network transport
data link network network
network physical data link data link
 network layer data link
physical
physical physical

protocols in every
host, router
 router examines
header fields in all IP Network Layer 4-4
Two key network-layer
functions
 forwarding: move analogy:
packets from
routing: process of
router’s input to
appropriate router planning trip from
output source to dest
 routing: determine forwarding: process of
route taken by getting through single
packets from source interchange
to dest.
 routing algorithms

Network Layer 4-5


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


Connection
setup
 3 important function in some network
rd

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


Chapter 4:
1.
outline
introduction 5. routing algorithms
2. virtual circuit and  link state
datagram networks  distance vector
 hierarchical routing
3. what’s inside a
router 6. routing in the
 RIP
Internet
4. IP: Internet  OSPF
Protocol  BGP
 datagram format

4.7 broadcast and
IPv4 addressing

multicast routing
ICMP
 IPv6

Network Layer 4-8


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-9
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-10
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
packetbelonging 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-11


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 6. receive
transport transport
begins data
network network
4. call 3. accept call
data link data link
connected 2. incoming
physical physical
1. initiate call call

Network Layer 4-12


Datagram
 no networks
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-13


Datagram or VC network:
why? ATM (VC)
Internet (datagram)
data evolvedfrom telephony
exchange among
computers human conversation:

 “elastic” service, no  strict timing, reliability


requirements
strict timing req.
 need for guaranteed
many link types service
 different characteristics “dumb” end systems
 uniform service difficult  telephones
“smart”end systems  complexity inside
(computers) network
 can adapt, perform
control, error recovery
 simple inside network,
complexity at “edge”

Network Layer 4-14


Chapter 4:
1.
outline
introduction 5. routing algorithms
2. virtual circuit and  link state
datagram networks  distance vector
 hierarchical routing
3. what’s inside a
router 6. routing in the
 RIP
Internet
4. IP: Internet  OSPF
Protocol  BGP
 datagram format

4.7 broadcast and
IPv4 addressing

multicast routing
ICMP
 IPv6

Network Layer 4-15


Router architecture
overview
two key router functions:
run routing algorithms/protocol (RIP, OSPF,
BGP)
forwarding datagrams from incoming to

outgoing link
forwarding tables computed, routing
pushed to input ports routing, management
processor
control plane (software)

forwarding data
plane (hardware)

high-seed
switching
fabric

router input ports router output ports


Network Layer 4-16
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-17


Chapter 4:
1.
outline
introduction 5. routing algorithms
2. virtual circuit and  link state
datagram networks  distance vector
 hierarchical routing
3. what’s inside a
router 6. routing in the
 RIP
Internet
4. IP: Internet  OSPF
Protocol  BGP
 datagram format

4.7 broadcast and
IPv4 addressing

multicast routing
ICMP
 IPv6

Network Layer 4-18


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


IP datagram
format
IP protocol version
number header length
32 bits total datagram
(bytes) ver head. type of
length (bytes)
“type” of data len service length
for
fragment fragmentation/
max number 16-bit identifier flgs
offset reassembly
remaining hops time to upper header
(decremented at each live layer checksum
router)
32 bit source IP address
upper layer protocol
32 bit destination IP address
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 or to visit.
UDP segment)
 = 40 bytes +
app layer overhead

Network Layer 4-20


IP fragmentation,

reassembly
network links have MTU
(max.transfer size) -
largest possible link- fragmentation:


level frame in: one large datagram
 different link types, out: 3 smaller datagrams

different MTUs
 large IP datagram
divided reassembly
(“fragmented”) within
net
 one datagram …
becomes several
datagrams
 “reassembled” only
at final destination
 IP header bits used Network Layer 4-21
Chapter 4:
1.
outline
introduction 5. routing algorithms
2. virtual circuit and  link state
datagram networks  distance vector
 hierarchical routing
3. what’s inside a
router 6. routing in the
 RIP
Internet
4. IP: Internet  OSPF
Protocol  BGP
 datagram format

4.7 broadcast and
IPv4 addressing

multicast routing
ICMP
 IPv6

Network Layer 4-22


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
(more shortly)
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

Network Layer 4-23


DHCP client-server
scenario
DHCP server: 223.1.2.5 DHCP discover
src : 0.0.0.0, 68
arriving
client
Broadcast: is there a
dest.: 255.255.255.255,67
DHCP server out
yiaddr: there?
0.0.0.0
transaction ID: 654

DHCP offer
src: 223.1.2.5, 67
Broadcast: I’m a DHCP
dest: 255.255.255.255, 68
server! Here’s an IP
yiaddrr: 223.1.2.4
transaction ID: 654
address you can use
lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
Broadcast: OK. 223.1.2.4
yiaddrr: I’ll take that
IP address!
transaction ID: 655
lifetime: 3600 secs

DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
Broadcast: OK. You’ve
yiaddrr: 223.1.2.4
got
that IP transaction
address!ID: 655
lifetime: 3600 secs

Network Layer 4-24


Chapter 4:
1.
outline
introduction 5. routing algorithms
2. virtual circuit and  link state
datagram networks  distance vector
 hierarchical routing
3. what’s inside a
router 6. routing in the
 RIP
Internet
4. IP: Internet  OSPF
Protocol  BGP
 datagram format

4.7 broadcast and
IPv4 addressing

multicast routing
ICMP
 IPv6

Network Layer 4-25


ICMP: internet control message
protocol
 used by hosts & routers
Type Code description
to communicate 0 0 echo reply (ping)
network- level 3 0 dest. network unreachable
information 3 1 dest host unreachable
 error reporting: 3 2 dest protocol unreachable
unreachable host, 3 3 dest port unreachable
network, port, protocol 3 6 dest network unknown
 echo request/reply (used 3 7 dest host unknown
by ping) 4 0 source quench (congestion
 network-layer “above” control - not used)
8 0 echo request (ping)
IP: 9 0 route advertisement
 ICMP msgs carried in IP 10 0 router discovery
datagrams 11 0 TTL expired
 ICMP message: type, 12 0 bad IP header
code plus first 8 bytes
of IP datagram causing Network Layer 4-26
error
Traceroute and
 ICMP
source sends series of  when ICMP messages
UDP segments to dest arrives, source records
 first set has TTL =1 RTTs
 second set has TTL=2,
etc. stopping criteria:
 unlikely port number  UDP segment
 when nth set of eventually arrives at
datagrams arrives to destination host
nth router:  destination returns
 router discards ICMP “port
datagrams unreachable” message
 and sends source ICMP (type 3, code 3)
messages (type 11, code  source stops
0)
 ICMP messages includes
3 probes
name of router & IP
address
Network Layer 4-27
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

IPv6 datagram format:


 fixed-length 40 byte header
 no fragmentation allowed

Network Layer 4-28


IPv6 datagram
priority: format
identify priority among
datagrams in flow
flow Label: identify datagrams in same
“flow.”
(concept pri
of“flow” not well defined).
ver flow label
next header: identify
payload len upper
next hdr layer protocol
hop limit
source address (128 bits) for data

destination address (128 bits)

data

32 bits
Network Layer 4-29
Other changes from
IPv4
 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

Network Layer 4-30


Chapter 4:
1.
outline
introduction 5. routing algorithms
2. virtual circuit and  link state
datagram networks  distance vector
 hierarchical routing
3. what’s inside a
router 6. routing in the
 RIP
Internet
4. IP: Internet  OSPF
Protocol  BGP
 datagram format

4.7 broadcast and
IPv4 addressing

multicast routing
ICMP
 IPv6

Network Layer 4-31


Routing algorithm
classification
Q: global or decentralized Q: static or dynamic?
information?
static:
global: routes change slowly
 all routers have complete over time
topology, link cost info dynamic:
 “link state” algorithms
routes change more
decentralized: quickly
 router knows physically-  periodic update
connected neighbors, link  in response to link
costs to neighbors cost changes
 iterative process of
computation, exchange of
info with neighbors
 “distance vector”

algorithms Network Layer 4-32


Chapter 4:
1.
outline
introduction 5. routing algorithms
2. virtual circuit and  link state
datagram networks  distance vector
 hierarchical routing
3. what’s inside a
router 6. routing in the
 RIP
Internet
4. IP: Internet  OSPF
Protocol  BGP
 datagram format

4.7 broadcast and
IPv4 addressing

multicast routing
ICMP
 IPv6

Network Layer 4-33


A Link-State Routing
Algorithm
Dijkstra’s algorithm notation:
nettopology, link costs c(x,y): link cost from
known to all nodes node x to y; = ∞ if not
 accomplished via “link direct neighbors
state broadcast” D(v): current value of
 all nodes have same info cost of path from source
computes least cost to dest. v
paths from one node p(v): predecessor node
(‘source”) to all other along path from source to
nodes v
 gives forwarding table N': set of nodes whose
for that node least cost path
iterative: after k definitively known
iterations, know least cost
path to k dest.’s
Network Layer 4-34
Dijsktra’s
1
Algorithm
Initialization:
2 N' = {u}
3for all nodes v
4if v adjacent to u
5then D(v) = c(u,v)
6else D(v) = ∞
7
8Loop
9find w not in N' such that D(w) is a minimum
10add w to N'
11update D(v) for all v adjacent to w and not in N' : 12
D(v) = min( D(v), D(w) + c(w,v) )
13/* new cost to v is either old cost to v or known
14shortest path cost to w plus cost from w to v */
15until all nodes in N'

Network Layer 4-35


Dijkstra’s algorithm:
Step
example
N' D(v) D(w) D(x)
p(v) p(w)
D(y)
p(x) p(y) p(z)
0 u D(z)
7,u 3,u 5,u ∞ ∞
1 uw 6,w 5,u 11,w ∞
2 uwx 6,w 11,w 14,x
3 uwxv 10,v 14,x
4 uwxvy 12,y
5 uwxvyz x
9

note 5
4
7
 construct shortest path tree
s: tracing predecessor 8
by
nodes 3 w y z
u
ties can exist (can be 2
broken arbitrarily) 3
7 4
v
Network Layer 4-36
Dijkstra’s algorithm: another
example
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,
3 uxyv 3,y 4,y
y
4 uxyvw 4,y
5 uxyvwz

5
v 3 w
2 5
u 2 1 z
3
1 2
x 1
y

Network Layer 4-37


Chapter 4:
1.
outline
introduction 5. routing algorithms
2. virtual circuit and  link state
datagram networks  distance vector
 hierarchical routing
3. what’s inside a
router 6. routing in the
 RIP
Internet
4. IP: Internet  OSPF
Protocol  BGP
 datagram format

4.7 broadcast and
IPv4 addressing

multicast routing
ICMP
 IPv6

Network Layer 4-38


Distance vector
algorithm
Bellman-Ford equation (dynamic programming)

let
dx(y) := cost of least-cost path from x to y then
dx(y) = mv in {c(x,v) + dv(y) }

cost from neighbor v to destination y cost to neighbor v

min taken over all neighbors v of x

Network Layer 4-39


Bellman-Ford
example
5
clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
3
v w 5
2
u 2 1 z B-F equation says:
3
1 2
du(z) = min { c(u,v) + dv(z),
x 1
y c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
node achieving minimum is next
hop in shortest path, used in forwarding
table
Network Layer 4-40

You might also like