0% found this document useful (0 votes)
9 views113 pages

CN Unit-III

CN

Uploaded by

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

CN Unit-III

CN

Uploaded by

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

MIT Art Design and Technology University

MIT School of Computing, Pune


Department of Computer Science and Engineering

21BTCS403-Computer Networks

Class - S.Y.

Unit - III Network Layer

AY 2023-2024 SEM-II
Unit III - Syllabus

Unit III – Network Layer 09 hours


• Network Layer Services, IPv4 Addresses: Classful and Classless Addressing, Special
Addresses,
• NAT, Subnetting, Supernetting, Delivery and Forwarding of IP Packet,
• IPv4: Fragmentation, Options, Checksum, ARP: Address Mapping, ARP Protocol, RARP,
• DHCP, ICMPv4, Unicast Distance Vector Routing, Link State Routing, Unicast Routing
Protocols: RIP, OSPF, IPv6 Addressing.
Communication at Network layer

3
Network Layer Services

 Packetizing

 Logical addressing

 Routing/Forwarding

4
Packetizing

 Encapsulating the payload in a network-layer packet at the source and


decapsulating the payload from the network-layer packet at the destination.
 In other words, one duty of the network layer is to carry a payload from the
source to the destination without changing it or using it.
 Similar to the service of a carrier such as the postal office.
5
Logical addressing
 Communication at the network layer is host-
to-host (computer-to-computer)
 Usually, computers communicate through
the Internet. The packet transmitted by the
sending computer may pass through several
LANs or WANs before reaching the
destination computer.
 Network layer provides a global addressing
scheme called logical addressing or IP
addressing. 6
Routing/Forwarding

routing algorithm

 Routing: determine
local forwarding table

route taken by packets


header output
value0100 3 link
0101 2

from source to
0111 2
1001 1

destination.
value in arriving

 Forwarding: move
packet’s header
0111 1

packets from router’s


3 2

input to appropriate
router output.
7
IPv4 Addresses

Why Internet needs addresses?


 Addresses allow endpoints to identify
themselves
 Addresses allow routers to determine how
to move a packet

8
IPv4 Addresses

 An IPv4 address is a 32-bit address that uniquely and


universally defines the connection of a device (for
example, a computer or a router) to the Internet.
 An IP address is a logical address that is assigned by
software residing in a server or router .
 In order to locate a device in the network, the logical IP
address is converted to a physical address by a function
within the TCP/IP protocol software (ARP).

9
IPv4 Addresses

 The address space of IPv4 is 2^32 or 4,294,967,296 (more than 4


billion).
 An IPv4 address can be represented in 3 ways:
 Binary Notation
 Dotted-Decimal Notation
 Hexadecimal Notation

10
IPv4 Address representation

 Binary
 In binary notation, the IPv4 address is displayed as 32 bits.

 Each octet is often referred to as a byte.

 IPv4 address is referred as a 32-bit address or a 4-byte address.

 Dotted Decimal
 An IP address is written in "dotted decimal" notation, which is 4 sets
of numbers separated by period (dot) each set representing 8-bit
number ranging from (0-255).

11
IPv4 Address representation

 Hexadecimal Notation
 IPV4 address can be represented in hexadecimal form.
 A 32 bit address has 8 hexadecimal digits.
 This notation is often used in network programming.

80 0B 03 1F
12
Grouping IP addresses by prefixes

 IP addresses can be grouped based on a shared prefix of a specified


length

 Example: consider two IP addresses:


128.95.1.80 and 128.95.1.4
The addresses share a prefix of (bit) length 24: 128.95.1
The addresses have different suffixes of (bit) length 8

 IP addresses: prefix corresponds to the network component and the


suffix to an endpoint/host component of the address

13
Classful Addressing

 A classful network is a network addressing architecture used in the Internet from


1981 until the introduction of Classless Inter-Domain Routing in 1993.
 The method divides the IP address space for Internet Protocol version 4 (IPv4)
into five address classes.
 Classes A, B, and C provide unicast addresses for networks of three different
network sizes.
 Class D is for multicast networking and the class E address range is reserved for
future or experimental purposes.

14
Classful Addressing

Number of blocks and block size in classful IPv4 addressing

15
IP address components

 In classful addressing, an IP address in class A, B, or C is divided into


netid and hostid.
 These parts are of varying lengths, depending on the class of the address.
 The IP address is divided into two main parts:
Network Number (Netid) and
Host Number (Hostid)

16
IP address components
 The network number identifies the
network and must be assigned by the
Internet Network Information Center
(InterNIC) if the network is to be part of
the Internet.
 The host number identifies a host in the
network and is assigned by the local
network administrator.

17
Network IDs and Broadcast Addresses

An IP address such as 176.10.0.0 that has all binary 0s in the host


bit positions is reserved for the network address.

An IP address such as 176.10.255.255 that has all binary 1s in the


host bit positions is reserved for the broadcast address.
18
Classful Network Masks

 Each of the commercial address classes has a set classful network mask.
 The network mask defines which bits out of the 32 bit of the address are
defined as the network portion and which are the host portion.
 The network mask is calculated by setting all bits to a value of 1 in the
octets designated for the network portion and all bits to a value of 0 in the
octets designated for the host portion.

19
Classful Network Masks

 A Class A address has the first octet as the network portion and the remaining 3
octets as the host portion. Therefore, a Class A network mask is defined as
255.0.0.0.
 A Class B address has the first and second octets as the network portion and the
third and fourth octets as the host portion. A Class B network mask is shown as
255.255.0.0.
 A Class C address has the first, second, and third octet as the network portion and
the last octet as the host portion. A Class C network mask is shown as
255.255.255.0.
20
Private Addresses
 A number of blocks in each class are assigned for private use and not
recognized globally.
 Used in Isolation
 The three blocks of addresses allocated for private use are as follows:
 10.0.0.0/8
 172.16.0.0/12
 192.168.0.0/16

21
Private Addresses

H1 H2 H3 H4

10.0.1.2 10.0.1.3 10.0.1.2 10.0.1.3

10.0.1.1 10.0.1.1
Private network 1 Private network 1
Internet
R1 128.195.4.119 128.143.71.21 R2

213.168.112.3

H5

22
Public Addresses

 Routable IP addresses
 Required for inter network communication

23
Special addresses

24
Network address

25
Example of direct broadcast address

26
Example of limited broadcast address

27
Examples of “this host on this network”

28
Example of “specific host on this network”

29
Example of loopback address

30
Problems with classful addressing
 The problem with this classful addressing method is that millions of
class A address are wasted, many of the class B address are wasted,
whereas, number of addresses available in class C is so small that it
cannot cater the needs of organizations.
 Class D addresses are used for multicast routing and are therefore
available as a single block only.
 Class E addresses are reserved.
 The Internet is going to outgrow the 32-bit addresses.

31
Subnetting
Split the host number portion of an IP address into a subnet number and a
(smaller) host number.

Result is a 3-layer hierarchy

network prefix host number

network prefix subnet number host number

extended network prefix


Then:
 Subnets can be freely assigned within the organization
 Internally, subnets are treated as separate networks
 Subnet structure is not visible outside the organization
32
Subnet Masks

Routers and hosts use an extended network prefix (subnet mask) to


identify the start of the host numbers

Class B 10 network host


16 bits
Network Prefix (16 bits)

with 10 network subnet host


subnetting
Extended Network Prefix (24 bits)
Subnet
mask 1111111111111111111111100000000
(255.255.255.0)

33
Advantages of Subnetting

 With subnetting, IP addresses use a 3-layer hierarchy:


 Network
 Subnet
 Host
 Improves efficiency of IP addresses by not consuming an entire Class B or Class
C address for each physical network.
 Reduces router complexity. Since external routers do not know about subnetting,
the complexity of routing tables at external routers is reduced.

34
Subnetting a Class A/B/C Address


How many subnets does the chosen subnet mask produce?

How many valid hosts per subnet are available?

What are the valid subnets?

What’s the broadcast address of each subnet?

What are the valid hosts in each subnet?
Example 1: 255.255.255.128
(/25)
Network 192.168.10.0

How many subnets? Since 128 is 1 bit on (10000000), the answer would be 21= 2.

How many hosts per subnet? We have 7 host bits off (10000000), so the equation
would be 27– 2 = 126 hosts.

What are the valid subnets? 256 – 128 = 128. Remember, we’ll start at zero and
count in our block size, so our subnets are 0, 128.

What’s the broadcast address for each subnet? The number right before the value of
the next subnet is all host bits turned on and equals the broadcast address. For the
zero subnet, the next subnet is 128, so the broadcast of the 0 subnet is 127.

What are the valid hosts? These are the numbers between the subnet and broadcast
address
CIDR - Classless Interdomain Routing
 IP backbone routers have one routing table entry for each network address:

 With subnetting, a backbone router only needs to know one entry for each
Class A, B, or C networks
 This is acceptable for Class A and Class B networks
2^7 = 128 Class A networks
2^14 = 16,384 Class B networks
 But this is not acceptable for Class C networks
2^21 = 2,097,152 Class C networks

 In 1993, the size of the routing tables started to outgrow the capacity of routers.
 Consequence: The Class-based assignment of IP addresses had to be abandoned

37
CIDR - Classless Interdomain Routing

 The goal of CIDR is to restructure IP address assignments to increase

efficiency.

 Hierarchical routing aggregation to minimize route table entries

 CIDR (Classless Interdomain routing) don’t uses the notion of classes.

 The length of the network id (prefix) in the IP addresses is kept arbitrary.

38
CIDR Example
 CIDR notation of a network address:
192.0.2.0/18
"18" says that the first 18 bits are the network part of the address (and 14 bits are
available for specific host addresses)
 The network part is called the prefix.
 Eg : Assume that a site requires a network address with 1000 addresses
 With CIDR, the network is assigned a continuous block of 1024 addresses with a 22-
bit long prefix.

39
CIDR: Prefix Size vs. Network Size
CIDR Block Prefix # of Host Addresses
/27 32 hosts
/26 64 hosts
/25 128 hosts
/24 256 hosts
/23 512 hosts
/22 1,024 hosts
/21 2,048 hosts
/20 4,096 hosts
/19 8,192 hosts
/18 16,384 hosts
/17 32,768 hosts
/16 65,536 hosts
/15 131,072 hosts
/14 262,144 hosts
/13 524,288 hosts
40
Supernetting
• Supernetting is the opposite of Subnetting.
• In subnetting, a single big network is divided into multiple smaller subnetworks.
• In Supernetting, multiple networks are combined into a bigger network termed as
a Supernetwork or Supernet.
• Supernetting is mainly used in Route Summarization, where routes to multiple
networks with similar network prefixes are combined into a single routing
entry, with the routing entry pointing to a Super network, encompassing all the
networks.
• This in turn significantly reduces the size of routing tables and also the size of
routing updates exchanged by routing protocols
How to supernet a network?
• Combining these networks into one network: (A summarized route)
• 192.168.0.0/24 • 192.168.1.0/24 • 192.168.2.0/24 • 192.168.3.0/24
• Step 1: Write all the IP Addresses in binary like so:
• 192.168.0.0/24
• 11000000.10101000.00000000.00000000
• 192.168.1.0/24
• 11000000.10101000.00000001.00000000
• 192.168.2.0/24
• 11000000.10101000.00000010.00000000
• 192.168.3.0/24
• 11000000.10101000.00000011.00000000
Step 2: Find matching bits from left to right

• 11000000.10101000.00000000.00000000
11000000.10101000.00000001.00000000
11000000.10101000.00000010.00000000
11000000.10101000.00000011.00000000
Step 3:

• Re write the matching numbers and add the remaining zeros, because you are
converting network bits into host bits.
• This will be your NEW NETWORK ID, the route that you will be advertising. (A
summarized route)
• 11000000.10101000.00000000.00000000 = 192.168.0.0
Step 4:

• Find the new subnet mask.


• Put “1s” in the matching networking part, and all zeros in the host part.
11111111.11111111.11111100.00000000
• This your new subnet mask 255.255.252.0 •
• Your new summarized route is 192.168.0.0/22
Private Network

 Private IP network is an IP network that is not directly connected to the Internet.

 IP addresses in a private network can be assigned arbitrarily.


-Not registered and not guaranteed to be globally unique

 Generally, private networks use addresses from the following experimental


address ranges (non-routable addresses):
10.0.0.0 – 10.255.255.255
172.16.0.0 – 172.31.255.255
192.168.0.0 – 192.168.255.255

46
Network Address Translation (NAT)

 NAT is a router function where IP addresses (and possibly port numbers) of IP


datagrams are replaced at the boundary of a private network

 NAT is a method that enables hosts on private networks to communicate with hosts
on the Internet

 NAT is run on routers that connect private networks to the public Internet, to
replace the IP address-port pair of an IP packet with another IP address-port pair.

47
Basic Operation of NAT

Private Internet
network

Source = 10.0.1.2 Source = 128.143.71.21


Destination = 213.168.112.3 Destination = 213.168.112.3

private address: 10.0.1.2 NAT


public address: 213.168.112.3
public address: 128.143.71.21 device
H1 H5
Source = 213.168.112.3 Source = 213.168.112.3
Destination = 10.0.1.2 Destination = 128.143.71.21

Private Public
Address Address
10.0.1.2 128.143.71.21

 NAT device has address translation


table.
48
A NAT implementation

49
Address Translation

50
Translation

51
Five-column translation table

52
Delivery of IP Packet
• Direct Delivery
• In a direct delivery, the final destination of the packet is
a host connected to the same physical network as the
deliverer. Direct delivery occurs when the source and
destination of the packet are located on the same
physical network or when the delivery is between the last
router and the destination host.

• Indirect Delivery
• If the destination host is not on the same network as the
deliverer, the packet is delivered indirectly. In an indirect
delivery, the packet goes from router to router until it
reaches the one connected to the same physical network
as its final destination.
FORWARDING of IP Packet
• Forwarding means to place the packet in its route to
its destination. Forwarding requires a host or a router
to have a routing table. When a host has a packet to
send or when a router has received a packet to be
forwarded, it looks at this table to find the route to the
final destination.
• Forwarding Techniques
• 1. Next-Hop Method Versus Route Method One
technique to reduce the contents of a routing table is
called the next-hop method. In this technique, the
routing table holds only the address of the next hop
instead of information about the complete route
(route method). The entries of a routing table must be
consistent with one another
• Default Method:
• Another technique to simplify routing is
called the default method.
• In Figure host A is connected to a
network with two routers. Router Rl
routes the packets to hosts connected to
network N2. However, for the rest of the
Internet, router R2 is used. So instead of
listing all networks in the entire Internet,
host A can just have one entry called the
default (normally defined as network
address 0.0.0.0).
Network Layer Protocols

56
IPv4

 IP (Internet Protocol) is a Network Layer Protocol.


 IP is the highest layer protocol which is implemented at both routers and
hosts.

Application Application protocol Application

TCP TCP protocol TCP

IP IP protocol IP IP protocol IP IP protocol IP

Data Data Data Data Data Data Data Network


Data Link
Link Link Link Link Link Link Link Access

Host Router Router Host

57
IPv4

 IP provide provides an unreliable connectionless best effort service (also called:


“datagram service”).
Unreliable: IP does not make an attempt to recover lost packets
Connectionless: Each packet (“datagram”) is handled independently. IP is
not aware that packets between hosts may be sent in a logical sequence
Datagram Service : Data packets can travel through any route

 Higher layer protocols have to deal with losses or with duplicate packets.

58
IPv4 Datagram

 Packets used by the IP are called datagrams.

 A datagram is a variable-length packet consisting of two parts: header and

payload (data).

 The header is 20 to 60 bytes in length and contains information essential to

routing and delivery.

59
IPv4 Datagram

60
Fields of IP header
 Version: IP Version
• 4 for IPv4
 HLen: Header Length
• 32-bit words (typically 5)
 TOS: Type of Service
• Priority information
 Length: Packet Length
• Bytes (including header)
• Length field limits packets to 65,535 bytes
• In practice, break into much smaller packets for network
performance considerations

62
Fields of IP header
 Identifier, flags, fragment offset  used primarily for fragmentation
Identification: Unique Packet Id for identifying the group of fragments of a
single IP datagram (16 bits)
Flags: 3 flags of 1 bit each : reserved bit (must be zero), do not fragment flag,
more fragments flag (same order)
Fragment Offset: Represents the number of Data Bytes ahead of the particular
fragment in the particular Datagram. Specified in terms of number of 8 bytes,
which has the maximum value of 65,528 bytes.

 Time to live
Must be decremented at each router
Packets with TTL=0 are thrown away
Ensure packets exit the network

63
Fields of IP header
 Protocol
TCP = 6, ICMP = 1, UDP = 17…
 Header checksum
16 bits header checksum for checking errors in the datagram header
 Source Address
32-bit IP address of sender
 Destination Address
32-bit IP address of destination

64
Fields of IP header

 Options:
• Security restrictions
• Record Route: each router that processes the packet adds its IP address to the header.
• Timestamp: each router that processes the packet adds its IP address and time to the
header.
• (loose) Source Routing: specifies a list of routers that must be traversed.
• (strict) Source Routing: specifies a list of the only routers that can be traversed.
 Padding:
Padding bytes are added to ensure that header ends on a 4-byte boundary

65
Maximum Transmission Unit

 Maximum size of IP datagram is 65535, but the data link layer


protocol generally imposes a limit that is much smaller.

 For example:
Ethernet frames have a maximum payload of 1500 bytes.
IP datagrams encapsulated in Ethernet frame cannot be longer than
1500 bytes.

 The limit on the maximum IP datagram size, imposed by the data link
protocol is called maximum transmission unit (MTU).

66
IP Fragmentation
 When a packet is received at the router, destination address is examined and MTU is
determined. If size of the packet is bigger than the MTU, and the ‘Do not Fragment (DF)’ bit
is set to 0 in header, then the packet is fragmented into parts and sent one by one.
 If the size of an IP datagram exceeds the MTU, IP datagram is fragmented into smaller units.

 IP router splits the datagram into several datagrams.

 Fragmentation can be done at the sender or at intermediate routers.

 Reassembly of original datagram is only done at destination hosts.

IP datagram H Fragment 2 H2 Fragment 1 H1

Router

67
ARP & RARP
The Internet is based on IP addresses.
Data link protocols (Ethernet, FDDI, ATM) may have different (MAC) addresses.
The ARP and RARP protocols perform the translation between IP addresses and MAC layer
addresses.
• ARP request: This is nothing but broadcasting a packet over the network to validate
whether we came across the destination MAC address or not.
• The physical address of the sender.
• The IP address of the sender.
• The physical address of the receiver is FF:FF:FF:FF:FF:FF or 1’s.
• The IP address of the receiver
• ARP response/reply: It is the MAC address response that the source receives from the
destination which aids in further communication of the data.

68
ARP operation
Imagine a device that wants to communicate with the other over the internet.

What ARP does?


• It broadcast a packet to all the devices of the source network.
• The devices of the network peel the header of the data link layer from
the protocol data unit (PDU) called frame and transfer the packet to the
network layer (layer 3 of OSI) where the network ID of the packet is validated
with the destination IP’s network ID of the packet and if it’s equal then it
responds to the source with the MAC address of the destination, else the
packet reaches the gateway of the network and broadcasts packet to the
devices it is connected with and validates their network ID

69
• CASE-1: The sender is a host and wants to send a packet to another host on the same network.
• Use ARP to find another host’s physical address
• CASE-2: The sender is a host and wants to send a packet to another host on another network.
• The sender looks at its routing table.
• Find the IP address of the next-hop (router) for this destination.
• Use ARP to find the router’s physical address
• CASE-3: the sender is a router and received a datagram destined for a host on another network.
• The router checks its routing table.
• Find the IP address of the next router.
• Use ARP to find the next router’s physical address.
• CASE-4: The sender is a router that has received a datagram destined for a host in the same
network. Use ARP to find this host’s physical address.
ARP Packet
Hardware type: This is 16 bits field defining the type
of the network on which ARP is running. Ethernet is
given type 1.
Protocol type: This is 16 bits field defining the
protocol. The value of this field for the IPv4 protocol
is 0800H.
Hardware length: This is an 8 bits field defining the
length of the physical address in bytes. Ethernet is the
value 6.(MAC address length)
Protocol length: This is an 8 bits field defining the
length of the logical address in bytes. For the IPv4
protocol, the value is 4.
Operation (request or reply): This is a 16 bits field
defining the type of packet. Packet types are ARP
request (1), and ARP reply (2).

71
RARP
• Reverse Address Resolution Protocol (RARP) is a protocol a physical
machine in a local area network (LAN) can use to request its IP
address. It does this by sending the device's physical address to a
specialized RARP server that is on the same LAN and is actively
listening for RARP requests.
• A network administrator creates a table in a RARP server that maps
the physical interface or media access control (MAC) addresses to
corresponding IP addresses. This table can be referenced by devices
seeking to dynamically learn their IP address.
RARP
• When a new RARP-enabled device first connects to
the network, its RARP client program sends its
physical MAC address to the RARP server for the
purpose of receiving an IP address in return that the
device can use to communicate with other devices on
the IP network. The RARP request is sent in the form
of a data link layer broadcast. It is, therefore,
important that the RARP server be on the same LAN
as the devices requesting IP address information.
• Assuming an entry for the device's MAC address is
set up in the RARP database, the RARP server
returns the IP address associated with the device's
specific MAC address.
RARP
• The general RARP process flow follows these steps:
• Device 1 connects to the local network and sends an RARP broadcast to all
devices on the subnet. In the RARP broadcast, the device sends its physical MAC
address and requests an IP address it can use.
• Because a broadcast is sent, device 2 receives the broadcast request. However,
since it is not a RARP server, device 2 ignores the request.
• The broadcast message also reaches the RARP server. The server processes the
packet and attempts to find device 1's MAC address in the RARP lookup table. If
one is found, the RARP server returns the IP address assigned to the device. In
this case, the IP address is 51.100.102.
DHCP
 Dynamic Host Configuration Protocol is an application layer protocol which is based on Bootstrap
Protocol (BOOTP).

 DHCP allows hosts to obtain required TCP/IP configuration information from a DHCP server. i.e
• Subnet Mask (Option 1 – e.g., 255.255.255.0)
• Router Address (Option 3 – e.g., 192.168.1.1)
• DNS Address (Option 6 – e.g., 8.8.8.8)
• DHCP is based on a client-server model and based on discovery, offer, request, and ACK.
• DHCP port number for server is 67 and for the client is 68.
• It is a Client server protocol which uses UDP services.
• IP address is assigned from a pool of addresses.
• In DHCP, the client and the server exchange mainly 4 DHCP messages in order to make a
connection, also called DORA process, but there are 8 DHCP messages in the process.

75
Benefits of DHCP

Centralized administration of IP configuration.

Dynamic host configuration.

Flexibility and scalability.

76
How DHCP works?
1.DHCP discover message –
This is a first message generated in the communication process
between server and client. This message is generated by Client host in
order to discover if there is any DHCP server/servers are present in a
network or not. This message is broadcasted to all devices present in a
network to find the DHCP server. This message is 342 or 576 bytes
long
2.DHCP offer message –
The server will respond to host in this message specifying the
unleased IP address and other TCP configuration information. This
message is broadcasted by server. Size of message is 342 bytes. If
there are more than one DHCP servers present in the network then
client host will accept the first DHCP OFFER message it receives.
Also a server ID is specified in the packet in order to identify the
server.

77
• DHCP request message –
When a client receives a offer message, it responds by
broadcasting a DHCP request message. The client
will produce a gratuitous ARP in order to find if there
is any other host present in the network with same IP
address. If there is no reply by other host, then there is
no host with same TCP configuration in the network
and the message is broadcasted to server showing the
acceptance of IP address .A Client ID is also added in
this message.

• DHCP acknowledgement message –


In response to the request message received, the
server will make an entry with specified client ID and
bind the IP address offered with lease time. Now, the
client will have the IP address provided by server.
DHCP message format

which includes the message type, lease, domain name server


IP address, and WINS IP address

79
DHCP
DHCP negative acknowledgement message – s TO c
Whenever a DHCP server receives a request for IP address that is invalid according to the scopes that
is configured with, it send DHCP Nak message to client. Eg-when the server has no IP address unused
or the pool is empty, then this message is sent by the server to client.
DHCP decline – c TO s
If DHCP client determines the offered configuration parameters are different or invalid, it sends DHCP
decline message to the server .When there is a reply to the gratuitous ARP by any host to the client, the
client sends DHCP decline message to the server showing the offered IP address is already in use.
DHCP release –
A DHCP client sends DHCP release packet to server to release IP address and cancel any remaining
lease time
DHCP inform –
If a client address has obtained IP address manually then the client uses a DHCP inform to obtain other
local configuration parameters, such as domain name.

80
ICMP
The IP (Internet Protocol) relies on several other protocols to perform
necessary control and routing functions:
• Control functions (ICMP) , Multicast signaling (IGMP) ,Setting up routing tables
(RIP, OSPF, BGP, PIM, …)
The Internet Control Message Protocol (ICMP) is a helper protocol that
supports IP with facility for
• Error reporting
• Simple queries
 It is a supporting protocol and is used by networks devices like routers for
sending error messages and operations information., e.g. the requested
service is not available or that a host or router could not be reached.

81
ICMP

ICMP messages are encapsulated as IP datagrams.

IP header ICMP message

IP payload

82
ICMP message format
bit # 0 7 8 15 16 23 24 31

type code checksum

additional information
or
0x00000000

4 byte header:
 Type (1 byte): type of ICMP message
 Code (1 byte): subtype of ICMP message
 Checksum (2 bytes): similar to IP header checksum. Checksum is calculated over entire
ICMP message.
 If there is no additional data, there are 4 bytes set to zero. Each ICMP messages is at
least 8 bytes long.

83
ICMP message subtypes
1. Error Reporting Messages :
Error Reporting Messages are
used to report problems
encountered by the router/host
while processing the IP packets.
These messages are always sent
to the source because the
datagram only contains the source
and destination IP address.

2. 2. Query Messages :
Query Messages are used for
error handling and debugging
network problems. These
messages help the host to get
specific information about
another host or router.
Routing

Routing is the process of selecting and defining paths for IP-packet traffic within
or between networks as well as the process of managing network traffic overall.

There are two approaches for calculating the routing tables:

• Static Routing

• Dynamic Routing: Routes are calculated by a routing protocol

85
Types of Delivery

The network layer supervises the delivery of the packets by the underlying physical
networks.
Direct delivery

Transmit datagram across a single physical network to the destination

Map the destination IP address to a physical address

Encapsulate the datagram in a physical frame

Send the frame over the physical network to the destination


Indirect Delivery

Transmit datagram across multiple physical networks (with the aid of routers)

to the destination

Encapsulate the datagram in a frame

Choose a router on the physical network

Send the frame to that router

Router forwards the datagram on towards its final destination


Forwarding

• Forwarding means to place the packet in its route to its destination.

• Forwarding requires a host or a router to have a routing table.

• When a host has a packet to send or when a router has received a packet to be
forwarded, it looks at routing table to find the route to the final destination.
Routing
• Routing - the process of choosing a path over which to send packets.

• Router is a network device that performs routing.

• A routing protocol is a combination of rules and procedures that lets routers in the internet
inform each other of changes.

• Criteria that could be used to make routing decisions:


 Network characteristics

 Network topology

 Network load

 Datagram length

 Type of service requested in the datagram’s header


Distance Vector Routing
 The distance vector routing algorithm is also known
as the Bellman-Ford algorithm or the shortest path
routing algorithm in computer networks.

 In distance vector routing, the least-cost route


between any two nodes is the route with minimum
distance.

 In this protocol, as the name implies, each node


maintains a vector (table) of minimum distances to
every node.

 The table at each node also guides the packets to


the desired node by showing the next stop in the
route (next-hop routing). 91
DVR
• Sharing
• When to Share
• Periodic Update
• Triggered Update : neighbour,
failure
RIP (Routing Information Protocol)

The Routing Information Protocol (RIP) is an intradomain routing protocol used


inside an autonomous system based on distance vector routing.

Each router advertises its distance vector every 30 seconds (or whenever its routing
table changes) to all of its neighbors

RIP always uses 1 as link metric

Maximum hop count is 15, with “16” equal to “”

Routes are timeout (set to 16) after 3 minutes if they are not updated

93
RIP example

94
RIP Messages & RIPv1 packet format
IP header UDP header RIP Message
This is the operation of RIP in routed.
Dedicated port for RIP is UDP port 520. Command Version Set to 00...0

address family Set to 00.00


Two types of messages: 32-bit address

one route entry


(20 bytes)
Unused (Set to 00...0)
• Request messages
Unused (Set to 00...0)
used to ask neighboring nodes for an update
metric (1-16)

• Response messages Up to 24 more routes (each 20 bytes)

contains an update
32 bits

95
Routing with RIP
Initialization: Send a request packet (command = 1, address family=0..0) on all
interfaces:
RIPv1 uses broadcast if possible,
RIPv2 uses multicast address 224.0.0.9, if possible requesting routing tables
from neighboring routers
Request received: Routers that receive above request send their entire routing
table
Response received: Update the routing table
Regular routing updates: Every 30 seconds, send all or part of the routing tables
to every neighbor in an response message
Triggered Updates: Whenever the metric for a route change, send entire routing
table.
96
Advantages and drawbacks
• Simplicity: relatively simple to implement and understand,
• Low overhead: low overhead, as routers only exchange information with their
immediate neighbors
• Flexibility :different metrics, such as hop count or delay, to determine the best path.
• Compatibility: supported by router vendors and are compatible with a variety of
network devices
• Drawbacks
• Slow convergence:it takes a long time for the network to adjust to changes in topology
• Limited scalability: they rely on every router knowing the entire routing table
• Limited accuracy: Distance Vector Routing protocols use only one metric, such as hop
count, to determine the best path, which can lead to suboptimal routes.
Link State Routing
In link state routing, if each node in the domain has the entire topology of the
domain the list of nodes and links, how they are connected including the type,
cost (metric), and condition of the links (up or down)-the node can use Dijkstra's
algorithm to build a routing table.

Each node knows the distance to its neighbors.

The distance information (=link state) is broadcast to all nodes in the network.

Each node calculates the routing tables independently.

98
Building Routing Tables
• In link state routing, four sets of actions are required to ensure that each node has the
routing table showing the least-cost node to every other node.

• 1. Creation of the states of the links by each node, called the link state packet (LSP).
• 2. Dissemination of LSPs to every other router, called flooding, in an efficient and
reliable way.
• 3. Formation of a shortest path tree for each node.
• 4. Calculation of a routing table based on the shortest path tree.
OSPF
Open Shortest Path First
The OSPF routing protocol is the most important link state routing protocol on the
Internet.
Provides authentication of routing messages
Enables load balancing by allowing traffic to be split evenly across routes with
equal cost
Type-of-Service routing allows to setup different routes dependent on the TOS field
Supports subnetting and multicasting
Allows hierarchical routing

100
Routing using OSPF
• OSPF protocol working can be understood in the following
three steps:
• Step 1: The first step in the working of the OSPF protocol is
to become the OSPF neighbors. The two routers that are
running on the same link and are connected establishes the
neighbor relationship between them.
• Step 2: Now the next step is to exchange the database
information between the routers. When the router establishes
the neighbor relationship they exchange the link-state
database (LSDB) with each other.
• Step 3: The third step in the working of the OSPF protocol is
to select the best route. After an exchange of LSDB
information, the router finds the best route for adding to the
routing table.
Types of Links in OSPF
• Point-to-point link
• When there is a direct connection between two routers without any host or router in between
then it is known as a point-to-point link.
• Transient link
• In transient links, different routers are connected in a network. There are two ways
through which a transient link can be implemented:
• Unrealistic topology: Unrealistic topology is formed when all the routers in the network are
connected.
• Realistic topology: Realistic topology is formed when some designated routers are present in
a network. A designated router is referred to as a router through which all the routers in a
network are connected. It is mandatory for all the packets that are transmitted by the routers to
pass through this designated router.
Types of Links in OSPF
• Stub Link
• A Stub link is a type of network in which all routers are connected with a single
router only. Through this single router only, data enters and leaves the network
when needed using this single router.
• Virtual Link
• The administrator creates a virtual path between the routers when the link between
these routers is destroyed. And this virtual link is a longer one also.
OSPF Packets
• Version: It is the field of 8-bits that is used to specify the version of the
OSPF protocol.
• Type: It is the field of 8-bits that is used to specify the OSPF packet
type.
• Message: Message is a 16-bit field and is used to specify the total
length of the message. So the sum of the message and header length
represents the total length.
• Source IP address: It specifies the address of the source of the packet
means the address from where the packet is sent to the receiver.
• Area identification: It specifies the area in which the routing takes
place.
• Checksum: Checksum is used for specifying the data related to error
detection and correction.
• Authentication type: This field can contain two types of authentication
i.e. 0 and 1. 0 specifies that no authentication is used, and 0 represents
none. And 1 represents PWD and it specifies password-based
authentication.
• Authentication: Authentication is a field of 32-bit that specifies the
authentication data's actual value.
OSPF states

105
Discovery of Neighbors

Routers multicasts OSPF Hello packets on all OSPF-enabled interfaces.

If two routers share a link, they can become neighbors, and establish an
adjacency.

After becoming a neighbor, routers exchange their link state databases.

106
Dissemination of LSA-Update

A router sends and refloods LSA-Updates, whenever the topology or link cost
changes. (If a received LSA does not contain new information, the router will not
flood the packet)

Exception: Infrequently (every 30 minutes), a router will flood LSAs even if there
are no new changes.

Acknowledgements of LSA-updates:

• explicit ACK, or

• implicit via reception of an LSA-Update


107
IPv6

128 bits (or 16 bytes) long.

2^128 : about 340 billion billion billion billion different addresses

Colon hexadecimal notation:


• addresses are written using 32 hexadecimal digits.

• digits are arranged into 8 groups of four to improve the readability.

• Groups are separated by colons


2001:0718:1c01:0016:020d:56ff:fe77:52a3

108
IPv6 prefixes
The prefix is the part of the address that indicates the bits that have fixed
values or are the bits of the subnet prefix.

Prefixes for IPv6 subnets, routes, and address ranges are expressed in the same
way as Classless Inter-Domain Routing (CIDR) notation for IPv4.

An IPv6 prefix is written in address/prefix-length notation.

• For example, 21DA:D3::/48 and 21DA:D3:0:2F3B::/64 are IPv6 address


prefixes.

109
IPv6 datagram
Version (4-bits): Indicates version of Internet
Protocol which contains bit sequence 0110.
Traffic Class (8-bits): The Traffic Class field indicates class or
priority of IPv6 packet which is similar to Service Field in IPv4
packet. It helps routers to handle the traffic based on the
priority of the packet
Flow Label (20-bits): Flow Label field is used by a source to
label the packets belonging to the same flow in order to
request special handling by intermediate IPv6 routers, such as
non-default quality of service or real-time service.
Payload Length (16-bits): It is a 16-bit (unsigned integer) field,
indicates the total size of the payload which tells routers about
the amount of information a particular packet contains in its
payload.
Next Header (8-bits): Next Header indicates the type of
extension header(if present) immediately following the IPv6
header
Hop Limit (8-bits): Hop Limit field is the same as TTL in IPv4
packets. It indicates the maximum number of intermediate
nodes IPv6 packet is allowed to travel.
110
IPv6 Address Types

Global unicast: A routable address in


the IPv6 Internet, similar to a public IPv4
address.
Link-local: Used only to communicate
with devices on the same local link.
Loopback: An address not assigned to
any physical interface that can be used
for a host to send an IPv6 packet to itself
IPv6 Address Types
Unspecified address: Used only as a
source address and indicates the
absence of an IPv6 address.
Unique local: Similar to a private
address in IPv4 (RFC 1918) and not
intended to be routable in the IPv6
Internet.
IPv4 embedded: An IPv6 address
that carries an IPv4 address in the
low-order 32 bits of the address.
IPv4 IPv6

IPv4 has a 32-bit address length IPv6 has a 128-bit address length

It Supports Manual and DHCP address configuration It supports Auto and renumbering address configuration

In IPv4 end to end, connection integrity is Unachievable In IPv6 end to end, connection integrity is Achievable

Address space of IPv6 is quite large it can produce


It can generate 4.29×109 address space
3.4×1038 address space

The Security feature is dependent on application IPSEC is an inbuilt security feature in the IPv6 protocol

Address representation of IPv4 is in decimal Address Representation of IPv6 is in hexadecimal

Fragmentation performed by Sender and forwarding


In IPv6 fragmentation performed only by the sender
routers

In IPv6 packet flow identification are Available and uses the


In IPv4 Packet flow identification is not available
flow label field in the header

In IPv4 checksum field is available In IPv6 checksum field is not available

In IPv6 multicast and anycast message transmission scheme


It has broadcast Message Transmission Scheme
is available

In IPv4 Encryption and Authentication facility not provided In IPv6 Encryption and Authentication are provided

You might also like