Chap 1 Network Layer and Protocols

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 79

IPv4 Addressing : Address Space

• An IPv4 address is a 32-bit address used to uniquely identify a host or a router on the Internet.
• IP addresses are globally managed by Internet Assigned Numbers Authority(IANA).
• Address Space:
• An address space is the total number of addresses used by the protocol.
• IPv4 uses 32-bit addresses, which means that the address space is 232 or 4,294,967,296 (more than four
billion)
• Notations:
IPv4 Addressing :Address Space

• Hierarchy in Addressing:
• A 32-bit IPv4 address is divided into two parts.:
• The first part of the address, called the prefix, defines the network;
• the second part of the address, called the suffix, defines the host(node)

• A prefix can be fixed length in Classful Addressing


• A prefix can be variable length in Classless Addressing
IPv4 Addressing:Classful Addressing

• In classful addressing address space is divided into five classes :class A, B, C, D, and E

• In class A, one byte defines the netid (prefix) and three bytes define the hostid (suffix).
• In class B, two bytes define the netid and two bytes define the hostid.
• In class C, three bytes define the netid and one byte defines the hostid.
IPv4 Addressing:Classful Addressing
• The IPv4 address is divided into two parts:
• Network ID
• Host ID
• Classful Addressing
• In classful addressing address space is divided into five classes :class A, B, C, D and E
• Classes A, B, and C are used by the majority of devices on the Internet
• Classes D and E are reserved for multicast and experimental purposes respectively.
• Each of these classes has a valid range of IP addresses.
IPv4 Addressing:Classful Addressing
• Class A :
• IP addresses belonging to class A are assigned to the networks that contain a large number of hosts.
• The network ID is 8 bits long.
• The host ID is 24 bits long.
• The first bit of the first octet in class A is always set to 0. The remaining 7 bits in the first octet are used to
determine network ID. The 24 bits of host ID are used to determine the host in any network
• IP addresses belonging to class A ranges from 0.0.0.0 – 127.255.255.255.
IPv4 Addressing:Classful Addressing
• Class B
• IP address belonging to class B is assigned to networks that range from medium-sized to large-sized
networks.
• The network ID is 16 bits long.
• The host ID is 16 bits long.
• The higher-order bits of the first octet of IP addresses of class B are always set to 10.
• The remaining 14 bits are used to determine the network ID and the 16 bits of host ID are used to
determine the host in a network.
• IP addresses belonging to class B ranges from 128.0.0.0 – 191.255.255.255.
IPv4 Addressing:Classful Addressing
• Class C
• IP addresses belonging to class C are assigned to small-sized networks.
• The network ID is 24 bits long.
• The host ID is 8 bits long.
• The higher-order bits of the first octet of IP addresses of class C is always set to 110.
• The remaining 21 bits are used to determine the network ID.
• The 8 bits of host ID are used to determine the host in any network.
• IP addresses belonging to class C range from 192.0.0.0 – 223.255.255.255.
IPv4 Addressing:Classful Addressing
• Class D
• IP address belonging to class D is reserved for multi-casting.
• The higher-order bits of the first octet of IP addresses belonging to class D is always set to 1110.
• IP addresses belonging to class D range from 224.0.0.0 – 239.255.255.255.

• Class E
• IP addresses belonging to class E are reserved for experimental and research purposes.
• The higher-order bits of the first octet of class E are always set to 1111.
• IP addresses of class E range from 240.0.0.0 – 255.255.255.255
IPv4 Addressing:Classful Addressing

• In classful addressing each class is divided into a fixed number of blocks with each block having a fixed
size as shown in Table.

Table : Number of blocks and block size in classful IPv4 addressing

Actual
Network No. of Blocks or Range of IP Address in
Leading Network Host Block Size or
Class Identifier Max. Dotted decimal Application
Bits Identifier Identifier Bits Max. number of hosts
Bits number of Networks notations
Bits
0.0.0.0 to Unicast(Large
A 0 8 7 27=128 24 224=1,67,77,216
127.255.255.255 organizations)
128.0.0.0 to Unicast(Midsize
B 10 16 14 214=16,384 16 216=65,536
191.255.255.255 organizations)
192.0.0.0 to Unicast(Small
C 110 24 21 221=20,97,152 8 28=256
223.255.255.255 organizations)
224.0.0.0 to
D 1110 - - - - - Multicasting
239.255.255.255
240.0.0.0 to Reserved for future
E 1111 - - - - -
255.255.255.255 use
IPv4 Addressing:Classful Addressing
• Problems with Classful Addressing
• The problem with this classful addressing method is that millions of class A addresses are wasted,
• Thousands of the class B addresses are wasted, whereas,
• The number of addresses available in class C is so small that it cannot satisfy 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.
• Because of these problems, Classful addressing was replaced by Classless Inter-Domain Routing (CIDR)
in 1993.
IPv4 Addressing:Classful Addressing:

• Subnet Mask:
• The purpose of subnet mask is to identify which part of an IP address is network part and which part is
host part.
• Subnet mask is a 32 bit number created by setting network bits to all 1s and setting host bits to all 0s.

Table : Default masks for classful addressing

• The last column of Table shows the mask in the form /n where n can be 8, 16, or 24 in classful addressing.
• This notation is also called slash notation or Classless Interdomain Routing (CIDR) notation.
IPv4 Addressing:Classful Addressing:
Example: Find the error, if any, in the following IPv4 addresses.

Solution:
a. There must be no leading zero (045).
b. There can be no more than four bytes in IP address.
c. Each number needs to be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal
notation is not allowed.
19.12
IPv4 Addressing:Classful Addressing:

Example :Find the class of each address.


a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111

Solution:
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is a class C
address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
19.13
IPv4 Addressing:Classful Addressing

• Address Depletion(Reduction in addresses):


• Due to address depletion, classful addressing is no longer useful and is replaced with classless addressing.
• To solve problem of address depletion, two strategies were proposed and, to some extent, implemented: Subnetting
and Supernetting
• Subnetting divides one large network into multiple small networks.
• Supernetting combines multiple small networks into one larger network.
Subnetting
• Subnetting :The practice of dividing a one network into two or more networks is called Subnetting
• In subnetting,a large network is divided into smaller subnetworks,each with its own subnet address

• Types of Subnetting:
• Fixed Length Subnetting:
• Fixed length subnetting (classful subnetting) divides network into subnets such that:
o All the subnet are of same size
o All the subnet have equal number of hosts
o All the subnet have same subnet mask

• Variable Length Subnetting


• Variable length subnetting (classless subnetting) divides network into subnets such that:
o All the subnet are not of same size
o All the subnet do not have equal number of hosts
o All the subnet do not have same subnet mask
Subnetting
For Example 1: Consider the network having IP address 192.168.14.0. Divide this network into 2 equal subnets
Subnetting
Subnetting
• For Example 1: Consider the network having IP address 192.168.14.0. Divide this network into 2 equal
subnets Subnet mask: 11111111 11111111 11111111 10000000
• 255.255.255.128
1st subnet 2nd subnet
• Network address of subnet/Subnet id: Network address of subnet/Subnet id:
• 192.168.14.00000000=192.168.14.0 192.168.14.10000000=192.168.14.128

• Broadcast address of subnet: Broadcast address of subnet:


• 192.168.14.01111111=192.168.14.127 192.168.14.11111111=192.168.14.255

• Valid hosts: 2n - 1 =27 -2=128-2=126 Valid hosts:2n -1 =27 -2=128-2=126

• Valid range of IP address: Valid range of IP address:


• 192.168.14.1 to 192.168.14.126 192.168.14.129 to 192.168.14.254
Subnetting
• For Example 2: Consider the network having IP address 192.168.14.0. Divide this network into 4
equal subnets
Subnetting
• For Example 3: Consider the network having IP address 192.168.14.0. Divide this network into 3
subnets, such that first subnet consists 126 hosts and other two consists 62 hosts
1st subnet 2nd subnet
• Subnet mask: 11111111 11111111 11111111 10000000 Subnet mask: 11111111 11111111 11111111 11000000
• 255.255.255.128 255.255.255.192
• Network address of subnet/Subnet id: Network address of subnet/Subnet id:
• 192.168.14.00000000=192.168.14.0 192.168.14.10000000= 192.168.14.128
• Broadcast address of subnet: Broadcast address of subnet :
• 192.168.14.01111111=192.168.14.127 192.168.14.10111111= 192.168.14.191
• Valid hosts: 2n - 1 =27 -2=128-2=126 Valid hosts:2n -1 = 26 -2 = 64-2 = 62
• Valid range of IP address: Valid range of IP address:
• 192.168.14.1 to 192.168.14.126 192.168.14.129 to 192.168.14.190
• 3rd subnet
• Network address of subnet/Subnet id:
• 192.168.14.11000000=192.168.14. 192
• Broadcast address of subnet:
• 192.168.14.11111111=192.168.14.255
• Valid hosts: 2n - 1 =26 -2=64- 2=62
• Valid range of IP address
Subnetting
• Uses of Subnetting in Computer Networks:
• Subnetting can improve network performance by reducing network congestion and improving routing
efficiency
• Subnetting can improve network security by separating different parts of the network into smaller
subnetworks, making it harder for unauthorized access.
• Subnetting can improve routing efficiency by allowing routers to route traffic directly to the appropriate
subnet instead of broadcasting it to the entire network
Supernetting
• Supernetting combines multiple small networks into one larger network.
• The class C network has maximum 256 addresses which may not satisfy the need of organization
• One solution is supernetting,In supernetting,an organization can combine several class C network to create large range
of addresses,In other word, several networks are combined to create a supernetwork.

• For example: an organization needs 1000 addresses and four class C


blocks granted to organization then organization can combine these four
networks into one super network as shown in fig
• 192.128.32.0/24,
192.128.33.0/24,
192.128.34.0/24,
192.128.35.0/24,

192.128.00100000.0/24
192.128.00100001.0/24
192.128.00100010.0/24
192.128.00100011.0/24

192.128.00100000.0/22

192.128.32.0/22 Super network address


Fig.A Supernetwork
Supernetting
• Example: Suppose we have four small networks with network ID as
• 201.1.0.0,
• 201.1.1.0,
• 201.1.2.0,
• 201.1.3.0. and we want to combine these four networks to form a supernet.
• Supernet Mask
• Supernet Mask is a 32-bit number where all the fixed bits of the network are represented by 1 and the variable
part is represented by 0.

• The supernet ID for all the four networks will be 201.1.0.0


Supernetting
• For Example:
• Consider four small networks:
192.128.197.0/24,
192.128.198.0/24,
192.128.199.0/24,
192.128.200.0/24,
and we want to combine these four networks into one supernet.
192.128.11000101.0/24
192.128.11000110.0/24
192.128.11000111.0/24
192.128.11001000.0/24

192.128.11000000.0/20
192.128.192.0/20 Super network address
IPv4 Addressing : Classless addressing

• In Classless addressing, the whole address space is divided into variable length blocks.
• The prefix in an address defines the block (network); the suffix defines the node (hosts).
• We can have a block of 1 address, 2 addresses, 4 addresses, 8 addresses, and so on.
• Restrictions on classless address blocks:
1. The addresses in block must contiguous , one after another.
2. The number of addresses in a block needs to be a power of 2.
3. The first address must be evenly divisible by the number of addresses.
IPv4 Addressing : Classless addressing
• Prefix Length: Slash Notation
• In classless addressing prefix length is variable.
• We can have a prefix length that ranges from 0 to 32.
• In classless address, the prefix length, n, is added to the address, separated by a slash.
• The notation is informally referred to as slash notation and formally as classless interdomain routing
or CIDR (pronounced cider) strategy
• An address in classless addressing can be represented as shown in Figure 18.20.
IPv4 Addressing: Classless addressing

• Extracting Information from an Address:


1.The number of addresses in the block is found as N = 2 32−n.
2. To find the first address, we keep the n leftmost bits as its and set the (32 − n) rightmost bits all to 0s.
3. To find the last address, we keep the n leftmost bits as its and set the (32 − n) rightmost bits all to 1s
IPv4 Addressing: Classless addressing

• Extracting Information from an Address:


Example:
A classless address is given as 167.199.170.82/27. find number of addresses in the block, first address and last address in
block.
We can find the above three pieces of information as follows.
• The number of addresses in the block are: 2 32 − n = 232 − 27 = 25 = 32 addresses.
• The first address can be found by keeping the first 27 bits in address as its and setting the rest of the bits to 0s.
• The last address can be found by keeping the first 27 bits in address as its and setting the rest of the bits to 1s.
IP Address: 167.199.170.82/27 10100111 11000111 10101010 01010010
First address: 167.199.170.64/27 10100111 11000111 10101010 01000000
Last address: 167.199.170.95/27 10100111 11000111 10101010 01011111

• The first address in a block is normally not assigned to any host;


The first address is called as the network address that represents the organization itself to the rest of the world.
• The last address in a block is normally not assigned to any host;
The last address is called as the broadcast address used to send packets to all hosts in a particular network.
IPv4 Addressing: Classless addressing
Example :A block of addresses is granted to a small organization. We
know that one of the addresses is 205.16.37.39/28. What is the first
address in the block?

Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32−28 rightmost bits to 0, we get
11001101 00010000 00100101 0010000
or
205.16.37.32.

19.29
IPv4 Addressing: Classless addressing

Example: Find the last address for the block in 205.16.37.39/28.


Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 − 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
or
205.16.37.47

19.30
IPv4 Addressing: Classless addressing

Example :Find the number of addresses for the block in 205.16.37.39/28.

Solution: The number of addresses in the block can be found by using the
formula 232−n

The value of n is 28, which means that number of addresses are= 2 32−28
=24
= 16

19.31
Example 19.9

Another way to find the first address, the last address, and the number of
addresses is to represent the mask as a 32-bit binary number.
In Example 205.16.37.39/28
the /28 can be represented as
11111111 11111111 11111111 11110000
(twenty-eight 1s and four 0s).

Find
a. The first address
b. The last address

19.32
Example 19.9 (continued)

Solution
a. The first address can be found by ANDing the given
addresses with the mask. ANDing here is done bit by
bit. The result of ANDing 2 bits is 1 if both bits are 1s;
the result is 0 otherwise.

19.33
Example 19.9 (continued)

b. The last address can be found by ORing the given


addresses with the complement of the mask. ORing
here is done bit by bit. The result of ORing 2 bits is 0 if
both bits are 0s; the result is 1 otherwise. The
complement of a number is found by changing each 1
to 0 and each 0 to 1.

19.34
IPv4 Addressing : Classless addressing
• Special Addresses: are not assigned to any host in a network and are used for special purposes:
• This-host Address :The only address in the block 0.0.0.0/32 is called the this-host address.
• It is used when host want to know its own IP address then host use this address as source address in packet and send
packet to Bootstrap server(DHCP server) .

• Limited-broadcast Address :The only address in the block 255.255.255.255/32 is called the limited-broadcast
address.
• It is used when host wants to broadcast packet to all devices in a network then host use this address as destination
address in packet and send packet to all devices in a network .

• Loopback Address :The block 127.0.0.0/8 (127.0.0.0-127.255.255.255) is called the loopback address.
• Its used when host wants to send packet to itself.(i.e. host can test its own connection)
• Loopback address 127.0.0.1 used to test network software on your computer
IPv4 Addressing : Classless addressing
• Special Addresses:
• Private Addresses: are used by organizations to create their own intranet.
• Four blocks are assigned as private addresses:
• 10.0.0.0/8(10.0.0.0 to 10.255.255.255)
• 172.16.0.0/12 (172.16.0.0 to 172.31.255.255)
• 192.168.0.0/16(192.168.0.0. to 192.168.255.255)
• 169.254.0.0/16(169.254.0.1 to 169.254.255.255) (Automatic Private IP addressing)
• With Automatic Private IP addressing computer can assign an IP address to itself, in case of DHCP server not
working or not available on a network .

• Multicast Addresses :The block 224.0.0.0/4 (224.0.0.0 to 239.255.255.255) is reserved for multicast addresses.
• Its used when host wants to send packet to group of devices in a network
IPv4 Addressing
Classful Addressing Classless Addressing
In classful addressing address space is divided into five In classless addressing, the whole address space is
classes :class A, B, C, D, and E, each class is divided into divided into variable length blocks.
a fixed length blocks
it allocates IP addresses according to five major classes Its IP address allocation method designed to
such as Class A,B,C,D,E replace the classful addressing
It uses fixed length prefix it uses variable length prefix
It uses fixed length subnet mask it uses variable length subnet mask
Its less effective method of allocating IP addresses Its more effective method of allocating IP addresses
Its less practical. Its more practical.
It does not support Classless Inter-Domain Routing It supports Classless Inter-Domain Routing
(CIDR). (CIDR).
It requires more bandwidth . As a result, it becomes slower It requires less bandwidth. Thus, fast and less
and more expensive as compared to classless addressing. expensive as compared to classful addressing.
IPv4 Addressing
Network Address Translation (NAT)
• Its process used to translates the private IP address to the public IP address and vice versa.
• Due to NAT, the computers in a private network are able to communicate with the computer in the public
network.

• As the figure shows, the private network uses private addresses.


• The router that connects the private network to the internet uses two addresses : one is private address and
another is public(global) address.
• The private network is invisible to the rest of the Internet;
• the rest of the Internet sees only the NAT router with the address 200.24.5.8.
Network Address Translation (NAT)
• Address Translation:
• For every outgoing packet, NAT router, replaces the private source address in the packet with its global address and
then packet forwarded to internet.
• For every incoming packet ,NAT router, replaces the destination address in the packet with the appropriate private
destination address and then packet is forwarded to particular destination in a private network. Figure 18.30 shows an
example of address translation.
Network Address Translation (NAT)
• Translation Table: It has two columns: the private address and the Universal(External) address
• When the router translates the source address of the outgoing packet , it make note of source address and destination
address(where the packet is going) of packet in translation table.
• When the response comes back from the destination, the router uses the source address of the packet to find the
private address of the packet. Figure 18.31 shows the idea.
Network Address Translation (NAT)
• Example of NAT : suppose, if the tablet user at home network wants the information about today’s news.
Network Layer Services
• Connection-Oriented Vs Connectionless Network Service
• Delivery of a packet can be accomplished by using either a connection-oriented or a connectionless network service.
• In a connection-oriented service, the source first makes a connection with the destination before sending a packet.
• When the connection is established , then source sent a sequence of packets to destination one after another.
• In connection-oriented service, there is a relationship between packets. Packets are sent on the same path in
sequential order.
• When all packets of a message have been delivered, the connection is terminated.

• In a connection less service, the source does not makes any connection with the destination.
• source sent a set of packets to destination without establishing connection with destination.
• In connection-less service, there is a no relationship between packets. Packets are sent on the same path or on
different path
Network Layer Protocols
• Internet Protocol version 4 (IPv4) is responsible for packetizing, forwarding, and delivery of a packet at the
network layer.
• The Internet Control Message Protocol version 4 (ICMPv4) helps IPv4 to handle some errors that may occur in
the network-layer delivery.
• The Internet Group Management Protocol (IGMP) is used to help IPv4 in multicasting.
• The Address Resolution Protocol (ARP) is used mapping network-layer addresses to link-layer addresses. (it find
MAC address of device from its IP address.)
• Figure 19.1 shows the positions of these four protocols in the TCP/IP protocol suite.
Internet Protocol(IP)
• IPv4 is an unreliable datagram protocol—a best-effort delivery service.
• The term best-effort means that IPv4 packets can be corrupted, be lost, arrive out of order, or be delayed, and may
create congestion for the network.
• If reliability is important, IPv4 must be paired with a reliable protocol such as TCP.
• An example of best-effort delivery service is the post office.
• The post office does its best to deliver the letters but does not always succeed.
• IPv4 is also a connectionless protocol that uses the datagram approach.
• Datagram approach means that each datagram is handled independently, and each datagram can follow a different
route to the destination.
Internet Protocol(IP) :Datagram format
• Datagram format: Packets used by IP are called datagram
• A datagram is a variable-length packet consisting of two parts: header and payload (data).
• The size of datagram is 20 to 65535 bytes
• The header is same as envelope of letter
• The Header consists information necessary for routing and delivery of packet.
• The size of header is 20 to 60 bytes
Internet Protocol(IP) :Datagram format
• Datagram format fields:
• Version Number(4 bits):it defines the version of the IPv4 protocol, In this case version of IP protocol is 4.
• Header Length(4 bits): it defines the length of IP datagram header.
• The minimum length of header is 20 bytes and maximum length of header is 60 bytes

• Total Length (16-bit) :it defines the total length of IP datagram including header and data.
Total length 216 =65536
Total length = Header length+ payload(data) length.
payload(data) length = Total length – Header length.
Internet Protocol(IP) :Datagram format
• Datagram format fields:
• Service Type(8-bit) : IETF(Internet Engineering Task Force) has changed the interpretation and name of this field.
This field, previously called service type, is now called differentiated service

• Precedence: is a 3-bit subfield ranging from 0 (000 in binary) to 7 (111 in binary).


• The precedence defines the priority of the datagram in case of congestion.
• In case of congestion router needs to discard some datagrams, then datagrams with lowest precedence are discarded
first.

• TOS bits: is a 4-bit subfield with each bit having a special meaning.
• Each bit can be either 0 or 1
• Only one of the bits can have the value of 1 in each datagram.
Internet Protocol(IP) :Datagram format
• Datagram format fields:
• Differentiated Services: In this interpretation, the first 6 bits make up the codepoint subfield, and the last 2 bits are
not used.
• The codepoint subfield can be used in two different ways:
• When the 3 rightmost bits are 0’s, then 3 leftmost bits are same as the precedence bits in the service type.
• When the 3 rightmost bits are not all 0’s, then 6 codepoint bits defines 64 services
• The first category contains 32 service types; the second and third category contain 16 service types.
• The first category (numbers 0, 2,4, ... ,62) is assigned by the Internet authorities (IETF).
• The second category (3, 7, 11, 15,…. , 63) can be used by local authorities (organizations).
• The third category (1, 5, 9, ….,61) is temporary and can be used for experimental purposes.
Internet Protocol(IP) :Datagram format
• Datagram format fields:
• Identification(16 Bit ):its unique number that identifies set of fragment of single datagram.
• The combination of Identification and IPv4 address uniquely identifies datagram.
• If datagram divided into multiple fragments then all the fragments must have same Identification number.

• Flags(3bits) :It defines three flags


• The leftmost bit is reserved (not used).
• The second bit (D bit) is called the do not fragment bit.
• If its value is 1, the machine will not fragment the datagram.
• If its value is 0, the datagram can be fragmented ,if necessary.
• The third bit (M bit) is called the more fragment bit.
• If its value is 1, it means the datagram is not the last fragment; there are more fragments after this one.
• If its value is 0, it means this is the last fragment.
Internet Protocol(IP) :Datagram format
• Fragmentation Offset(13-bit): it defines relative position of fragment with respect to whole datagram.
• Figure 19.6 shows a datagram with a data size of 4000 bytes fragmented into three fragments.
• The bytes in the original datagram are numbered 0 to 3999.
• The first fragment carries bytes 0 to 1399. The offset for this datagram is 0/8 = 0.
• The second fragment carries bytes 1400 to 2799; the offset value for this fragment is 1400/8 = 175.
• Finally, the third fragment carries bytes 2800 to 3999. The offset value for this fragment is 2800/8 = 350
• Remember that the value of the offset is measured in units of 8 bytes.
Internet Protocol(IP) :Datagram format
• Datagram format fields:
• Time-to-live(8 bit): This field limits lifetime of datagram in a network.
• It controls the maximum number of hops (routers) visited by the datagram.
• When a source host sends the datagram, it stores a value in this field.
• TTL Value=2 * maximum number of routers between any two hosts.
• Each router that processes the datagram, decrements this value by one.
• If value of TTL becomes zero before reaching destination, then router discards the datagram.

• Protocol(8 bit): it defines name of protocol to which data is to be passed.


• It also defines higher level protocol which uses service of IPv4.
• Protocol number for(ICMP is 1),(IGMP is 2),(TCP is 6)(UDP is 17) (OSPF is 89)

• Header checksum (16 bit): It consist checksum value for checking errors in the datagram header.
• Source Addresses (32-bit) : it defines the IP address of the source.
• Destination Addresses (32-bit) : it defines the IP address of the destination.

• Options: A datagram header can have up to 40 bytes of options.


• Options can be used for network testing and debugging purpose.
• Payload: is a actual data that source want to transfer to destination
• Payload is the packet coming from other protocols that use the service of IP.
Internet Protocol(IP) :Fragmentation
• Fragmentation: means dividing large datagram into small parts, each part is called fragment.
• If the size of the datagram is larger than the Maximum Transfer Unit(MTU) of network then datagram
can be fragmented.
• A datagram can be fragmented by the source host or any router in the path.
• Datagram may be fragmented several times before it reaches the final destination.
• Fragmented datagram can travel through different routes.
• When a datagram is fragmented, each fragment has its own header .
• The reassembly of the datagram is done only by the destination host
Internet Protocol(IP) :Fragmentation
Internet Protocol(IP) :Options
• Header of IPv4 datagram consists of two parts: Fixed part (20 bytes long) and .
• Variable part(max. upto 40 bytes) that consists different options.
• Options are not required for datagram but they can be used for network testing and debugging purpose.

• No-operation option is used as a filler(fill out space) between options.


Internet Protocol(IP) :Options
• End-of-option: It is used to makes the end
of header options of IP datagram.
• After this option, the receiver looks for the
payload data.
• It can only be used as the last option.

• Record route option: it is used to record


IP address of routers through which
datagram passes from source to
destination.
• This option can record up to 9 routers
addresses.
Internet Protocol(IP) :Options
Internet Protocol(IP) :Options
• Strict source route:
• Its used by source, to specify a route for datagram
and datagram need to follow that route strictly.
• If the datagram visits a router that is not in the list
then datagram is discarded and error message is
issued.

• Loose source route :


• It is similar with strict source route but it is more
flexible.
• Each router in the list must be visited, but the
datagram can also visit other routers as well.
Internet Protocol(IP) :Options
• Timestamp :
• It is used to record time required by router for
processing datagram.
• With help of timestamp option ,we can estimate
the time taken by a datagram to travel from one
router to another router.
• This time is measured in millisecond.
ICMPv4: Messages
• If any error occurs during transmission of packet , then router discards packet .
• IP does not have an inbuilt mechanism for sending error and control messages.
• IP depends on ICMP to provide error control.
• ICMP is used for reporting errors and management queries.
• ICMP does not correct errors-it simply reports them.

• ICMP messages: are divided into two broad categories:


• The error-reporting messages :
• if any error occurs during transmission of packet from source to destination then intermediate router sends
an ICMP error message to the source informing about the error.
• The query messages:
• A host or a network manager get specific information from a router or another host using query messages.
ICMPv4: Messages

• ICMP Message has an 8-byte header and a variable-size data section.


• Type field, defines the type of the message.
• Code field defines reason for the particular message.
• Checksum field defines value for checking errors in the datagram.
• The Rest of the header is specific for each message type.
• The Data section in error messages, carries information for finding the original packet that had the error.
• The Data section in query message carries extra information based on the type of the query.
ICMPv4: Error Reporting Messages
• Destination Unreachable:
• when router cannot route a datagram to destination, then datagram is discarded and the router sends a destination-
unreachable message back to the source host .
• For e.g. when we use the HTTP protocol to access a web page, but the server is down. The message “destination host
is unreachable” is created and sent back to the source.

• Source Quench:
• source quench message informs the sender that the network has encountered congestion and the datagram has been
dropped; the source needs to slow down sending more datagrams.
ICMPv4: Error Reporting Messages
• Redirection Message:
• It’s used when the source uses a wrong router to send out its packet then router forwards packet to appropriate router
and sends redirection message to source ,to informs the source to update its routing table.
• The IP address of the default router is sent in the message.

• Parameter Problem :
• When router detects problem in the header of a datagram or some options of header are missing then router sends the
“Parameter Problem” message to source.
ICMPv4: Error Reporting Messages
• Time exceeded message: Time exceeded message informs the source, datagram is discarded due to the
time to live field value reached zero.
ICMPv4: Query Messages
• Query Messages:
• query messages come in pairs: request and reply.
• The echo request and echo reply pair of messages are used by a host to test another host is alive or not.
• The host sends echo request message to another host ,if the another host is alive ,then it responds with an
echo reply message.

• timestamp request and timestamp reply :


• The hosts can use the timestamp request and timestamp reply messages to determine the round-trip time
needed for an IP datagram to travel from source to destination.
• It can also be used to synchronize the clocks in two machines.
ICMPv4 : Debugging Tools
• Debugging Tools: We can determine the availability of a host or router.
• Two tools that use ICMP for debugging: ping and traceroute.
• Ping: The ping program to find if a host is alive and responding.
• The source host sends ICMP echo-request messages to the destination, if destination host is alive, then it
responds with ICMP echo-reply messages.
• Example:
ICMPv4 : Debugging Tools
• The program Traceroute(In UNIX) or Tracert(In Windows):can be used to display route that a packet takes to
reach the destination.
• This is a program at the application level that uses the services of UDP.

• The first column corresponds to the hop count.


• The second column represents the address of that hop and after that, you see three space-separated time in
milliseconds. traceroute command sends three packets to the hop and each of the time refers to the time taken by the
packet to reach the hop.
ICMPv4 : Checksum
• In ICMP the checksum is calculated over the entire message(Header and Data).
• Checksum calculation:
1. The sender follows these steps using one’s complement arithmetic:
2. The checksum field is set to be zero.
3. The sum of all the 16 bit words (header and data)is calculated.
4. The sum is complemented to get the checksum.
5. The checksum is stored in the checksum field.

• Checksum Testing:
1. The sum of all words (header and data)is calculated.
2. The sum is complemented.
3. If the result obtained in step 2 is 16 0s, the message is accepted ; otherwise, it is rejected.
ICMPv4 : Checksum
• Example:Figure 19.11 shows an example of checksum calculation for a simple echo-request message. We randomly
chose the identifier to be 1 and the sequence number to be 9. The message is divided into 16-bit (2-byte) words. The
words are added and the sum is complemented. Now the sender can put this value in the checksum field.
MOBILE IP
• Mobile IP is the extension of IP protocol.
• Mobile IP allows mobile host to be connected to the Internet at any location.
• Addressing:Mobile IP provides two addresses for a mobile host:
• The mobile host has its original address, called the home address, and a temporary address, called the care-of
address.
• The home address is permanent; it associates the host with its home network,
• The care-of address is temporary. it is associated with the foreign network, the network to which the host moves.
• When a host moves from one network to another, the care-of address changes.
MOBILE IP
• Agents(Routers):
• Home Agent: is a router attached to the home network of the mobile host. The home agent receives the packet from
mobile host and sends it to the foreign agent.
• Foreign agent: is a router attached to the foreign network. The foreign agent receives the packet from home and
sends it to the mobile host.
• The mobile host can also act as a foreign agent.
• When mobile host act as a foreign agent, the care-of address is called a collocated care-of address.
MOBILE IP
• Three Phases: To communicate with a remote host, a mobile host goes through three phases: agent discovery,
registration, and data transfer, as shown in Figure 19.14.

• Agent Discovery:
• A mobile host must discover a home agent
before it leaves its home network.
• A mobile host must also discover a foreign
agent after it has moved to a foreign
network.
• Registration:
• The mobile host must register itself with the
foreign agent.
• The mobile host must register itself with its
home agent. This is normally done by the
foreign agent on behalf of the mobile host.
• Data Transfer:
• A mobile host can communicate with a
remote host.
MOBILE IP
• Data Transfer:
MOBILE IP
• Data Transfer:
• From Remote Host to Home Agent:
• When a remote host wants to send a packet to the mobile host, it uses its address as the source address and the home
address of the mobile host as the destination
• From Home Agent to Foreign Agent:
• After receiving the packet, the home agent sends the packet to the foreign agent, using the tunneling concept.
• The home agent encapsulates the whole IP packet inside another IP packet using its address as the source address
and the foreign agent’s address as the destination address.
• From Foreign Agent to Mobile Host:
• When the foreign agent receives the packet ,it removes the original packet. However, since the destination address is
the home address of the mobile host, the foreign agent consults a registry table to find the care-of address of the
mobile host and Then packet is then sent to the care-of address.
• From Mobile Host to Remote Host:
• When a mobile host wants to send a packet to a remote host , it sends as it does normally.
• The mobile host prepares a packet with its home address as the source, and the address of the remote host as the
destination.
MOBILE IP
• Inefficiency in Mobile IP:
• Communication involving mobile IP can be inefficient.
• The inefficiency can be severe or moderate.
• The severe case is called double crossing or 2X.
• The moderate case is called triangle routing or dog-leg routing
• Double crossing occurs when a remote host communicates with a mobile host that has moved to the same network
as the remote host.
• When the mobile host sends a packet to the remote host, there is no inefficiency.
• But, when the remote host sends a packet to the mobile host, the packet crosses the Internet twice.
MOBILE IP
• Inefficiency in Mobile IP:
• Triangle routing: occurs when the remote host communicates with a mobile host that is not attached to
the same network as the mobile host.
• When the mobile host sends a packet to the remote host, there is no inefficiency.
• But, when the remote host sends a packet to the mobile host, the packet goes from the remote host to
the home agent and then to the mobile host.
• The packet travels the two sides of a triangle, instead of just one side
Virtual Private Network (VPN)
• VPN is a service that creates a secure connection(i.e. VPN Tunnel) between your device and the internet.
• Tunneling is process of putting data packet inside another packet and sending it over internet
• VPN Tunnel is a encrypted connection between your device and VPN Server.
• How Does a VPN Works:
• 1.Install VPN Client software on your computer or laptop.
• 2. VPN Client software encrypt your data using VPN Protocols.
• 3.VPN Client establish VPN tunnel between your device and the internet.
• 4.VPN Client sends encrypted data to VPN server through VPN tunnel.

Fig. Working of VPN


Virtual Private Network (VPN)
• What is Tunneling:
• Tunneling is process by which each data packet is encapsulated inside another data packet and sending it over
internet.
• Tunneling involves process called Encapsulation and Encryption.

• VPN Protocol : is a software that allows securely sending and receiving data among two networks.
• Most popular VPN protocols are:
• OpenVPN
• IPsec(Internet Protocol Security)
• L2TP(Layer 2 Tunneling Protocol)
• PPTP(Point to Point Tunneling Protocol)
• SSL(Secure Socket Layer)
• TLS(Transport Layer Security)
• WireGuard Protocol
Virtual Private Network (VPN)
• Types of VPN:
1. Site to Site VPN: It is used to connect multiple networks together.
2. Remote VPN: It is used by individual users to securely access private network.

• Advantages of VPN:
• It provides Anonymity-hiding your identity.
• It provides Privacy-hiding your internet activity.
• It provides access to restricted internet contents.

You might also like