Unit 4 :Network layer
• Network Layer: Network Layer design issues,
• Communication Primitives: Unicast, Multicast, Broadcast.
• IPv4 Addressing (Classful and Classless),IPv4 Protocol,
• Network Address Translation (NAT), Routing algorithms : Link state
routing, Distance Vector Routing Protocols
• ARP,RARP, ICMP, IGMP,
• Congestion control algorithms: Open loop congestion control, Closed
loop congestion control
• Token & Leaky bucket algorithms.
Network layer functions
• Addressing
• Routing
• Encapsulation
• Decapsulation
• Fragmentation and assembly
• Error handling
Network Layer
• Network layer is majorly focused on getting packets from the source to the destination, routing error handling and congestion
control.
Before learning about design issues in the network layer, let’s learn about its various functions.
• Addressing:
Maintains the address at the frame header of both source and destination and performs addressing to detect various devices in
network.
• Packetizing:
This is performed by Internet Protocol. The network layer converts the packets from its upper layer.
• Routing:
It is the most important functionality. The network layer chooses the most relevant and best path for the data transmission from
source to destination.
• Inter-networking:
It works to deliver a logical connection across multiple devices.
Network layer design issues:
1. Store and Forward packet switching:
• The host sends the packet to the nearest router. This packet is stored
there until it has fully arrived once the link is fully processed by
verifying the checksum then it is forwarded to the next router till it
reaches the destination. This mechanism is called “Store and Forward
packet switching.”
2. Services provided to Transport Layer:
Through the network/transport layer interface, the network layer transfers
its services to the transport layer. These services are described below.
Based on the connections there are 2 types of services provided:
• Connectionless – The routing and insertion of packets into subnet is done
individually. No added setup is required.
• Connection-Oriented – Subnet must offer reliable service and all the
packets must be transmitted over a single route.
The objectives of the network layer while providing these services are
• The services should not be dependent upon the router technology.
• The router configuration details should not be of a concern to the
transport layer.
• A uniform addressing plan should be made available to the transport
layer, whether the network is a LAN, MAN or WAN.
• 3. Implementation of Connectionless Service:
Packet are termed as “datagrams” and corresponding subnet as
“datagram subnets”. When the message size that has to be transmitted
is 4 times the size of the packet, then the network layer divides into 4
packets and transmits each packet to router via a few protocol. Each
data packet has destination address and is routed independently
irrespective of the packets.
4. Implementation of Connection Oriented service:
To use a connection-oriented service, first we establish a connection, use it and
then release it. In connection-oriented services, the data packets are delivered to
the receiver in the same order in which they have been sent by the sender.
It can be done in either two ways :
• Circuit Switched Connection – A dedicated physical path or a circuit is established
between the communicating nodes and then data stream is transferred.
• Virtual Circuit Switched Connection – The data stream is transferred over a
packet switched network, in such a way that it seems to the user that there is a
dedicated path from the sender to the receiver. A virtual path is established here.
While, other connections may also be using the same path.
Communication primitives
• Unicast:
Unicast is a type of communication where data is sent from one
computer to another computer.
In Unicast type of communication, there is only one sender, and one
receiver.
Example:
1) Browsing a website. (Webserver is the sender and your computer is
the receiver.)
2) Downloading a file from a FTP Server. (FTP Server is the sender and
your computer is the receiver.)
Multicast
• Multicast is a type of communication where multicast traffic addressed for
a group of devices on the network. IP multicast traffic are sent to a group
and only members of that group receive and/or process the Multicast
traffic.
• Devices which are interested in a particular Multicast traffic must join to
that Multicast group to receive the traffic. IP Multicast Groups are
identified by Multicast IP Addresses (IPv4 Class D Addresses)
• In Multicast, the sender transmit only one copy of data and it is delivered
and/or processed to many devices (Not as delivered and processed by all
devices as in Broadcast) who are interested in that traffic.
• Example : Multicast Windows Deployment Services (WDS) OS deployment
traffic, IP TV etc
Broadcast
• Broadcast is a type of communication where data is sent from one
computer once and a copy of that data will be forwarded to all the
devices.
• In Broadcast, there is only one sender and the data is sent only once.
But the Broadcast data is delivered to all connected devices.
• Switches by design will forward the broadcast traffic and Routers by
design will drop the broadcast traffic. In other words, Routers will not
allow a broadcast from one LAN to cross the Router and reach
another Network Segment. The primary function of a Router is to
divide a big Broadcast domain to multiple smaller Broadcast domain.
• Example: ARP Request message, DHCP DISCOVER Message
Packet switching
• The packet switching is a switching technique in which the message is sent in one go, but
it is divided into smaller pieces, and they are sent individually.
• The message splits into smaller pieces known as packets and packets are given a unique
number to identify their order at the receiving end.
• Every packet contains some information in its headers such as source address,
destination address and sequence number.
• Packets will travel across the network, taking the shortest path as possible.
• All the packets are reassembled at the receiving end in correct order.
• If any packet is missing or corrupted, then the message will be sent to resend the
message.
• If the correct order of the packets is reached, then the acknowledgment message will be
sent.
• Approaches of Packet Switching
• There are two approaches to Packet Switching:
• 1. Datagram Packet switching
• 2. Virtual Circuit approach
Network layer design issues
• Store and forward switching
Network layer design issues
• Services Provide to Transport Layer
• Implementation of Connectionless Service
Network layer design issues
• Implementation of Connection Oriented Service
• Data transfer phase
• Setup phase
• Tear down phase
Disadvantages of packet switching
• Packet Switching technique cannot be implemented in those
applications that require low delay and high quality services.
• The protocols used in a packet switching technique are very complex
and requires high implementation cost.
• If the network is overloaded or corrupted, then it requires
retransmission of lost packets. It can also lead to the loss of critical
information if errors are nor recovered.
IP Address
• IP stands for Internet Protocol and describes a set of standards and requirements for
creating and transmitting data packets, or datagrams, across networks. The Internet
Protocol (IP) is part of the Internet layer of the Internet protocol suite. In the OSI model,
IP would be considered part of the network layer. IP is traditionally used in conjunction
with a higher-level protocol, most notably TCP. The IP standard is governed by RFC 791.
• An IP address (internet protocol address) is a numerical representation that uniquely
identifies a specific interface on the network.
• Addresses in IPv4 are 32-bits long. This allows for a maximum of 4,294,967,296 (232)
unique addresses. Addresses in IPv6 are 128-bits, which allow for 3.4 x 1038 (2128) unique
addresses.
• The total usable address pool of both versions is reduced by various reserved addresses
and other considerations.
• IP addresses are binary numbers but are typically expressed in decimal form (IPv4) or
hexadecimal form (IPv6) to make reading and using them easier for humans.
• IP address is an address having information about how to reach a
specific host, especially outside the LAN.
• An IP address is a 32 bit unique address having an address space of
232.
• IP addresses are unique –
• IP addresses are universal-
• IP addresses used in source address and destination address fields of
IP header.
Structure of IP frame header
• IP header includes many relevant information including Version
Number, which, in this context, is 4. Other details are as follows −
• Version − Version no. of Internet Protocol used (e.g. IPv4).
0100/0101
• IHL − Internet Header Length; Length of entire IP header.
• DSCP − Differentiated Services Code Point; this is Type of Service.
• Total Length − Length of entire IP Packet (including IP header and IP
Payload).
• Identification − If IP packet is fragmented during the transmission, all the fragments
contain same identification number to identify original IP packet they belong to.
• Flags − As a required by the network resources, if IP Packet is too large to handle, these
‘flags’ tells if they can be fragmented or not.
DF bit stands for Do Not Fragment bit.
Its value may be 0 or 1.
When DF bit is set to 0,
It grants the permission to the intermediate devices to fragment the datagram if required.
When DF bit is set to 1,
It indicates the intermediate devices not to fragment the IP datagram at any
cost.
If network requires the datagram to be fragmented to travel further but
settings does not allow its fragmentation, then it is discarded.
An error message is sent to the sender saying that the datagram has been
discarded due to its settings.
MF Bit-
MF bit stands for More Fragments bit.
Its value may be 0 or 1.
When MF bit is set to 0,
It indicates to the receiver that the current datagram is either the last
fragment in the set or that it is the only fragment.
When MF bit is set to 1,
It indicates to the receiver that the current datagram is a fragment of
some larger datagram.
More fragments are following.
MF bit is set to 1 on all the fragments except the last one.
• Fragment Offset − This is a offset tells the exact position of the
fragment in the original IP Packet. Fragment Offset is a 13 bit field.
It indicates the position of a fragmented datagram in the original
unfragmented IP datagram.
The first fragmented datagram has a fragment offset of zero.
• 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.
• This is done because the length of the offset field is only 13 bits and cannot represent a
sequence of bytes greater than 8191. This forces hosts or routers that fragment
datagrams to choose a fragment size so that the first byte number is divisible by 8.
Time to Live − To avoid looping in the network, every packet is sent with some TTL value set, which
tells the network how many routers (hops) this packet can cross. At each hop, its value is
decremented by one and when the value reaches zero, the packet is discarded.
• Protocol − Tells the Network layer at the destination host, to which
Protocol this packet belongs to, i.e. the next level Protocol. For example
protocol number of ICMP is 1, TCP is 6 and UDP is 17.
• Header Checksum − This field is used to keep checksum value of entire
header which is then used to check if the packet is received error-free.
• Source Address − 32-bit address of the Sender (or source) of the packet.
• Destination Address − 32-bit address of the Receiver (or destination) of the
packet.
• Options − A data gram header can have upto 40bytes of options used for
network testing and debugging.
• Payload: Data in main reason for creating datagram. Payload is packet
coming from other protocol that use the service of IP.
Classful Addressing
• In Classful addressing, the address space is divided into five classes: A, B, C,
D, and E. Each of these classes has a valid range of IP addresses. Classes D
and E are reserved for multicast and experimental purposes respectively.
The order of bits in the first octet determines the classes of IP address.
•
• IPv4 address is divided into two parts:
• Net-id: The net-id denotes the address of the network.
Host-id: The hoist-id denotes the address of the host attached to the
corresponding network.
• The class of IP address is used to determine the bits used for network ID
and host ID and the number of total networks and hosts possible in that
particular class. Each ISP or network administrator assigns an IP address to
each device that is connected to its network.
• 01111111 . 11111111. 11111111. 11111111
• Classes of Classful address
• Class A
• The network id of class A is defined by the first byte of the 32-bit IPv4
address. In class A, the first bit of the net-id stays ‘0′ to define that
the IPv4 address belongs to the class A and the other 7 bits of the
net-id can be changed to defines different blocks in class A. As the
first bit is preserved the remaining seven bits calculate the number of
blocks in the class A i.e. 27= 128 blocks. There are 128 blocks in class
A, as the addressing would start from 0 the range of blocks will be
from 0-127.
• The host-id in class A is defined by the remaining three bytes of the
IPv4 address which is equal to 24 bits. So, we can calculate
the number of hosts for each block as 224=16,777,216. So, we
conclude that we can assign 128 blocks from class A to 128
organizations where each organization can have 16,777,216 hosts
connected to the network.
• Now, as we have calculated the number of blocks and the number of
addresses in each block of class A. Let us count the total number of
addresses in class A which can be calculated as follow:
• As we have seen above the first bit of the entire 32-bit
addresses of class A stays ‘0’. The remaining 31 bits of 32-bit
addresses can be changed to define the address space of class
A i.e. 231= 2,147,483,648.
• Class B
• 128-191
• The network id or the net-id of class B is defined using the first two
bytes of the IPv4 address. The first two bits of net-id stays ‘10’ to define
that the IPv4 address belongs to the class B and the remaining 14 bits of
net-id can be changed to calculate the number of blocks in class B i.e. 214=
16,384.
• The next two bytes to of IPv4 address denotes the host id in class B which
is 16 bits. The number of hosts can be calculated as 216= 65,536. So, we
conclude that we can assign 16,384 blocks from class B to 16,384
organizations where each organization can have 65,536 hosts connected to
the network.
• Now, as we have calculated the number of blocks and the number of
addresses in each block of class B. Let us count the total number of
addresses in class B which can be calculated as follow:
• As we have seen above the first two bits of the entire 32-bit
addresses of class B stays ‘10’ to define the class. The remaining 30
bits of entire 32-bit addresses can be changed to define the address
space of class B i.e. 230= 1,073,741,824.
• Class C
192-223
• In class C the network id is defined by the first 3 bytes of the IPv4 address.
The first 4 bits in network id stay ‘110’ to define the class and the
remaining 21 bits defines the number of blocks in class B. The number of
blocks can be calculated as 221= 2,097,152.
• The last byte of the IPv4 address in class C defines the host-id. The number
of hosts can be calculated as 28 = 256. So, we conclude that we can assign
2,097,152 blocks from class C to 2,097,152 organizations where each
organization can have 256 hosts connected to the network.
• Now, as we have calculated the number of blocks and the number of
addresses in each block of class C. Let us count the total number of
addresses in class C which can be calculated as follow:
• As we have seen above the first three bits of the entire 32-bit
addresses of class C stays ‘110’ to define the class. The remaining 29
bits of entire 32-bit addresses can be changed to define the address
space of class C i.e. 229= 536,870,912.
• Class D
•
• 223-239
• Like class A, B & C, class D does not divide IPv4 into net-id and host-
id. All the addresses of class D are of one single block. The class D
addresses are designed for multicasting. The first four-bit of entire
32-bit addresses of class D stays ‘1110’ to define the class.
• The remaining 28 bits from the 32-bit addresses of class D can be
changed to define the address space of class D. So, the number of
addresses in class D is 228=2,68,435,456.
• Class E
240-255
• Like class D, Class E addresses are one block addresses. The addresses
in class E are not split into net-id and host-id. The addresses in class E
are reserved for future use. The first four bits of entire 32-bit IPv4
addresses of class E stays ‘1111’. The remaining 28-bit changes to
define the number of addresses in class E i.e. 228=2,68,435,456.
• 192.168.2.1
128 64 32 16 8 4 2 1
1 1 0 0 0 0 0 0
1 0 1 0 1 0 0 0
0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 1
Network Address
• It is the first address that defines network on internet. It cannot be assigned to any device or
host.
• It can be used by router to direct the message to organization from outside.
• Example: If IP address is 126.17.24.8 then identify the network address and type of network.
• Check 1st byte = 126
• Since, it is in range 0-127, it is the type of Class A address.
• First byte defines network id in class A, therefore we can find the network address by replacing Host ID with
0’s.
• Thus, for the IP address 126.17.24.8, the network address = 126.0.0.0
• Another method: 201.24.67.32 (Class B)
AND
255.255.0.0 (Class B Default mask)
201.24.0.0 (Network Address)
• 192.168.2.1
128 64 32 16 8 4 2 1
1 1 0 0 0 0 0 0
1 0 1 0 1 0 0 0
0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 1
Network Address
• It is the first address that defines network on internet. It cannot be assigned to any device or
host.
• It can be used by router to direct the message to organization from outside.
• Example: If IP address is 126.17.24.8 then identify the network address and type of network.
• Check 1st byte = 126
• Since, it is in range 0-127, it is the type of Class A address.
• First byte defines network id in class A, therefore we can find the network address by replacing Host ID with
0’s.
• Thus, for the IP address 126.17.24.8, the network address = 126.0.0.0
• Another method: 201.24.67.32 (Class B)
AND
255.255.0.0 (Class B Default mask)
201.24.0.0 (Network Address)
Special IP Address
• All zeros address
0.0.0.0/32: Only one single address. All zero’s means this is host when they are just booted but not
used.
• 00000000...Host
A host on this networks. Used to communicate within the current Network.
• All ones address
255.255.255.255/32 All ones means one of the host can use this address to broadcast on the local
network.
• Network….111111
Broadcast on distant network. It allows all machine to send broadcast packets to distant LAN’s
anywhere in the internet.
• Loop-back addresses
127.0.0.0 – 127.0.0.8 (anything). It is the reserved address for loop back testing. Then it is
used for debugging the network software.
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.
• Since there are these problems, Classful networking was replaced by
Classless Inter-Domain Routing (CIDR) in 1993.
• We have run out of class A and B addresses, and a class C block is too small
for most midsize organizations. One solution that has alleviated the
problem is the idea of classless addressing.
Classless Addressing
• To overcome address depletion and give more organizations access to
the Internet, classless addressing was designed and implemented.
• In this scheme, there are no classes, but the addresses are still
granted in blocks
• In classless addressing, when an entity, small or large, needs to be
connected to the Internet, it is granted a block (range) of addresses.
The size of the block (the number of addresses) varies based on the
nature and size of the entity.
• For example, a household may be given only two addresses; a large
organization may be given thousands of addresses.
IP Addressing | Classless Addressing
• Address Mask (or Default Mask)
• This notation is called Slash or Classless Inter Domain Routing (CIDR) notation.
• Given IP address 132.6.17.85 and default class B mask, find the beginning address
(network address).
• The default mask is 255.255.0.0, which means that the only the first 2 bytes are preserved
and the other 2 bytes are set to 0. Therefore, the network address is 132.6.0.0.
Class Dotted decimal Binary CIDR
A 255.0.0.0 11111111 00000000 00000000 00000000 /8
B 255.255.0.0 11111111 11111111 00000000 00000000 /16
C 255.255.255.0 11111111 00000000 00000000 00000000 /24
Restriction
• To simplify the handling of addresses, the Internet authorities impose
three restrictions on classless address blocks:
• 1. The addresses in a block must be contiguous, one after another.
• 2. The number of addresses in a block must be a power of 2 (I, 2, 4, 8,
... ).
• 3. The first address must be evenly divisible by the number of
addresses.
• A mask is a 32-bit number in which the n leftmost bits are 1s and the
32 - n rightmost bits are 0s.
• in classless addressing the mask for a block can take any value from 0
to 32.
• It is very convenient to give just the value of n preceded by a slash
(CIDR notation).
• A mask is a 32-bit number in which the n leftmost bits are 1s and the
32 - n rightmost bits are 0s.
• in classless addressing the mask for a block can take any value from 0
to 32.
• It is very convenient to give just the value of n preceded by a slash
(CIDR notation).
CIDR-Addressing format
Sub Netting
• IP was originally designed with two levels of addressing (netid+ hostid)
• To reach a host on the internet, we must first reach the network and then the host.
• We need more than 2 levels for two reasons:
1. Organization that was granted a block in class A or B needed to divide its large network into
several subnetwork for better security and management.
2. Since the blocks in class A and B were almost depleted and blocks in class C were smaller
than the needs of most organizations.
• Thus, the organization that has been granted a block into smaller subblocks and shares them
with other organizations.
• Split a large network or combine multiple small networks for efficient use of address space
• – Subnetting – divide a large network into multiple small networks
• – Supernetting – combine multiple small networks into a single large
• network
• Subnet mask – denote the number of bits in the network address field
Divide a Network into Subnets
Subnet Mask
• Network mask is used when a network is not subnetted.
• When we divide a network to several subnetworks, we need to create
a subnetwork mask for each subnet. A subnet has subnet id and host
id.
• Subnetting increases the length of net id and decreases length of host
id.
• Subnetwork address:
• It is calculated by ANDING of
destination address and subnet mask.
Examples
• Describe the subnetwork address id if the destination address is 200.45.34.56 and
subnet mask is 255.255.240.0
Destination Address: 200.45.34.56
11001000 0010110100100010 00111000
Subnet Mask: 255.255.240.0
11111111 11111111 11110000 00000000
ANDING
11001000 00101101 00100000 00000000
200.45.32.0
• Find subnetwok address if destination address is 198.47.34.31 and subnet mask is
255.255.224.0
• Network on internet has subnet mask 255.255.240.0. What is the maximum number of
hosts it can handle?
Example
• An ISP is granted a block of addresses starting with
190.100.0.0/16 (65,536 addresses). The ISP needs to
distribute these addresses to three groups of customers as
follows:
a. The first group has 64 customers; each needs 256
addresses.
b. The second group has 128 customers; each needs 128
addresses.
c. The third group has 128 customers; each needs 64
addresses.
Design the subblocks and find out how many addresses are
still available after these allocations
Special address
Divide a Network into Subnets
• Let the IP address of a network is 203.110.0.0/16
• We want to divide this network into three subnets
• We need 3 bits for subnets – why not 2 bits?
• – Subnet 1 – 100, Subnet 2– 101, Subnet 3 – 110
• Rest 13 bits are used for addressing the hosts of those subnets.
• The subnets are – 203.110.128.0/19, 203.110.160.0/19, 203.110.192.0/19
Subnet design
problems
Subnet design problems
• A company is granted the site address 201.70.64.0 (class C). The
company needs six subnets. Design the subnets.
• The number of 1s in the default mask is 24(class C).
• The company needs six subnets.
This number 6 is not a power of 2.
The next number that is a power of 2 is 8 (2^3). We need 3 more 1s
in the subnet mask.
The total number of 1s in the subnet mask is 27(2^4 + 3).
The total number of 0s is 5 (32 - 27).
• The mask is
11111111 11111111 11111111 11100000
or
255.255.255.224255.255.255.224
The number of subnets is 8.
The number of addresses in each subnet is 25 (5 is
the number of 0s) or 32.
• The six subnets are:
201.70.64.0
201.70.64.32
201.70.64.64201.70.64.64
201.70.64.96
201.70.64.128
201.70.64.160
The remaining 2 are unused
201.70.64.192 201.70.64.224

IP HEADER_CLASSFUL Addressing and Classless addressing

  • 1.
  • 2.
    • Network Layer:Network Layer design issues, • Communication Primitives: Unicast, Multicast, Broadcast. • IPv4 Addressing (Classful and Classless),IPv4 Protocol, • Network Address Translation (NAT), Routing algorithms : Link state routing, Distance Vector Routing Protocols • ARP,RARP, ICMP, IGMP, • Congestion control algorithms: Open loop congestion control, Closed loop congestion control • Token & Leaky bucket algorithms.
  • 3.
    Network layer functions •Addressing • Routing • Encapsulation • Decapsulation • Fragmentation and assembly • Error handling
  • 4.
    Network Layer • Networklayer is majorly focused on getting packets from the source to the destination, routing error handling and congestion control. Before learning about design issues in the network layer, let’s learn about its various functions. • Addressing: Maintains the address at the frame header of both source and destination and performs addressing to detect various devices in network. • Packetizing: This is performed by Internet Protocol. The network layer converts the packets from its upper layer. • Routing: It is the most important functionality. The network layer chooses the most relevant and best path for the data transmission from source to destination. • Inter-networking: It works to deliver a logical connection across multiple devices.
  • 5.
    Network layer designissues: 1. Store and Forward packet switching: • The host sends the packet to the nearest router. This packet is stored there until it has fully arrived once the link is fully processed by verifying the checksum then it is forwarded to the next router till it reaches the destination. This mechanism is called “Store and Forward packet switching.”
  • 6.
    2. Services providedto Transport Layer: Through the network/transport layer interface, the network layer transfers its services to the transport layer. These services are described below. Based on the connections there are 2 types of services provided: • Connectionless – The routing and insertion of packets into subnet is done individually. No added setup is required. • Connection-Oriented – Subnet must offer reliable service and all the packets must be transmitted over a single route.
  • 7.
    The objectives ofthe network layer while providing these services are • The services should not be dependent upon the router technology. • The router configuration details should not be of a concern to the transport layer. • A uniform addressing plan should be made available to the transport layer, whether the network is a LAN, MAN or WAN.
  • 8.
    • 3. Implementationof Connectionless Service: Packet are termed as “datagrams” and corresponding subnet as “datagram subnets”. When the message size that has to be transmitted is 4 times the size of the packet, then the network layer divides into 4 packets and transmits each packet to router via a few protocol. Each data packet has destination address and is routed independently irrespective of the packets.
  • 9.
    4. Implementation ofConnection Oriented service: To use a connection-oriented service, first we establish a connection, use it and then release it. In connection-oriented services, the data packets are delivered to the receiver in the same order in which they have been sent by the sender. It can be done in either two ways : • Circuit Switched Connection – A dedicated physical path or a circuit is established between the communicating nodes and then data stream is transferred. • Virtual Circuit Switched Connection – The data stream is transferred over a packet switched network, in such a way that it seems to the user that there is a dedicated path from the sender to the receiver. A virtual path is established here. While, other connections may also be using the same path.
  • 10.
    Communication primitives • Unicast: Unicastis a type of communication where data is sent from one computer to another computer. In Unicast type of communication, there is only one sender, and one receiver. Example: 1) Browsing a website. (Webserver is the sender and your computer is the receiver.) 2) Downloading a file from a FTP Server. (FTP Server is the sender and your computer is the receiver.)
  • 12.
    Multicast • Multicast isa type of communication where multicast traffic addressed for a group of devices on the network. IP multicast traffic are sent to a group and only members of that group receive and/or process the Multicast traffic. • Devices which are interested in a particular Multicast traffic must join to that Multicast group to receive the traffic. IP Multicast Groups are identified by Multicast IP Addresses (IPv4 Class D Addresses) • In Multicast, the sender transmit only one copy of data and it is delivered and/or processed to many devices (Not as delivered and processed by all devices as in Broadcast) who are interested in that traffic. • Example : Multicast Windows Deployment Services (WDS) OS deployment traffic, IP TV etc
  • 14.
    Broadcast • Broadcast isa type of communication where data is sent from one computer once and a copy of that data will be forwarded to all the devices. • In Broadcast, there is only one sender and the data is sent only once. But the Broadcast data is delivered to all connected devices.
  • 15.
    • Switches bydesign will forward the broadcast traffic and Routers by design will drop the broadcast traffic. In other words, Routers will not allow a broadcast from one LAN to cross the Router and reach another Network Segment. The primary function of a Router is to divide a big Broadcast domain to multiple smaller Broadcast domain. • Example: ARP Request message, DHCP DISCOVER Message
  • 17.
    Packet switching • Thepacket switching is a switching technique in which the message is sent in one go, but it is divided into smaller pieces, and they are sent individually. • The message splits into smaller pieces known as packets and packets are given a unique number to identify their order at the receiving end. • Every packet contains some information in its headers such as source address, destination address and sequence number. • Packets will travel across the network, taking the shortest path as possible. • All the packets are reassembled at the receiving end in correct order. • If any packet is missing or corrupted, then the message will be sent to resend the message. • If the correct order of the packets is reached, then the acknowledgment message will be sent. • Approaches of Packet Switching • There are two approaches to Packet Switching: • 1. Datagram Packet switching • 2. Virtual Circuit approach
  • 18.
    Network layer designissues • Store and forward switching
  • 19.
    Network layer designissues • Services Provide to Transport Layer • Implementation of Connectionless Service
  • 20.
    Network layer designissues • Implementation of Connection Oriented Service • Data transfer phase • Setup phase • Tear down phase
  • 22.
    Disadvantages of packetswitching • Packet Switching technique cannot be implemented in those applications that require low delay and high quality services. • The protocols used in a packet switching technique are very complex and requires high implementation cost. • If the network is overloaded or corrupted, then it requires retransmission of lost packets. It can also lead to the loss of critical information if errors are nor recovered.
  • 23.
    IP Address • IPstands for Internet Protocol and describes a set of standards and requirements for creating and transmitting data packets, or datagrams, across networks. The Internet Protocol (IP) is part of the Internet layer of the Internet protocol suite. In the OSI model, IP would be considered part of the network layer. IP is traditionally used in conjunction with a higher-level protocol, most notably TCP. The IP standard is governed by RFC 791. • An IP address (internet protocol address) is a numerical representation that uniquely identifies a specific interface on the network. • Addresses in IPv4 are 32-bits long. This allows for a maximum of 4,294,967,296 (232) unique addresses. Addresses in IPv6 are 128-bits, which allow for 3.4 x 1038 (2128) unique addresses. • The total usable address pool of both versions is reduced by various reserved addresses and other considerations. • IP addresses are binary numbers but are typically expressed in decimal form (IPv4) or hexadecimal form (IPv6) to make reading and using them easier for humans.
  • 24.
    • IP addressis an address having information about how to reach a specific host, especially outside the LAN. • An IP address is a 32 bit unique address having an address space of 232. • IP addresses are unique – • IP addresses are universal- • IP addresses used in source address and destination address fields of IP header.
  • 26.
    Structure of IPframe header
  • 28.
    • IP headerincludes many relevant information including Version Number, which, in this context, is 4. Other details are as follows − • Version − Version no. of Internet Protocol used (e.g. IPv4). 0100/0101 • IHL − Internet Header Length; Length of entire IP header. • DSCP − Differentiated Services Code Point; this is Type of Service. • Total Length − Length of entire IP Packet (including IP header and IP Payload).
  • 29.
    • Identification −If IP packet is fragmented during the transmission, all the fragments contain same identification number to identify original IP packet they belong to. • Flags − As a required by the network resources, if IP Packet is too large to handle, these ‘flags’ tells if they can be fragmented or not. DF bit stands for Do Not Fragment bit. Its value may be 0 or 1. When DF bit is set to 0, It grants the permission to the intermediate devices to fragment the datagram if required. When DF bit is set to 1,
  • 30.
    It indicates theintermediate devices not to fragment the IP datagram at any cost. If network requires the datagram to be fragmented to travel further but settings does not allow its fragmentation, then it is discarded. An error message is sent to the sender saying that the datagram has been discarded due to its settings. MF Bit- MF bit stands for More Fragments bit. Its value may be 0 or 1.
  • 31.
    When MF bitis set to 0, It indicates to the receiver that the current datagram is either the last fragment in the set or that it is the only fragment. When MF bit is set to 1, It indicates to the receiver that the current datagram is a fragment of some larger datagram. More fragments are following. MF bit is set to 1 on all the fragments except the last one.
  • 32.
    • Fragment Offset− This is a offset tells the exact position of the fragment in the original IP Packet. Fragment Offset is a 13 bit field. It indicates the position of a fragmented datagram in the original unfragmented IP datagram. The first fragmented datagram has a fragment offset of zero.
  • 34.
    • shows adatagram 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. • This is done because the length of the offset field is only 13 bits and cannot represent a sequence of bytes greater than 8191. This forces hosts or routers that fragment datagrams to choose a fragment size so that the first byte number is divisible by 8.
  • 35.
    Time to Live− To avoid looping in the network, every packet is sent with some TTL value set, which tells the network how many routers (hops) this packet can cross. At each hop, its value is decremented by one and when the value reaches zero, the packet is discarded.
  • 36.
    • Protocol −Tells the Network layer at the destination host, to which Protocol this packet belongs to, i.e. the next level Protocol. For example protocol number of ICMP is 1, TCP is 6 and UDP is 17. • Header Checksum − This field is used to keep checksum value of entire header which is then used to check if the packet is received error-free. • Source Address − 32-bit address of the Sender (or source) of the packet. • Destination Address − 32-bit address of the Receiver (or destination) of the packet. • Options − A data gram header can have upto 40bytes of options used for network testing and debugging. • Payload: Data in main reason for creating datagram. Payload is packet coming from other protocol that use the service of IP.
  • 37.
    Classful Addressing • InClassful addressing, the address space is divided into five classes: A, B, C, D, and E. Each of these classes has a valid range of IP addresses. Classes D and E are reserved for multicast and experimental purposes respectively. The order of bits in the first octet determines the classes of IP address. • • IPv4 address is divided into two parts: • Net-id: The net-id denotes the address of the network. Host-id: The hoist-id denotes the address of the host attached to the corresponding network. • The class of IP address is used to determine the bits used for network ID and host ID and the number of total networks and hosts possible in that particular class. Each ISP or network administrator assigns an IP address to each device that is connected to its network.
  • 40.
    • 01111111 .11111111. 11111111. 11111111 • Classes of Classful address • Class A • The network id of class A is defined by the first byte of the 32-bit IPv4 address. In class A, the first bit of the net-id stays ‘0′ to define that the IPv4 address belongs to the class A and the other 7 bits of the net-id can be changed to defines different blocks in class A. As the first bit is preserved the remaining seven bits calculate the number of blocks in the class A i.e. 27= 128 blocks. There are 128 blocks in class A, as the addressing would start from 0 the range of blocks will be from 0-127.
  • 41.
    • The host-idin class A is defined by the remaining three bytes of the IPv4 address which is equal to 24 bits. So, we can calculate the number of hosts for each block as 224=16,777,216. So, we conclude that we can assign 128 blocks from class A to 128 organizations where each organization can have 16,777,216 hosts connected to the network.
  • 42.
    • Now, aswe have calculated the number of blocks and the number of addresses in each block of class A. Let us count the total number of addresses in class A which can be calculated as follow: • As we have seen above the first bit of the entire 32-bit addresses of class A stays ‘0’. The remaining 31 bits of 32-bit addresses can be changed to define the address space of class A i.e. 231= 2,147,483,648.
  • 43.
    • Class B •128-191 • The network id or the net-id of class B is defined using the first two bytes of the IPv4 address. The first two bits of net-id stays ‘10’ to define that the IPv4 address belongs to the class B and the remaining 14 bits of net-id can be changed to calculate the number of blocks in class B i.e. 214= 16,384. • The next two bytes to of IPv4 address denotes the host id in class B which is 16 bits. The number of hosts can be calculated as 216= 65,536. So, we conclude that we can assign 16,384 blocks from class B to 16,384 organizations where each organization can have 65,536 hosts connected to the network.
  • 45.
    • Now, aswe have calculated the number of blocks and the number of addresses in each block of class B. Let us count the total number of addresses in class B which can be calculated as follow: • As we have seen above the first two bits of the entire 32-bit addresses of class B stays ‘10’ to define the class. The remaining 30 bits of entire 32-bit addresses can be changed to define the address space of class B i.e. 230= 1,073,741,824.
  • 46.
    • Class C 192-223 •In class C the network id is defined by the first 3 bytes of the IPv4 address. The first 4 bits in network id stay ‘110’ to define the class and the remaining 21 bits defines the number of blocks in class B. The number of blocks can be calculated as 221= 2,097,152. • The last byte of the IPv4 address in class C defines the host-id. The number of hosts can be calculated as 28 = 256. So, we conclude that we can assign 2,097,152 blocks from class C to 2,097,152 organizations where each organization can have 256 hosts connected to the network.
  • 48.
    • Now, aswe have calculated the number of blocks and the number of addresses in each block of class C. Let us count the total number of addresses in class C which can be calculated as follow: • As we have seen above the first three bits of the entire 32-bit addresses of class C stays ‘110’ to define the class. The remaining 29 bits of entire 32-bit addresses can be changed to define the address space of class C i.e. 229= 536,870,912.
  • 49.
    • Class D • •223-239 • Like class A, B & C, class D does not divide IPv4 into net-id and host- id. All the addresses of class D are of one single block. The class D addresses are designed for multicasting. The first four-bit of entire 32-bit addresses of class D stays ‘1110’ to define the class. • The remaining 28 bits from the 32-bit addresses of class D can be changed to define the address space of class D. So, the number of addresses in class D is 228=2,68,435,456.
  • 51.
    • Class E 240-255 •Like class D, Class E addresses are one block addresses. The addresses in class E are not split into net-id and host-id. The addresses in class E are reserved for future use. The first four bits of entire 32-bit IPv4 addresses of class E stays ‘1111’. The remaining 28-bit changes to define the number of addresses in class E i.e. 228=2,68,435,456.
  • 53.
    • 192.168.2.1 128 6432 16 8 4 2 1 1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1
  • 54.
    Network Address • Itis the first address that defines network on internet. It cannot be assigned to any device or host. • It can be used by router to direct the message to organization from outside. • Example: If IP address is 126.17.24.8 then identify the network address and type of network. • Check 1st byte = 126 • Since, it is in range 0-127, it is the type of Class A address. • First byte defines network id in class A, therefore we can find the network address by replacing Host ID with 0’s. • Thus, for the IP address 126.17.24.8, the network address = 126.0.0.0 • Another method: 201.24.67.32 (Class B) AND 255.255.0.0 (Class B Default mask) 201.24.0.0 (Network Address)
  • 57.
    • 192.168.2.1 128 6432 16 8 4 2 1 1 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1
  • 58.
    Network Address • Itis the first address that defines network on internet. It cannot be assigned to any device or host. • It can be used by router to direct the message to organization from outside. • Example: If IP address is 126.17.24.8 then identify the network address and type of network. • Check 1st byte = 126 • Since, it is in range 0-127, it is the type of Class A address. • First byte defines network id in class A, therefore we can find the network address by replacing Host ID with 0’s. • Thus, for the IP address 126.17.24.8, the network address = 126.0.0.0 • Another method: 201.24.67.32 (Class B) AND 255.255.0.0 (Class B Default mask) 201.24.0.0 (Network Address)
  • 60.
    Special IP Address •All zeros address 0.0.0.0/32: Only one single address. All zero’s means this is host when they are just booted but not used. • 00000000...Host A host on this networks. Used to communicate within the current Network. • All ones address 255.255.255.255/32 All ones means one of the host can use this address to broadcast on the local network. • Network….111111 Broadcast on distant network. It allows all machine to send broadcast packets to distant LAN’s anywhere in the internet. • Loop-back addresses 127.0.0.0 – 127.0.0.8 (anything). It is the reserved address for loop back testing. Then it is used for debugging the network software.
  • 62.
    Problems with ClassfulAddressing • 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. • Since there are these problems, Classful networking was replaced by Classless Inter-Domain Routing (CIDR) in 1993. • We have run out of class A and B addresses, and a class C block is too small for most midsize organizations. One solution that has alleviated the problem is the idea of classless addressing.
  • 63.
    Classless Addressing • Toovercome address depletion and give more organizations access to the Internet, classless addressing was designed and implemented. • In this scheme, there are no classes, but the addresses are still granted in blocks
  • 64.
    • In classlessaddressing, when an entity, small or large, needs to be connected to the Internet, it is granted a block (range) of addresses. The size of the block (the number of addresses) varies based on the nature and size of the entity. • For example, a household may be given only two addresses; a large organization may be given thousands of addresses.
  • 65.
    IP Addressing |Classless Addressing • Address Mask (or Default Mask) • This notation is called Slash or Classless Inter Domain Routing (CIDR) notation. • Given IP address 132.6.17.85 and default class B mask, find the beginning address (network address). • The default mask is 255.255.0.0, which means that the only the first 2 bytes are preserved and the other 2 bytes are set to 0. Therefore, the network address is 132.6.0.0. Class Dotted decimal Binary CIDR A 255.0.0.0 11111111 00000000 00000000 00000000 /8 B 255.255.0.0 11111111 11111111 00000000 00000000 /16 C 255.255.255.0 11111111 00000000 00000000 00000000 /24
  • 66.
    Restriction • To simplifythe handling of addresses, the Internet authorities impose three restrictions on classless address blocks: • 1. The addresses in a block must be contiguous, one after another. • 2. The number of addresses in a block must be a power of 2 (I, 2, 4, 8, ... ). • 3. The first address must be evenly divisible by the number of addresses.
  • 67.
    • A maskis a 32-bit number in which the n leftmost bits are 1s and the 32 - n rightmost bits are 0s. • in classless addressing the mask for a block can take any value from 0 to 32. • It is very convenient to give just the value of n preceded by a slash (CIDR notation).
  • 68.
    • A maskis a 32-bit number in which the n leftmost bits are 1s and the 32 - n rightmost bits are 0s. • in classless addressing the mask for a block can take any value from 0 to 32. • It is very convenient to give just the value of n preceded by a slash (CIDR notation).
  • 69.
  • 70.
    Sub Netting • IPwas originally designed with two levels of addressing (netid+ hostid) • To reach a host on the internet, we must first reach the network and then the host. • We need more than 2 levels for two reasons: 1. Organization that was granted a block in class A or B needed to divide its large network into several subnetwork for better security and management. 2. Since the blocks in class A and B were almost depleted and blocks in class C were smaller than the needs of most organizations. • Thus, the organization that has been granted a block into smaller subblocks and shares them with other organizations. • Split a large network or combine multiple small networks for efficient use of address space • – Subnetting – divide a large network into multiple small networks • – Supernetting – combine multiple small networks into a single large • network • Subnet mask – denote the number of bits in the network address field
  • 71.
    Divide a Networkinto Subnets
  • 72.
    Subnet Mask • Networkmask is used when a network is not subnetted. • When we divide a network to several subnetworks, we need to create a subnetwork mask for each subnet. A subnet has subnet id and host id. • Subnetting increases the length of net id and decreases length of host id. • Subnetwork address: • It is calculated by ANDING of destination address and subnet mask.
  • 73.
    Examples • Describe thesubnetwork address id if the destination address is 200.45.34.56 and subnet mask is 255.255.240.0 Destination Address: 200.45.34.56 11001000 0010110100100010 00111000 Subnet Mask: 255.255.240.0 11111111 11111111 11110000 00000000 ANDING 11001000 00101101 00100000 00000000 200.45.32.0 • Find subnetwok address if destination address is 198.47.34.31 and subnet mask is 255.255.224.0 • Network on internet has subnet mask 255.255.240.0. What is the maximum number of hosts it can handle?
  • 74.
    Example • An ISPis granted a block of addresses starting with 190.100.0.0/16 (65,536 addresses). The ISP needs to distribute these addresses to three groups of customers as follows: a. The first group has 64 customers; each needs 256 addresses. b. The second group has 128 customers; each needs 128 addresses. c. The third group has 128 customers; each needs 64 addresses. Design the subblocks and find out how many addresses are still available after these allocations
  • 81.
  • 82.
    Divide a Networkinto Subnets • Let the IP address of a network is 203.110.0.0/16 • We want to divide this network into three subnets • We need 3 bits for subnets – why not 2 bits? • – Subnet 1 – 100, Subnet 2– 101, Subnet 3 – 110 • Rest 13 bits are used for addressing the hosts of those subnets. • The subnets are – 203.110.128.0/19, 203.110.160.0/19, 203.110.192.0/19
  • 83.
  • 88.
    Subnet design problems •A company is granted the site address 201.70.64.0 (class C). The company needs six subnets. Design the subnets. • The number of 1s in the default mask is 24(class C). • The company needs six subnets. This number 6 is not a power of 2. The next number that is a power of 2 is 8 (2^3). We need 3 more 1s in the subnet mask. The total number of 1s in the subnet mask is 27(2^4 + 3). The total number of 0s is 5 (32 - 27).
  • 89.
    • The maskis 11111111 11111111 11111111 11100000 or 255.255.255.224255.255.255.224 The number of subnets is 8. The number of addresses in each subnet is 25 (5 is the number of 0s) or 32.
  • 90.
    • The sixsubnets are: 201.70.64.0 201.70.64.32 201.70.64.64201.70.64.64 201.70.64.96 201.70.64.128 201.70.64.160 The remaining 2 are unused 201.70.64.192 201.70.64.224