You are on page 1of 41

Network Layer: Internet Protocol

Internetworking
IPv4
IPv6
Link Layer Interconnection
• Frame in data link layer does not carry any routing information
• Problem: How does S1 know that data should be sent out from interface f3?
Network Layer in an Internetwork
• Network layer is responsible for host-to-host delivery and for
routing the packets
Network Layer (1)
• Network layer at
source is responsible
for creating a packet
from data coming from
another protocol.
• Checks routing table to
find the routing
information.
• The packet is
fragmented.
Network Layer (2)
• Makes sure that the
destination address on
the packet is same as
the address of the host.
• If the packet is a
fragment, the network
layer waits until all the
fragments have
arrived.
Network Layer (3)
• The router or the
switch consults its
routing table and
finds the interface
from which the
packet must be sent.
• After some changes
to the header, the
packet is passed to
the data link layer.
Internet Protocol (IP)
• Switching at the network layer in the Internet uses the datagram
approach
• Communication at the network layer in the Internet is connectionless
• Position of IPv4 in TCP/IP protocol suite
IPv4
• IPv4 is an unreliable and connectionless datagram
protocol – a best-effort delivery service.
• IPv4 must be paired with a reliable protocol such
as TCP.
• IPv4 is also a connectionless protocol for a
packet-switching network that uses the datagram
approach.
• IPv4 relies on a higher-level protocol for
reliability.
IPv4 Datagram
• A datagram is a variable length packet consisting of two parts: Header and
Data.
• Header – 20 to 60 bytes, contains information essential to routing and
delivery.
IPv4 Header (1)
• Version (VER): Defines the version. If a machine is using some
other version the datagram is discarded rather than interpreted
incorrectly.
• Header length (HLEN): Defines the total length of the datagram
header in 4-byte words. Eg: if the field value is 5, the header length
is (5X4=)20 bytes.
• Services: previously called service type, now called differentiated
services.
• Service type:
– Precedence : defines priority of the datagram in issues such as
congestion (lowest precedence values discarded first)
– TOS (type of service):only one of the bits can have the value 1
IPv4 Header (2)
• TOS – 5 different types of services
Default TOS for Applications
IPv4 Header (3)
Differentiated services: first 6 bits make up the codepoint
subfield, last 2 bits not used.
A. When 3 right most bits are 0s, the 3 left most bits are
interpreted as precedence bits.
B. When 3 right most bits are not 0s, the 6 bits define the 64
services based on the priority assignment by the internet or
local authorities.
– The firs category contains 32 service types, second and third
contain 16 each.
• Note the numbers are not contiguous
Category Codepoint Assigning Authority
1 XXXXX0 Internet
2 XXXX11 Local
3 XXXX01 Temporary or
experimental
IPv4 Header (4)
• Total length: 16
bit field defines the total length
of IPv4 datagram in bytes including the
header.
– [Length of data = total length – header length]
• Identification, Flags and Fragmentation offset: these
field are used in fragmentation.
IPv4 Header (5)
• Time to live: A datagram has a limited lifetime in its travel
through an internet.
– Originally designed to hold a timestamp.
– Datagram is discarded when the value becomes zero.
– Today, this field is used mostly to control the number of hops
visited by the datagram.
• Protocol: 8-bit field defines the higher level protocol(TCP,
UDP, ICMP, IGMP) that uses the services of the IPv4 layer.
IPv4 Header (6)
• Checksum: for error detection purpose.
• Source address: 32 bit field defines the IPv4
address of the source. This field must remain
unchanged during the datagram’s travel from
the source host to destination host.
• Destination address: 32 bit field defines the IPv4
address of the destination. This field must
remain unchanged during the travel of
datagram from source to destination.
IPV4 Header(7)
Fragmentation
• Maximum size of the datagram is restricted by the hardware and
the software used in the network.
• Maximum length of the IPv4 datagram: 65,535 bytes
• Datagram can be fragmented by the source host or any router in
the path.
• However reassembly is done only at the destination host.
• When a datagram is fragmented most of the header is copied by all
fragments, optional field may or may not be copied.

MTU: Maximum Transfer Unit


IPV4 Header(8)
• Field related to fragmentation
• Identification: identifies a datagram originating form the
source host
• Flags: the first bit (reserved), the second bit (do not
fragment bit), the third bit (more fragment bit, 0 means this
is the last or only fragment)
• Fragmentation offset: 13 bits cannot represent a sequence
of bytes greater than 8191
– Measured in units of 8 bytes
IPV4 Header(9)
Example:
IPV4 Header(10)
• Destination host can reassemble the original datagram
from the fragments received by using the following
strategy:

1) The first fragment has an offset field value of zero.


2) Divide the length of the first fragment by 8. the second
fragment has an offset value equal to that result.
3) Divide the total length of the first and second fragments
by 8. The third fragment has an offset value equal to that
result.
4) Continue the process. The last fragment has a more bit
value of 0.
IPV4 Header(11)
• Checksum
IPV4 Header(12)
Options:
• IPv4 header is made of two part: a fixed part and a variable part
• Fixed part: 20 bytes long
• Variable part comprises the options that can be a maximum of 40
bytes
IPV4 Header(13)
• No-operation: 1 byte, used as filler between options.
• End of option: 1 byte, used for padding at the end of
option field.
• Record route: used to record the internet routers that
handle the datagram. Can list up to 9 addresses.
• Strict source route: used by the source to
predetermine a route for the datagram.
• Loose source route: each router listed must be visited,
but the datagram can visit other routers as well.
• Timestamp: used to record time of datagram
processing by a router.
IPv6 address
• IPv4 has some deficiencies that make it unsuitable for the
fast–growing internet.
– The use of address space is inefficient
– Minimum delay strategies and reservation of resources are
required to accommodate real-time audio and video
transmission
– No security mechanism (encryption and authentication) is
provided
IPv6 address(2)
• IPv6 (IPng: Internetworking Protocol, next generation)
• The adoption of IPv6 has been slow, as the depletion of IPv4
addresses has been remedied by short-term strategies
(Classless addressing and NAT).
• Advantages of IPv6 over IPv4:
– Larger address space (128 bits)
– Better header format- options are separated from base header
– New options
– Allowance for extension
– Support for resource allocation: flow label to enable the source to
request special handling of the packet
– Support for more security – encryption and authentication options
IPv6 Datagram
• IPv6 defines three types of addresses: unicast,
anycast (a group of computers with the same
prefix address), and multicast
• IPv6 datagram header and payload
IPv6 Datagram Format
IPv6 Header
• Version: IPv6
• Priority (4 bits): the priority of the packet with respect to
traffic congestion
• Flow label (3 bytes): to provide special handling for a
particular flow of data
• Payload length (16 bits): length of IP datagram excluding
the base header
• Next header (8 bits): to define the header that follows the
base header in the datagram (optional extension headers/
header of an encapsulated packet such as UDP or TCP)
• Hop limit: TTL in IPv4
• Source address (16 bytes) and destination address (16
bytes): if source routing is used, the destination address
field contains the address of the next router
Priority
• IPv6 divides traffic into two broad categories: congestion-controlled
and noncongestion-controlled
• Congestion-controlled traffic: source adapts itself to traffic slow
down when there is a congestion
– 0 is lowest priority
– 7 is highest priority
Congestion-Controlled Traffic
• No specific traffic: priority of 0 is assigned to a packet when
the process does not define a priority
• Background data: priority 1, defines data that are usually
delivered in the background (news)
• Unattended data traffic: if the user is not waiting for the
data to be received, the packet will be given priority 2 (e-
mail)
• Attended bulk data traffic: a protocol that transfers data
while the user is waiting to receive the data (possibly with
delay) is given priority 4 (FTP, HTTP)
• Interactive traffic: protocol that need user interaction are
assigned second highest priority (TELNET)
• Control traffic: Highest priority (Routing protocols – OSPF,
RIP and management protocols – SNMP)
Noncongestion-Controlled Traffic
• Refers to type of traffic that expects minimum delay
• Discarding of packets not desirable
• Eg: real-time audio and video
• Priorities are usually based on how the quality of
received data is affected by the discarding of packets
Flow label
• A sequence of packets sent from a particular
source to a particular destination needs special
handling by router called a flow of packets
• The combination of the source address and the
value of the flow label uniquely defines a flow of
packets
• To a router, a flow is a sequence of packets that
share the same characteristics such as
– Travelling the same path
– Using the same resources
– Having the same kind of security and so on
Flow label (2)
• A flow label can be used to speed up the processing of a packet by
the router.
• Flow label can be used to support resource requirements such as
high bandwidth, large buffers, long processing time etc.

Three rules for effective use of flow labels

• The flow label is assigned to a packet by the source host. The label
is a random number between 1 and 224-1. A source must not reuse
the flow label for a new flow while the existing flow is still active.
• If a host does not support the flow label, it sets this field to zero. If
a router does not support the flow label it simply ignores it.
• All packets belonging to the same flow have the same source, same
destination, same priority and same options.
Comparison between IPv4 and IPv6
Extension Header
• To give greater functionality to the IP
datagram, the base header can be followed by
up to six extension headers.
Extension Header

is used when the source needs to pass


information to all routers visited by the datagram.
combines the concepts of the strict source
route and the loose source route options of IPv4.
concept is similar to IPv4. However
fragmentation can be done only by the original source.
(uses a path MTU discovery technique)
extension validates the message sender
and ensures the integrity of data.
is an extension that provides
confidentiality and guards against eavesdropping.
is used when the source needs to pass
information to the destination only. (routers not permitted)

Computer Networks 20-35


Comparison between IPv4 options and IPv6
extension headers
Three transition strategies from IPv4 to IPv6

• Transition should be smooth to prevent any problems between IPv4 and IPv6
systems

Computer Networks 20-37


Dual stack
• All hosts have a dual stack of protocols before migrating completely to version 6

Computer Networks 20-38


Tunneling
• IPv6 packet is encapsulated in an IPv4 packet

Computer Networks 20-39


Header translation
• Necessary when the majority of the Internet has moved to IPv6 but some systems
still use IPv4
• Header format must be changed totally through header translation

Computer Networks 20-40


Header translation procedure
1. IPv6 mapped address is changed to an IPv4 address by
extracting the rightmost 32 bits.
2. The value of IPv6 priority field is discarded.
3. The type of service field in IPv4 is set to zero.
4. The checksum for IPv4 is calculated and inserted in the
corresponding field.
5. The IPv6 flow label is ignored.
6. Compatible extension header are converted to options
and inserted in the IPv4 header.
7. The length of IPv4 header is calculated and inserted into
the corresponding field.
8. The total length of the IPv4 packet is calculated and
inserted in the corresponding field.

You might also like