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

Null 20

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Null 20

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

DATA COMMUNICATIONS AND NETWORKS

Subject Code: EC502PC

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

Forwarding Involves the Transfer of packet from an incoming link to an out


going link within a single router

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

• We also investigate on Network Layer Addressing and IPv4


Datagram format and also Network Address Translation ,Data
Gram Fragmentation Internet Control Message Protocol(ICMP),
and IPv6.
KASULA RAGHU 4
Network layer
application
transport
network

• Transport segment from sending to receiving host


data link
physical

• on sending side encapsulates segments into


network
network data link network
data link physical data link
Datagram's physical

network
physical

• on receiving side, delivers segments to transport


data link
physical network
data link

layer physical

network

• Network layer protocols in every host, router


network data link
data link physical application
physical transport
network

• router examines header fields in all IP datagram's


network
data link data link
physical physical

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

• on receiving side, delivers segments to physical


network network
data link data link
transport layer physical
network
physical
data link End SYS. H2

• network layer protocols in every host, router


Router R1 physical
application
network transport

• router examines header fields in all IP


data link network network
network physical data link data link
data link physical physical
datagram's passing through it physical

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

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

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.

example services for individual example services for a flow of


datagrams: datagrams:
guaranteed delivery • in-order datagram delivery
guaranteed delivery with less than 40 • guaranteed minimum bandwidth to flow
msec delay
• restrictions on changes in inter-packet
spacing(Jitter)

KASULA RAGHU 10
Network layer services:

• Guaranteed delivery: This service guarantees that the packet will


eventually arrive at its destination.

• Guaranteed delivery with bounded delay: This service not only


guarantees delivery of the packet, but delivery within a specified host-
to-host delay bound (for example, within 100 msec).

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

VC routers maintain connection state information!


KASULA RAGHU 17
Virtual Circuits Networks

• There are three identifiable phases in a virtual circuit:


• VC setup: During the setup phase, the sending transport layer contacts the
network layer, specifies the receiver’s address, and waits for the network to set
up the VC. The network layer determines the path between sender and receiver,
that is, the series of links and routers through which all packets of the VC will
travel. The network layer also determines the VC number for each link along
the path. Finally, the network layer adds an entry in the forwarding table in each
router along the path. During VC setup, the network layer may also reserve
resources (for example, bandwidth) along the path of the VC.
• Data transfer: As shown in below Figure, once the VC has been established,
packets can begin to flow along the VC.

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

11001000 00010111 00010000 00000000


through 0
11001000 00010111 00010111 11111111

11001000 00010111 00011000 00000000


through 1
11001000 00010111 00011000 11111111

11001000 00010111 00011001 00000000


through 2
11001000 00010111 00011111 11111111

otherwise 3

Q: but what happens if ranges don’t divide up so nicely?


KASULA RAGHU 23
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 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 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


KASULA RAGHU 26
Input port functions

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

memory bus crossbar

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

at t, packets more one packet time later


from input to output

• 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

output port contention: one packet time later:


only one red datagram can be green packet
transferred. experiences HOL
lower red packet is blocked KASULA RAGHU blocking 34
The Internet Protocol (IP)

• Internet addressing and forwarding are important components of the Internet


Protocol (IP).
• There are two versions of IP in use today. We’ll first examine the widely
deployed IP protocol version 4, which is usually referred to simply as IPv4.
• We’ll examine IP version 6, which has been proposed to replace IPv4, at the
end of this section.
• As shown in below Figure , the Internet’s network layer has three major
components.
• The first component is the IP protocol.
• The second major component is the routing component, which determines
the path a datagram follows from source to destination.
KASULA RAGHU 35
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

KASULA RAGHU 36
The Internet Protocol (IP)

• We mentioned earlier that routing protocols compute the


forwarding tables that are used to forward packets through the
network.
• The final component of the network layer is a facility to report
errors in datagrams and respond to requests for certain network-
layer information which is done by the Internet Control Message
Protocol (ICMP).

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

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

KASULA RAGHU 46
IP addressing: introduction
223.1.1.1

• IP address: 32-bit 223.1.2.1


identifier for host, router
interface 223.1.1.2
223.1.1.4 223.1.2.9

• interface: connection
between host/router and 223.1.1.3
223.1.3.27

physical link 223.1.2.2

• router’s typically have


multiple interfaces
• host typically has one or 223.1.3.1 223.1.3.2

two interfaces (e.g., wired


Ethernet, wireless 802.11)
• IP addresses associated 223.1.1.1 = 11011111 00000001 00000001 00000001
with each interface 223 1 1 1

KASULA RAGHU 47
IP addressing: introduction
223.1.1.1

Q: how are interfaces 223.1.2.1


actually connected?
223.1.1.2
223.1.1.4 223.1.2.9

223.1.3.27
223.1.1.3
223.1.2.2

A: wired Ethernet interfaces


connected by Ethernet switches
223.1.3.1 223.1.3.2

For now: don’t need to worry


about how one interface is
connected to another (with no
A: wireless WiFi interfaces
intervening router)
connected by WiFi base station
KASULA RAGHU 48
Subnets
• IP address: 223.1.1.1
• subnet part - high order
bits 223.1.1.2 223.1.2.1
223.1.1.4 223.1.2.9
• host part - low order
bits 223.1.2.2
223.1.1.3 223.1.3.27
• what’s a subnet ? subnet
• device interfaces with
same subnet part of IP 223.1.3.1 223.1.3.2
address
• can physically reach
each other without network consisting of 3 subnets
intervening router

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

subnet mask: /24


KASULA RAGHU 50
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.3.27

223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2

KASULA RAGHU 4-51


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

ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20

Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23


Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23
Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23
... ….. …. ….
Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23

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

IPv6 datagram format:


• fixed-length 40 byte header
• no fragmentation allowed

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

ver pri flow label


payload len next hdr hop limit
source address
(128 bits)
destination address
(128 bits)

data

32 bits
KASULA RAGHU 55
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

KASULA RAGHU 56
Thank You

KASULA RAGHU 57

You might also like