Null 20
Null 20
By
KASULA RAGHU
Assistant Professor
Dept. of E.C.E.
MGIT
KASULA RAGHU 1
Unit - III
The Network Layer
Computer
Networking: A Top
Down Approach
6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012
KASULA RAGHU 2
Introduction
In this Chapter we will discuss the difference between Forwarding and
Routing functions of the Network Layer
Routing involves all of the network’s routers, which collectively interact via
Routing Protocols determines the path that the packet takes on their trip from
source to destination node.
KASULA RAGHU 3
• In order to understand the Packet forwarding we will look “inside”
the Router- at its hardware Architecture and Organization. We will
the look at packet forwarding in the internet along with the
Internet Protocol(IP).
network
physical
layer physical
network
passing through it
KASULA RAGHU 5
Network layer
• Transport segment from sending to receiving
host network network
data link data link
• on sending side encapsulates segments into End SYS. H1
application
network
data link
physical
physical physical
network network
Datagram's transport
network data link
physical
data link
physical
data link
KASULA RAGHU 6
Two key network-layer functions:
• Forwarding: move packets from router’s input to appropriate router output
• Routing: determine route taken by packets from source to destination.
• routing algorithms
Analogy:
forwarding: process of getting through single interchange
routing: process of planning trip from source to destination.
KASULA RAGHU 7
Interplay between routing and forwarding
value in arriving
packet’s header
0111 1
3 2
KASULA RAGHU 8
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
KASULA RAGHU 9
Network service model
The network service model defines the characteristics of end-to-end transport
of packets between sending and receiving end systems.
KASULA RAGHU 10
Network layer services:
KASULA RAGHU 11
Network layer services:
• In-order packet delivery: This service guarantees that packets arrive at the
destination in the order that they were sent.
• Guaranteed minimal bandwidth: This network-layer service emulates the
behavior of a transmission link of a specified bit rate (for example, 1 Mbps)
between sending and receiving hosts. As long as the sending host transmits bits (as
part of packets) at a rate below the specified bit rate, then no packet is lost and
each packet arrives within a prespecified host-to-host delay (for example, within 40
msec).
• Guaranteed maximum jitter: This service guarantees that the amount of time
between the transmission of two successive packets at the sender is equal to the
amount of time between their receipt at the destination (or that this spacing
changes by no more than some specified value).
KASULA RAGHU 12
Network layer services:
• Security services: Using a secret session key known only by a source and
destination host, the network layer in the source host could encrypt the payloads
of all datagrams being sent to the destination host. The network layer in the
destination host would then be responsible for decrypting the payloads.
• Two of the more important ATM service models are constant bit rate (CBR)and
available bit rate service(ABR).
KASULA RAGHU 13
Connection, connection-less service
datagram network provides network-layer connectionless service
virtual-circuit network provides network-layer connection service
analogous to TCP/UDP connection-oriented / connectionless
transport-layer services, but implementation of connection-oriented
service in the transport layer and the connection service in the
network layer are fundamentally different.
The network-layer connection service is implemented in the
routers in the network core as well as in the end systems but
transport-layer connection-oriented service is implemented at the
edge of the network in the end systems.
KASULA RAGHU 14
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)
KASULA RAGHU 15
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
KASULA RAGHU 16
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
… … … …
KASULA RAGHU 18
Virtual Circuits Networks
• VC teardown: This is initiated when the sender (or receiver) informs the network
layer of its desire to terminate the VC. The network layer will then typically inform the
end system on the other side of the network of the call termination and update the
forwarding tables in each of the packet routers on the path to indicate that the VC no longer
exists.
• There is a subtle but important distinction between VC setup at the network layer and
connection setup at the transport layer.
• Connection setup at the transport layer involves only the two end systems. During
transport-layer connection setup, the two end systems alone determine the parameters of
their transport-layer connection.
• Although the two end systems are aware of the transport-layer connection, the routers
within the network are completely oblivious to it.
• On the other hand, with a VC network layer, routers along the path between the two end
systems are involved in VC setup, and each router is fully aware of all the VCs passing
through it.
KASULA RAGHU 19
Virtual circuit Set Up :
• 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 (that is, to modify connection
state in router tables) are known as signaling messages, and the protocols used to
exchange these messages are often referred to as signaling protocols. VC setup is shown
pictorially in below Figure.
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
KASULA RAGHU 20
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
KASULA RAGHU 21
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 link
(aggregate table entries)
address-range 1 3
address-range 2 2
address-range 3 2
address-range 4 1
IP destination address in
arriving packet’s header
1
3 2
KASULA RAGHU 22
Datagram forwarding table
Destination Address Range Link Interface
otherwise 3
examples:
DA: 11001000 00010111 00010110 10100001 which interface?
DA: 11001000 00010111 00011000 10101010 which interface?
KASULA RAGHU 24
Datagram or VC network: why?
Internet (datagram) ATM (VC)
• data exchange among • evolved from telephony
computers • human conversation:
• “elastic” service, no strict • strict timing, reliability
timing 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”
KASULA RAGHU 25
Router architecture overview
two key router functions:
run routing algorithms/protocol
forwarding datagrams from incoming to outgoing link
forwarding data
plane (hardware)
high-seed
switching
fabric
lookup,
link forwarding
line layer switch
termination protocol fabric
(receive)
queueing
physical layer:
bit-level reception
data link layer: 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
KASULA RAGHU 27
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
KASULA RAGHU 28
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 (2 bus crossings per datagram)
input output
port memory port
(e.g., (e.g.,
Ethernet) Ethernet)
system bus
KASULA RAGHU 29
Switching via a bus
datagram from input port memory
to output port memory via a shared bus
bus contention: switching speed limited by
bus bandwidth
32 Gbps bus, Cisco 5600: sufficient speed for
access and enterprise routers bus
KASULA RAGHU 30
Switching via interconnection network
overcome bus bandwidth limitations
banyan networks, crossbar, other
interconnection nets initially developed to
connect processors in multiprocessor
advanced design: fragmenting datagram into
fixed length cells, switch cells through the fabric.
crossbar
Cisco 12000: switches 60 Gbps through the
interconnection network
KASULA RAGHU 31
Output ports
datagram
switch buffer link
fabric layer line
protocol termination
queueing (send)
buffering required when datagrams arrive from fabric faster than the
transmission rate Datagram (packets) can be lost
due to congestion, lack of buffers
scheduling discipline chooses among queued datagrams for transmission
Priority scheduling – who gets best
performance, network neutrality
KASULA RAGHU 32
Output port queueing
switch
switch
fabric
fabric
• buffering when arrival rate via switch exceeds output line speed
• queueing (delay) and loss due to output port buffer overflow!
KASULA RAGHU 33
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 switch
fabric fabric
physical layer
KASULA RAGHU 36
The Internet Protocol (IP)
KASULA RAGHU 37
Datagram Format
• A network-layer packet is referred to as a datagram.
• We begin our study of IP with an overview of the syntax and semantics of the
IPv4 datagram.
• IPv4 datagram format is shown in below Figure . The key fields in the IPv4
datagram are the following:
• Version number : These 4 bits specify the IP protocol version of the
datagram. By looking at the version number, the router can determine how to
interpret the remainder of the IP datagram. Different versions of IP use
different datagram formats.
• Header length: Because an IPv4 datagram can contain a variable number of
options, these 4 bits are needed to determine where in the IP datagram the data
actually begins. Most IP datagrams do not contain options, so the typical IP
datagram has a 20-byte header.
KASULA RAGHU 38
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
(variable length, list of routers
20 bytes of TCP
typically a TCP to visit.
20 bytes of IP
or UDP segment)
= 40 bytes + app
layer overhead
KASULA RAGHU 39
Datagram Format
• Type of service: The type of service (TOS) bits were included in the IPv4 header to allow
different types of IP datagrams (for example, datagrams particularly requiring low delay,
high throughput, or reliability) to be distinguished from each other. For example, it might be
useful to distinguish real-time datagrams (such as those used by an IP telephony application)
from non-real-time traffic (for example, FTP).
• Datagram length. This is the total length of the IP datagram (header plus data), measured in
bytes. Since this field is 16 bits long, the theoretical maximum size of the IP datagram is
65,535 bytes. However, datagrams are rarely larger than 1,500 bytes.
KASULA RAGHU 40
Datagram Format
• Identifier, flags, fragmentation offset: These three fields have to do
with so-called IP fragmentation. Interestingly, the new version of IP,
IPv6, does not allow for fragmentation at routers.
• Time-to-live: The time-to-live (TTL) field is included to ensure that
datagrams do not circulate forever in the network. This field is
decremented by one each time the datagram is processed by a router. If
the TTL field reaches 0, the datagram must be dropped.
• Protocol: This field is used only when an IP datagram reaches its
final destination. The value of this field indicates the specific
transport-layer protocol to which the data portion of this IP datagram
should be passed. For example, a value of 6 indicates that the data
portion is passed to TCP, while a value of 17 indicates that the data is
passed to UDP
KASULA RAGHU 41
Datagram Format
• For a list of all possible values, see [IANA Protocol Numbers 2012]. Note
that the protocol number in the IP datagram has a role that is analogous to
the role of the port number field in the transport-layer segment. The
protocol number is the glue that binds the network and transport layers
together, whereas the port number is the glue that binds the transport and
application layers together.
• Header checksum: The header checksum aids a router in detecting bit
errors in a received IP datagram. The header checksum is computed by
treating each 2 bytes in the header as a number and summing these numbers
using 1s complement arithmetic.
• Source and destination IP addresses: When a source creates a datagram, it
inserts its IP address into the source IP address field and inserts the address
of the ultimate destination into the destination IP address field.
KASULA RAGHU 42
Datagram Format
• Options: The options fields allow an IP header to be extended. Header options were
meant to be used rarely—hence the decision to save overhead by not including the
information in options fields in every datagram header. However, the mere existence of
options does complicate matters—since datagram header can be of variable length, one
cannot determine a priori where the data field will start. Also, since some datagrams may
require options processing and others may not, the amount of time needed to process an IP
datagram at a router can vary greatly.
• Data (payload): Finally, we come to the last and most important field, the data field of
the IP datagram contains the transport-layer segment (TCP or UDP) to be delivered to the
destination. However, the data field can carry other types of data, such as ICMP messages
KASULA RAGHU 43
Datagram Format
• Note that an IP datagram has a total of 20 bytes of header (assuming no options).
If the datagram carries a TCP segment, then each (non fragmented) datagram
carries a total of 40 bytes of header (20 bytes of IP header plus 20 bytes of TCP
header) along with the application-layer message.
KASULA RAGHU 44
IP fragmentation, reassembly
• network links have MTU (max.
transmission unit) - largest possible link-
level frame fragmentation:
…
• different link types, different MTUs in: one large datagram
out: 3 smaller datagrams
• large IP datagram divided
(“fragmented”) within net
• one datagram becomes several reassembly
datagrams
• “reassembled” only at final
destination
…
• IP header bits used to identify, order
related fragments
KASULA RAGHU 45
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
KASULA RAGHU 46
IP addressing: introduction
223.1.1.1
• interface: connection
between host/router and 223.1.1.3
223.1.3.27
KASULA RAGHU 47
IP addressing: introduction
223.1.1.1
223.1.3.27
223.1.1.3
223.1.2.2
KASULA RAGHU 49
Subnets
223.1.1.0/24
223.1.2.0/24
223.1.1.1
recipe
to determine the 223.1.1.2 223.1.2.1
223.1.1.4 223.1.2.9
subnets, detach each
interface from its host 223.1.2.2
223.1.1.3 223.1.3.27
or router, creating
subnet
islands of isolated
networks 223.1.3.2
223.1.3.1
each isolated network
is called a subnet
223.1.3.0/24
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.3.27
subnet host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23
KASULA RAGHU 52
IP addresses: how to get one?
Q: how does network get subnet part of IP addr?
A: gets allocated portion of its provider ISP’s address
space
KASULA RAGHU 53
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
KASULA RAGHU 54
IPv6 datagram format
priority: identify priority among datagrams in flow
flow Label: identify datagrams in same “flow.”
(concept of“flow” not well defined).
next header: identify upper layer protocol for data
data
32 bits
KASULA RAGHU 55
Other changes from IPv4
KASULA RAGHU 56
Thank You
KASULA RAGHU 57