COMPUTER NETWORK
(21EC53)
Module-3
Dr. Shivashankar
Professor
Department of Electronics & Communication
Engineering
RRIT, Bangalore
1/27/2024 1
Dr. Shivashankar, E&CE, RRIT
Course Outcomes
After Completion of the course, student will be able to
▪Understand the concepts of networking thoroughly.
▪Describe the various network architectures
▪Identify the protocols and services of different layers
▪Distinguish the basic network configurations and
standards associated with each network models.
▪Analyze a simple network and measurements of its
parameters.
Text Book:
Data Communications and Networking , Forouzan, 5th
Edition, McGraw Hill, 2016 ISBN: 1-25-906475-3
1/27/2024 2
Dr. Shivashankar, E&CE, RRIT
Module 3
Network Layer
• The Network Layer is the third layer of the TCP/IP suite.
• It handles the service requests from the transport layer and further forwards
the service request to the data link layer.
• The network layer translates the logical addresses into physical addresses
• The main functions performed by the network layer are:
➢ Routing:
➢ Logical Addressing:
➢ Internetworking:
➢ This is the main role of the network layer that it provides the logical
connection between different types of networks.
➢ Fragmentation:
➢ The fragmentation is a process of breaking the packets into the smallest
individual data units that travel through different networks.
1/27/2024 3
Dr. Shivashankar, E&CE, RRIT
NETWORK-LAYER SERVICES
1. Packetizing
• The first duty of the network layer is definitely packetizing:
• The process of encapsulating the data received from upper layers of the
network-payload in a network layer packet at the source and decapsulating
the payload from the network layer packet at the destination is known as
packetizing.
• Another duty of the network layer is to carry a payload from the source to the
destination without changing it or using it.
• The source host receives the payload from an upper-layer protocol, adds a
header that contains the source and destination addresses and some other
information.
2. Routing and Forwarding
• Routing: The network layer is responsible for routing the packet from its
source to the destination.
• There is more than one route from the source to the destination.
• The network layer is responsible for finding the best one among these possible
routes using some specific strategies.
1/27/2024 4
Dr. Shivashankar, E&CE, RRIT
Forwarding:
• Forwarding is simply defined as the action applied by each router when a
packet arrives at one of its interfaces.
• When a router receives a packet from one of its attached networks, it needs
to forward the packet to another attached network.
1/27/2024 5
Dr. Shivashankar, E&CE, RRIT
Figure 18.2 Forwarding process
Cont…
Other Services
Error Control
Flow control
Congestion control : Congestion may occur if the number of datagrams sent by
source computers is beyond the capacity of the network or routers. In this
situation, some routers may drop some of the datagrams.
Quality of Service: As the Internet has allowed new applications such as
multimedia communication (in particular real-time communication of audio and
video), the quality of service (QoS) of the communication has become more and
more important.
Security : The network layer was designed with no security provision.
Today, however, security is a big concern.
To provide security for a connectionless network layer, we need to have another
virtual level that changes the connectionless service to a connection-oriented
service.
This virtual layer, called IPSec.
1/27/2024 6
Dr. Shivashankar, E&CE, RRIT
PACKET SWITCHING
• Packet switching is the transfer of small pieces of data across various
networks. These data chunks or “packets” allow for faster, more efficient data
transfer.
• Each packet in connectionless packet switching includes the following
information in its header section:
➢ Source address
➢ Destination address
➢ Total number of packets
➢ Sequence number (Seq#) for reassembly
▪ Once the packets reach their destination via various routes, the receiving
devices rearrange them to form the original message.
▪ Advantages of Packet Switching over Circuit Switching:
➢ Efficiency
➢ Speed
➢ Digital
➢ Reliability.
1/27/2024 7
Dr. Shivashankar, E&CE, RRIT
Datagram Approach: Connectionless Service
• A packet-switching technology in which a packet exists is called a datagram.
• It is treated as a separate entity.
• Each packet includes data about the destination, and the switch helps this
data forward the packet to the right destination. It is also known as
connectionless switching.
• In the datagram approach, the forwarding decision is based on the destination
address of the packet.
• There is no dedicated transmission path.
1/27/2024 8
Dr. Shivashankar, E&CE, RRIT
Figure 18.3 A connectionless packet-switched network
Virtual-Circuit Approach: Connection-Oriented Service
• Virtual Circuit is the computer network providing connection-oriented
service. It is a connection-oriented network.
• In virtual circuit resource are reserve for the time interval of data transmission
between two nodes.
• This network is a highly reliable medium of transfer.
• Virtual circuits are costly to implement..
• It ensures the transmission of all packets
1/27/2024 9
Dr. Shivashankar, E&CE, RRIT
Figure 18.5 A virtual-circuit packet-switched network
IPV4 Address
• IPv4 could be a 32-Bit IP Address.
• IPv4 could be a numeric address, and its bits are separated by a dot.
• The number of header fields is twelve and the length of the header field is
twenty.
• It has Unicast, broadcast, and multicast style of addresses.
• IPv4 supports VLSM (Virtual Length Subnet Mask).
• IPv4 uses the Post Address Resolution Protocol to map to the MAC address.
• RIP may be a routing protocol supported by the routed daemon.
• Networks ought to be designed either manually or with DHCP.
• Packet fragmentation permits from routers and causing host.
• Example: 172.16.50.56
1/27/2024 10
Dr. Shivashankar, E&CE, RRIT
Address Space
• IPv4 has a certain address space. An address space is the total number of addresses
used by the protocol.
• If a protocol uses N bits to define an address, the address space is 2N
• IPv4 uses 32-bit addresses, which means that the address space is 232 or 4,294,967,296
(more than four billion).
• If there were no restrictions, more than 4 billion devices could be connected to the
Internet.
Notation
• There are three common notations to show an IPv4 address:
➢ binary notation (base 2): 32 bit data.
➢ dotted-decimal notation (base 256): 0-255
➢ hexadecimal notation (base 16): Each hexadecimal digit is equivalent to four bits
1/27/2024 11
Dr. Shivashankar, E&CE, RRIT
Figure 18.16 Three different notations in IPv4
addressing
Classful Addressing
• Classful addressing is an IPv4 addressing architecture.
• The 32 bit IP address is divided into five sub-classes. These are:
➢ Class A
➢ Class B
➢ Class C
➢ Class D
➢ Class E
• IPv4 address is divided into two parts:
➢ Network ID: The class of IP address is used to determine the bits used for network ID
➢ Host ID: host ID and the number of total networks and hosts possible in that particular
class.
1/27/2024 12
Dr. Shivashankar, E&CE, RRIT
conti..
• In class A, the network length is 8 bits, but since the first bit, which is 0,
• This means there are only 27 = 128 .
• In class B, the network length is 16 bits, This means there are only 214 =
16,384.
• All addresses that start with (110)2 belong to class C. network length is 24 bits,
This means there are 221 = 2,097,152.
• Class D is not divided into prefix and suffix.
• It is used for multicast addresses.
• All addresses that start with 1111 in binary belong to class E.
• As in Class D, Class E is not divided into prefix and suffix and is used as
1/27/2024 13
Dr. Shivashankar, E&CE, RRIT
Classless Adressing
• Classless addressing is an IPv4 addressing architecture that uses variable-
length subnet masking.
• In classless addressing, variable-length blocks are used that belong to no
classes. We can have a block of 1 address, 2 addresses, 4 addresses, 128
addresses, and so on.
• 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 (device).
• Theoretically, a block of 20, 21, 22, . . . , 232 addresses.
• One of the restrictions, is that the number of addresses in a block needs to be
a power of 2.
1/27/2024 14
Dr. Shivashankar, E&CE, RRIT
Figure 18.19 Variable-length blocks in classless addressing
Dynamic Host Configuration Protocol (DHCP)
• DHCP is a client/server protocol that automatically provides an Internet Protocol (IP)
host with its IP address and other related configuration information.
• IP address assignment in an organization can be done automatically using DHCP.
• DHCP is an application-layer program, using the client-server paradigm.
• DHCP has found such widespread use in the Internet that it is often called a plug- and-
play protocol.
• DHCP can also be configured to provide temporary, on demand, IP addresses to hosts.
• It also allows an ISP with 1000 granted addresses to provide services to 4000
households.
1/27/2024 15
Dr. Shivashankar, E&CE, RRIT
Figure 18.25 DHCP message format
Network Address Resolution (NAT)
• A Network Address Translation (NAT) is the process of mapping an internet
protocol (IP) address to another by changing the header of IP packets while in
transit via a router.
• This helps to improve security and decrease the number of IP addresses an
organization needs.
1/27/2024 16
Dr. Shivashankar, E&CE, RRIT
Figure 18.29: NAT
Figure 18.30 Address translation
Network-Layer Protocols
INTERNET PROTOCOL (IP)
• 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) a protocol that allows
several devices to share one IP address so they can all receive the same data.
• The Address Resolution Protocol (ARP) is used to glue the network and data-
link layers in mapping network-layer addresses to link-layer addresses.
1/27/2024 17
Dr. Shivashankar, E&CE, RRIT
Figure 19.1 Position of IP and other network-layer protocols in TCP/IP protocol suite
Datagram Format
• Packets used by the IP are called data- grams.
• A datagram is a variable-length packet consisting of two parts: header and
payload (data).
• The header is 20 to 60 bytes in length and contains information essential to
routing and delivery.
• It is customary in TCP/IP to show the header in 4-byte sections.
1/27/2024 18
Dr. Shivashankar, E&CE, RRIT Figure 19.2 IP datagram
Fragmentation
• It is technique in which gateways break up or divide larger packets into smaller ones
called fragments.
• Each fragment is then sent as a separate internal packet.
• Each fragment has its separate header and trailer.
• The first fragment has an offset field value of zero.
• Divide the length of the first fragment by 8. The second fragment has an offset value
equal to that result.
• Divide the total length of the first and second fragment by 8.
• The third fragment has an offset value equal to that result.
• Continue the process. The last fragment has its M bit set to 0.
• Continue the process. The last fragment has a more bit value of 0.
1/27/2024 19
Dr. Shivashankar, E&CE, RRIT
Figure 19.6 Fragmentation example
Options
• Options can be used for network testing and debugging.
• Option processing is required of the IPv4 software.
• This means that all implementations must be able to handle options if they
are present in the header.
• Options are divided into two broad categories:
1. Single-Byte Options:
• No Operation: A no-operation option is a 1-byte option used as a filler
between options.
• End of Option: An end-of-option option is a 1-byte option used for padding at
the end of the option field.
2. Multliple-Byte Options:
• Record Route: A record route option is used to record the Internet routers that
handle the datagram.
• Strict Source Route: A strict source route option is used by the source to
predetermine a route for the data- gram as it travels through the Internet.
1/27/2024 20
Dr. Shivashankar, E&CE, RRIT
Security of IPv4 Datagrams
• The IP security architecture (IPsec) provides cryptographic
protection for IP datagrams in IPv4 and IPv6 network packets.
• This protection can include confidentiality, strong integrity of
the data, data authentication, and partial sequence integrity.
• No security was provided for the IPv4 protocol.
• The Internet is not secure anymore.
• There are three security issues, applicable to the IP protocol:
➢ packet sniffing,
➢ packet modification,
➢ and IP spoofing.
1/27/2024 21
Dr. Shivashankar, E&CE, RRIT
Packet Sniffing
• An intruder may intercept an IP packet and make a copy of it.
• Packet sniffing is a passive attack, in which the attacker does not
change the contents of the packet.
• This type of attack is very difficult to detect because the sender
and the receiver may never know that the packet has been
copied. Although packet sniffing cannot be stopped, encryption
of the packet can make the attacker’s effort useless.
• The attacker may still sniff the packet, but the content is not
detectable.
• Ex: Pass word Sniffing
• TCP Session Hijacking
• DNS Poisoning
• DHCP attacking
• ARP sniffing
1/27/2024 22
Dr. Shivashankar, E&CE, RRIT
Packet Modification
• The second type of attack is to modify the packet.
• The attacker intercepts the packet, changes its contents, and sends
the new packet to the receiver.
• The receiver believes that the packet is coming from the original
sender.
• This type of attack can be detected using a data integrity mechanism.
• The receiver, before opening and using the contents of the message,
can use this mechanism to make sure that the packet has not been
changed during the transmission.
➢ Examples of Modification attacks include:
➢ Modifying the contents of messages in the network.
➢ Changing information stored in data files.
➢ Altering programs so they perform differently.
➢ Reconfiguring system hardware or network topologies.
1/27/2024 23
Dr. Shivashankar, E&CE, RRIT
IP Spoofing
• An attacker can masquerade as somebody else and create an IP packet that
carries the source address of another computer.
• An attacker can send an IP packet to a bank pretending that it is coming from
one of the customers.
• This type of attack can be prevented using an origin authentication
mechanism.
• Types of IP spoofing
➢ Distributed Denial of Service (DDoS) attacks: This allows them to slow down
or crash a website or network with large volumes of internet traffic .
➢ Masking botnet devices: A botnet is a network of computers that hacker’s
control from a single source.
➢ Man-in-the-middle attacks: Another malicious IP spoofing method uses
a ‘man-in-the-middle’ attack to interrupt communication between two
computers, alter the packets, and transmit them without the original sender
or receiver knowing.
1/27/2024 24
Dr. Shivashankar, E&CE, RRIT
IPV6 Addressing and Protocols
• An IPv6 address is a 128-bit alphanumeric value that identifies an endpoint
device in an Internet Protocol Version 6 (IPv6) network.
• IPv6 is the successor to a previous addressing infrastructure, IPv4, which
had limitations IPv6 was designed to overcome.
• Each group is expressed as four hexadecimal digits and the groups are
separated by colons.
• An example:
• FE80:CD00:0000:0CDE:1257:0000:211E:729C
• An IPv6 address is split into two parts:
• a network and a node component.
• The network component is the first 64 bits of the address and is used for
routing.
• The node component is the later 64 bits and is used to identify the address
of the interface.
• It is derived from the physical, or MAC address, using the 64-bit extended
unique identifier (EUI-64) format defined by the Institute of Electrical and
Electronics Engineers (IEEE).
1/27/2024 Dr. Shivashankar, E&CE, RRIT 25
IPV6 Addressing and Protocols
• IPv6 address space
• Global unicast: These addresses are routable on the internet and start
with "2001:" as the prefix group. Global unicast addresses are the
equivalent of IPv4 public addresses.
• Unicast address: Used to identify the interface of an individual node.
• Anycast address. Used to identify a group of interfaces on different
nodes.
• Multicast address. An address used to define Multicast Multicasts are
used to send a single packet to multiple destinations at one time.
• Link local addresses. One of the two internal address types that are
not routed on the internet. Link local addresses are used inside an
internal network, are self-assigned and start with "fe80:" as the prefix
group.
• Unique local addresses. This is the other type of internal address that
is not routed on the internet. Unique local addresses are equivalent to
the IPv4 addresses 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
1/27/2024 Dr. Shivashankar, E&CE, RRIT 26
IPV6: Autoconfiguration
• One of the interesting features of IPv6 addressing is the autoconfiguration
of hosts.
• In IPv4, the host and routers are originally configured manually by the
network manager.
• However, the Dynamic Host Configuration Protocol, DHCP, can be used to
allocate an IPv4 address to a host that joins the network.
• In IPv6, DHCP protocol can still be used to allocate an IPv6 address to a
host, but a host can also configure itself.
• it can configure itself using the following process:
1. The host first creates a link local address for itself. The result is a 128-bit
link local address.
2. The host then tests to see if this link local address is unique and not used
by other hosts. Since the 64-bit interface identifier is supposed to be
unique, the link local address generated is unique with a high probability.
3. If the uniqueness of the link local address is passed, the host stores this
address as its link local address (for private communication), but it still
needs a global unicast address.
1/27/2024 Dr. Shivashankar, E&CE, RRIT 27
THE IPv6 PROTOCOL
• The change of the IPv6 address size requires the change in the IPv4 packet
format.
• The designer of IPv6 decided to implement remedies for other
shortcomings now that a change is inevitable.
• The following shows other changes implemented in the protocol in
addition to changing address size and format.
❑ Better header format: IPv6 uses a new header format in which options are
separated from the base header and inserted, when needed, between the
base header and the data.
❑ New options: IPv6 has new options to allow for additional functionalities.
❑ Allowance for extension: IPv6 is designed to allow the extension of the
protocol if required by new technologies or applications.
❑ Support for resource allocation: This mechanism can be used to support
traffic such as real-time audio and video.
❑ Support for more security: The encryption and authentication options in
IPv6 provide confidentiality and integrity of the packet.
1/27/2024 Dr. Shivashankar, E&CE, RRIT 28
Packet Format
• Each packet is composed of a base header followed by the payload.
• The base header occupies 40 bytes, whereas payload can be up to 65,535
bytes of information.
• Fig: IPV6 packet format
•
1/27/2024 Dr. Shivashankar, E&CE, RRIT 29
Fig: Base Header
Conti..
• Version: The 4-bit version field defines the version number of the IP. For IPv6, the
value is 6.
• Traffic class: The 8-bit traffic class field is used to distinguish different payloads
with different delivery requirements. It replaces the type-of-service field in IPv4.
• Flow label: The flow label is a 20-bit field that is designed to provide special
handling for a particular flow of data.
• Payload length: The 2-byte payload length field defines the length of the IP
datagram excluding the header. Note that IPv4 defines two fields related to the
length: header length and total length. In IPv6, the length of the base header is
fixed (40 bytes).
• Next header: The next header is an 8-bit field defining the type of the first
extension header or the type of the data that follows the base header in the
datagram.
• Hop limit: The 8-bit hop limit field serves the same purpose as the TTL field in
IPv4.
• Source and destination addresses. The source address field is a 16-byte (128-bit)
Internet address that identifies the original source of the datagram.
• Payload: Compared to IPv4, the payload field in IPv6 has a different format and
meaning
1/27/2024 Dr. Shivashankar, E&CE, RRIT 30
Extension Header
• An IPv6 packet is made of a base header and some extension headers. The length
of the base header is fixed at 40 bytes.
• Six types of extension headers have been defined.
➢ hop-by-hop option
➢ source routing
➢ Fragmentation
➢ authentication
➢ encrypted security payload and
➢ destination option.
1/27/2024 Dr. Shivashankar, E&CE, RRIT 31
Figure 22.8 Extension header types
Unicast Routing
• Unicast means the transmission from a single sender to a single receiver.
• One to one delivery.
• One to many called multicasting.
Least-Cost Routing
• When an internet is modeled as a weighted graph, one of the ways to interpret the
best route from the source router to the destination router is to find the least cost
between the two.
• The source router chooses a route to the destination router in such a way that the
total cost for the route is the least cost among all possible routes.
1/27/2024 32
Dr. Shivashankar, E&CE, RRIT
Figure 20.1 An internet and its graphical representation
ROUTING ALGORITHMS
Distance-Vector Routing Protocol
• It calculates the distance and direction of the vector of the next hop from
the information obtained by the neighboring router.
• Distance Vector routing protocols base their decisions on the best path to a
given destination based on the distance.
• Distance is usually measured in hops, though the distance metric could be
delay, packets lost, or something similar.
• It is necessary to keep track of the topology and inform neighboring devices if
any changes occur in the topology.
• Distance vector protocols send their entire routing table to directly connected
neighbors.
• Examples of distance vector protocols include RIP - Routing Information
Protocol and IGRP - Interior Gateway Routing Protocol.
1/27/2024 33
Dr. Shivashankar, E&CE, RRIT
Cont..
Bellman-Ford Equation
Bellman-Ford is a single source shortest path algorithm that determines the
shortest path between a given source vertex and every other vertex in a graph.
This algorithm can be used on both weighted and unweighted graphs.
Let dx(y) be the cost of the least-cost path from node x to node y.
The least costs are related by Bellman-Ford equation.
Where the minv is the equation taken for all x neighbors.
After traveling from x to v, if we consider the least-cost path from v to y, the path
cost will be c(x,v)+dv(y).
The least cost from x to y is the minimum of c(x,v)+dv(y) taken over all neighbors.
1/27/2024 34
Dr. Shivashankar, E&CE, RRIT
dx(y) = minv{c(x,v) + dv(y)} (3.1)
Example
1/27/2024 35
Dr. Shivashankar, E&CE, RRIT
Link-State Routing
• Link state routing is a method in which each router shares its
neighbourhood’s knowledge with every other router in the
internetwork.
• In this algorithm, each router in the network understands the network
topology then makes a routing table depend on this topology.
• Each router will share data about its connection to its neighbour, who
will, consecutively, reproduce the data to its neighbours, etc.
• This appears just before all routers have constructed a topology of the
network.
• This method uses the term link-state to define the characteristic of a
link (an edge) that represents a network in the internet.
• In this algorithm the cost associated with an edge defines the state of
the link. Links with lower costs are preferred to links with higher costs;
if the cost of a link is infinity, it means that the link does not exist or
has been broken.
1/27/2024 36
Dr. Shivashankar, E&CE, RRIT
Figure 20.9 LSPs created and sent out by each node to build LSDB
1/27/2024 37
Dr. Shivashankar, E&CE, RRIT
Path-Vector Routing
• Both link-state and distance-vector routing are based on the least-cost goal.
• However, there are instances where this goal is not the priority.
• A path-vector routing protocol is a network routing protocol which maintains
the path information that gets updated dynamically.
• Updates that have looped through the network and returned to the same
node are easily detected and discarded.
• A routing policy is a set of rules that determines how routes are selected,
advertised, or filtered based on various criteria, such as performance,
security, or business agreements.
• It has three phases:
➢ Initiation
➢ Sharing
➢ Updating
1/27/2024 38
Dr. Shivashankar, E&CE, RRIT
Path-Vector Routing
1/27/2024 39
Dr. Shivashankar, E&CE, RRIT
Figure 20.11 Spanning trees in path-vector routing
Figure 20.13 Updating path vectors
Objective Questions
1. The network layer is concerned with __________ of data.
a) bits
b) frames
c) packets
d) bytes
2. Which one of the following is not a function of network layer?
a) routing
b) inter-networking
c) congestion control
d) error control
3. A 4 byte IP address consists of __________
a) only network address
b) only host address
c) network address & host address
d) network address & MAC address
4. In virtual circuit network each packet contains ___________
a) full source and destination address
b) a short VC number
c) only source address
d) only destination address
5. Which of the following routing algorithms can be used for network layer design?
a) shortest path algorithm
b) distance vector routing
c) link state routing
d) all of the mentioned
1/27/2024 40
Dr. Shivashankar, E&CE, RRIT
Objective Questions
6. Which of the following is not correct in relation to multi-destination routing?
a) is same as broadcast routing
b) contains the list of all destinations
c) data is not sent by packets
d) there are multiple receivers
7. A subset of a network that includes all the routers but contains no loops is called ________
a) spanning tree
b) spider structure
c) spider tree
d) special tree
8. Which one of the following algorithm is not used for congestion control?
a) traffic aware routing
b) admission control
c) load shedding
d) routing information protocol
9. The network layer protocol for internet is __________
a) ethernet
b) internet protocol
c) hypertext transfer protocol
d) file transfer protocol
10. ICMP is primarily used for __________
a) error and diagnostic functions
b) addressing
c) forwarding
d) routing
1/27/2024 41
Dr. Shivashankar, E&CE, RRIT
Thanks
1/27/2024 42
Dr. Shivashankar, E&CE, RRIT

21 Scheme_ MODULE-3_CCN.pdf

  • 1.
    COMPUTER NETWORK (21EC53) Module-3 Dr. Shivashankar Professor Departmentof Electronics & Communication Engineering RRIT, Bangalore 1/27/2024 1 Dr. Shivashankar, E&CE, RRIT
  • 2.
    Course Outcomes After Completionof the course, student will be able to ▪Understand the concepts of networking thoroughly. ▪Describe the various network architectures ▪Identify the protocols and services of different layers ▪Distinguish the basic network configurations and standards associated with each network models. ▪Analyze a simple network and measurements of its parameters. Text Book: Data Communications and Networking , Forouzan, 5th Edition, McGraw Hill, 2016 ISBN: 1-25-906475-3 1/27/2024 2 Dr. Shivashankar, E&CE, RRIT
  • 3.
    Module 3 Network Layer •The Network Layer is the third layer of the TCP/IP suite. • It handles the service requests from the transport layer and further forwards the service request to the data link layer. • The network layer translates the logical addresses into physical addresses • The main functions performed by the network layer are: ➢ Routing: ➢ Logical Addressing: ➢ Internetworking: ➢ This is the main role of the network layer that it provides the logical connection between different types of networks. ➢ Fragmentation: ➢ The fragmentation is a process of breaking the packets into the smallest individual data units that travel through different networks. 1/27/2024 3 Dr. Shivashankar, E&CE, RRIT
  • 4.
    NETWORK-LAYER SERVICES 1. Packetizing •The first duty of the network layer is definitely packetizing: • The process of encapsulating the data received from upper layers of the network-payload in a network layer packet at the source and decapsulating the payload from the network layer packet at the destination is known as packetizing. • Another duty of the network layer is to carry a payload from the source to the destination without changing it or using it. • The source host receives the payload from an upper-layer protocol, adds a header that contains the source and destination addresses and some other information. 2. Routing and Forwarding • Routing: The network layer is responsible for routing the packet from its source to the destination. • There is more than one route from the source to the destination. • The network layer is responsible for finding the best one among these possible routes using some specific strategies. 1/27/2024 4 Dr. Shivashankar, E&CE, RRIT
  • 5.
    Forwarding: • Forwarding issimply defined as the action applied by each router when a packet arrives at one of its interfaces. • When a router receives a packet from one of its attached networks, it needs to forward the packet to another attached network. 1/27/2024 5 Dr. Shivashankar, E&CE, RRIT Figure 18.2 Forwarding process
  • 6.
    Cont… Other Services Error Control Flowcontrol Congestion control : Congestion may occur if the number of datagrams sent by source computers is beyond the capacity of the network or routers. In this situation, some routers may drop some of the datagrams. Quality of Service: As the Internet has allowed new applications such as multimedia communication (in particular real-time communication of audio and video), the quality of service (QoS) of the communication has become more and more important. Security : The network layer was designed with no security provision. Today, however, security is a big concern. To provide security for a connectionless network layer, we need to have another virtual level that changes the connectionless service to a connection-oriented service. This virtual layer, called IPSec. 1/27/2024 6 Dr. Shivashankar, E&CE, RRIT
  • 7.
    PACKET SWITCHING • Packetswitching is the transfer of small pieces of data across various networks. These data chunks or “packets” allow for faster, more efficient data transfer. • Each packet in connectionless packet switching includes the following information in its header section: ➢ Source address ➢ Destination address ➢ Total number of packets ➢ Sequence number (Seq#) for reassembly ▪ Once the packets reach their destination via various routes, the receiving devices rearrange them to form the original message. ▪ Advantages of Packet Switching over Circuit Switching: ➢ Efficiency ➢ Speed ➢ Digital ➢ Reliability. 1/27/2024 7 Dr. Shivashankar, E&CE, RRIT
  • 8.
    Datagram Approach: ConnectionlessService • A packet-switching technology in which a packet exists is called a datagram. • It is treated as a separate entity. • Each packet includes data about the destination, and the switch helps this data forward the packet to the right destination. It is also known as connectionless switching. • In the datagram approach, the forwarding decision is based on the destination address of the packet. • There is no dedicated transmission path. 1/27/2024 8 Dr. Shivashankar, E&CE, RRIT Figure 18.3 A connectionless packet-switched network
  • 9.
    Virtual-Circuit Approach: Connection-OrientedService • Virtual Circuit is the computer network providing connection-oriented service. It is a connection-oriented network. • In virtual circuit resource are reserve for the time interval of data transmission between two nodes. • This network is a highly reliable medium of transfer. • Virtual circuits are costly to implement.. • It ensures the transmission of all packets 1/27/2024 9 Dr. Shivashankar, E&CE, RRIT Figure 18.5 A virtual-circuit packet-switched network
  • 10.
    IPV4 Address • IPv4could be a 32-Bit IP Address. • IPv4 could be a numeric address, and its bits are separated by a dot. • The number of header fields is twelve and the length of the header field is twenty. • It has Unicast, broadcast, and multicast style of addresses. • IPv4 supports VLSM (Virtual Length Subnet Mask). • IPv4 uses the Post Address Resolution Protocol to map to the MAC address. • RIP may be a routing protocol supported by the routed daemon. • Networks ought to be designed either manually or with DHCP. • Packet fragmentation permits from routers and causing host. • Example: 172.16.50.56 1/27/2024 10 Dr. Shivashankar, E&CE, RRIT
  • 11.
    Address Space • IPv4has a certain address space. An address space is the total number of addresses used by the protocol. • If a protocol uses N bits to define an address, the address space is 2N • IPv4 uses 32-bit addresses, which means that the address space is 232 or 4,294,967,296 (more than four billion). • If there were no restrictions, more than 4 billion devices could be connected to the Internet. Notation • There are three common notations to show an IPv4 address: ➢ binary notation (base 2): 32 bit data. ➢ dotted-decimal notation (base 256): 0-255 ➢ hexadecimal notation (base 16): Each hexadecimal digit is equivalent to four bits 1/27/2024 11 Dr. Shivashankar, E&CE, RRIT Figure 18.16 Three different notations in IPv4 addressing
  • 12.
    Classful Addressing • Classfuladdressing is an IPv4 addressing architecture. • The 32 bit IP address is divided into five sub-classes. These are: ➢ Class A ➢ Class B ➢ Class C ➢ Class D ➢ Class E • IPv4 address is divided into two parts: ➢ Network ID: The class of IP address is used to determine the bits used for network ID ➢ Host ID: host ID and the number of total networks and hosts possible in that particular class. 1/27/2024 12 Dr. Shivashankar, E&CE, RRIT
  • 13.
    conti.. • In classA, the network length is 8 bits, but since the first bit, which is 0, • This means there are only 27 = 128 . • In class B, the network length is 16 bits, This means there are only 214 = 16,384. • All addresses that start with (110)2 belong to class C. network length is 24 bits, This means there are 221 = 2,097,152. • Class D is not divided into prefix and suffix. • It is used for multicast addresses. • All addresses that start with 1111 in binary belong to class E. • As in Class D, Class E is not divided into prefix and suffix and is used as 1/27/2024 13 Dr. Shivashankar, E&CE, RRIT
  • 14.
    Classless Adressing • Classlessaddressing is an IPv4 addressing architecture that uses variable- length subnet masking. • In classless addressing, variable-length blocks are used that belong to no classes. We can have a block of 1 address, 2 addresses, 4 addresses, 128 addresses, and so on. • 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 (device). • Theoretically, a block of 20, 21, 22, . . . , 232 addresses. • One of the restrictions, is that the number of addresses in a block needs to be a power of 2. 1/27/2024 14 Dr. Shivashankar, E&CE, RRIT Figure 18.19 Variable-length blocks in classless addressing
  • 15.
    Dynamic Host ConfigurationProtocol (DHCP) • DHCP is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information. • IP address assignment in an organization can be done automatically using DHCP. • DHCP is an application-layer program, using the client-server paradigm. • DHCP has found such widespread use in the Internet that it is often called a plug- and- play protocol. • DHCP can also be configured to provide temporary, on demand, IP addresses to hosts. • It also allows an ISP with 1000 granted addresses to provide services to 4000 households. 1/27/2024 15 Dr. Shivashankar, E&CE, RRIT Figure 18.25 DHCP message format
  • 16.
    Network Address Resolution(NAT) • A Network Address Translation (NAT) is the process of mapping an internet protocol (IP) address to another by changing the header of IP packets while in transit via a router. • This helps to improve security and decrease the number of IP addresses an organization needs. 1/27/2024 16 Dr. Shivashankar, E&CE, RRIT Figure 18.29: NAT Figure 18.30 Address translation
  • 17.
    Network-Layer Protocols INTERNET PROTOCOL(IP) • 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) a protocol that allows several devices to share one IP address so they can all receive the same data. • The Address Resolution Protocol (ARP) is used to glue the network and data- link layers in mapping network-layer addresses to link-layer addresses. 1/27/2024 17 Dr. Shivashankar, E&CE, RRIT Figure 19.1 Position of IP and other network-layer protocols in TCP/IP protocol suite
  • 18.
    Datagram Format • Packetsused by the IP are called data- grams. • A datagram is a variable-length packet consisting of two parts: header and payload (data). • The header is 20 to 60 bytes in length and contains information essential to routing and delivery. • It is customary in TCP/IP to show the header in 4-byte sections. 1/27/2024 18 Dr. Shivashankar, E&CE, RRIT Figure 19.2 IP datagram
  • 19.
    Fragmentation • It istechnique in which gateways break up or divide larger packets into smaller ones called fragments. • Each fragment is then sent as a separate internal packet. • Each fragment has its separate header and trailer. • The first fragment has an offset field value of zero. • Divide the length of the first fragment by 8. The second fragment has an offset value equal to that result. • Divide the total length of the first and second fragment by 8. • The third fragment has an offset value equal to that result. • Continue the process. The last fragment has its M bit set to 0. • Continue the process. The last fragment has a more bit value of 0. 1/27/2024 19 Dr. Shivashankar, E&CE, RRIT Figure 19.6 Fragmentation example
  • 20.
    Options • Options canbe used for network testing and debugging. • Option processing is required of the IPv4 software. • This means that all implementations must be able to handle options if they are present in the header. • Options are divided into two broad categories: 1. Single-Byte Options: • No Operation: A no-operation option is a 1-byte option used as a filler between options. • End of Option: An end-of-option option is a 1-byte option used for padding at the end of the option field. 2. Multliple-Byte Options: • Record Route: A record route option is used to record the Internet routers that handle the datagram. • Strict Source Route: A strict source route option is used by the source to predetermine a route for the data- gram as it travels through the Internet. 1/27/2024 20 Dr. Shivashankar, E&CE, RRIT
  • 21.
    Security of IPv4Datagrams • The IP security architecture (IPsec) provides cryptographic protection for IP datagrams in IPv4 and IPv6 network packets. • This protection can include confidentiality, strong integrity of the data, data authentication, and partial sequence integrity. • No security was provided for the IPv4 protocol. • The Internet is not secure anymore. • There are three security issues, applicable to the IP protocol: ➢ packet sniffing, ➢ packet modification, ➢ and IP spoofing. 1/27/2024 21 Dr. Shivashankar, E&CE, RRIT
  • 22.
    Packet Sniffing • Anintruder may intercept an IP packet and make a copy of it. • Packet sniffing is a passive attack, in which the attacker does not change the contents of the packet. • This type of attack is very difficult to detect because the sender and the receiver may never know that the packet has been copied. Although packet sniffing cannot be stopped, encryption of the packet can make the attacker’s effort useless. • The attacker may still sniff the packet, but the content is not detectable. • Ex: Pass word Sniffing • TCP Session Hijacking • DNS Poisoning • DHCP attacking • ARP sniffing 1/27/2024 22 Dr. Shivashankar, E&CE, RRIT
  • 23.
    Packet Modification • Thesecond type of attack is to modify the packet. • The attacker intercepts the packet, changes its contents, and sends the new packet to the receiver. • The receiver believes that the packet is coming from the original sender. • This type of attack can be detected using a data integrity mechanism. • The receiver, before opening and using the contents of the message, can use this mechanism to make sure that the packet has not been changed during the transmission. ➢ Examples of Modification attacks include: ➢ Modifying the contents of messages in the network. ➢ Changing information stored in data files. ➢ Altering programs so they perform differently. ➢ Reconfiguring system hardware or network topologies. 1/27/2024 23 Dr. Shivashankar, E&CE, RRIT
  • 24.
    IP Spoofing • Anattacker can masquerade as somebody else and create an IP packet that carries the source address of another computer. • An attacker can send an IP packet to a bank pretending that it is coming from one of the customers. • This type of attack can be prevented using an origin authentication mechanism. • Types of IP spoofing ➢ Distributed Denial of Service (DDoS) attacks: This allows them to slow down or crash a website or network with large volumes of internet traffic . ➢ Masking botnet devices: A botnet is a network of computers that hacker’s control from a single source. ➢ Man-in-the-middle attacks: Another malicious IP spoofing method uses a ‘man-in-the-middle’ attack to interrupt communication between two computers, alter the packets, and transmit them without the original sender or receiver knowing. 1/27/2024 24 Dr. Shivashankar, E&CE, RRIT
  • 25.
    IPV6 Addressing andProtocols • An IPv6 address is a 128-bit alphanumeric value that identifies an endpoint device in an Internet Protocol Version 6 (IPv6) network. • IPv6 is the successor to a previous addressing infrastructure, IPv4, which had limitations IPv6 was designed to overcome. • Each group is expressed as four hexadecimal digits and the groups are separated by colons. • An example: • FE80:CD00:0000:0CDE:1257:0000:211E:729C • An IPv6 address is split into two parts: • a network and a node component. • The network component is the first 64 bits of the address and is used for routing. • The node component is the later 64 bits and is used to identify the address of the interface. • It is derived from the physical, or MAC address, using the 64-bit extended unique identifier (EUI-64) format defined by the Institute of Electrical and Electronics Engineers (IEEE). 1/27/2024 Dr. Shivashankar, E&CE, RRIT 25
  • 26.
    IPV6 Addressing andProtocols • IPv6 address space • Global unicast: These addresses are routable on the internet and start with "2001:" as the prefix group. Global unicast addresses are the equivalent of IPv4 public addresses. • Unicast address: Used to identify the interface of an individual node. • Anycast address. Used to identify a group of interfaces on different nodes. • Multicast address. An address used to define Multicast Multicasts are used to send a single packet to multiple destinations at one time. • Link local addresses. One of the two internal address types that are not routed on the internet. Link local addresses are used inside an internal network, are self-assigned and start with "fe80:" as the prefix group. • Unique local addresses. This is the other type of internal address that is not routed on the internet. Unique local addresses are equivalent to the IPv4 addresses 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. 1/27/2024 Dr. Shivashankar, E&CE, RRIT 26
  • 27.
    IPV6: Autoconfiguration • Oneof the interesting features of IPv6 addressing is the autoconfiguration of hosts. • In IPv4, the host and routers are originally configured manually by the network manager. • However, the Dynamic Host Configuration Protocol, DHCP, can be used to allocate an IPv4 address to a host that joins the network. • In IPv6, DHCP protocol can still be used to allocate an IPv6 address to a host, but a host can also configure itself. • it can configure itself using the following process: 1. The host first creates a link local address for itself. The result is a 128-bit link local address. 2. The host then tests to see if this link local address is unique and not used by other hosts. Since the 64-bit interface identifier is supposed to be unique, the link local address generated is unique with a high probability. 3. If the uniqueness of the link local address is passed, the host stores this address as its link local address (for private communication), but it still needs a global unicast address. 1/27/2024 Dr. Shivashankar, E&CE, RRIT 27
  • 28.
    THE IPv6 PROTOCOL •The change of the IPv6 address size requires the change in the IPv4 packet format. • The designer of IPv6 decided to implement remedies for other shortcomings now that a change is inevitable. • The following shows other changes implemented in the protocol in addition to changing address size and format. ❑ Better header format: IPv6 uses a new header format in which options are separated from the base header and inserted, when needed, between the base header and the data. ❑ New options: IPv6 has new options to allow for additional functionalities. ❑ Allowance for extension: IPv6 is designed to allow the extension of the protocol if required by new technologies or applications. ❑ Support for resource allocation: This mechanism can be used to support traffic such as real-time audio and video. ❑ Support for more security: The encryption and authentication options in IPv6 provide confidentiality and integrity of the packet. 1/27/2024 Dr. Shivashankar, E&CE, RRIT 28
  • 29.
    Packet Format • Eachpacket is composed of a base header followed by the payload. • The base header occupies 40 bytes, whereas payload can be up to 65,535 bytes of information. • Fig: IPV6 packet format • 1/27/2024 Dr. Shivashankar, E&CE, RRIT 29 Fig: Base Header
  • 30.
    Conti.. • Version: The4-bit version field defines the version number of the IP. For IPv6, the value is 6. • Traffic class: The 8-bit traffic class field is used to distinguish different payloads with different delivery requirements. It replaces the type-of-service field in IPv4. • Flow label: The flow label is a 20-bit field that is designed to provide special handling for a particular flow of data. • Payload length: The 2-byte payload length field defines the length of the IP datagram excluding the header. Note that IPv4 defines two fields related to the length: header length and total length. In IPv6, the length of the base header is fixed (40 bytes). • Next header: The next header is an 8-bit field defining the type of the first extension header or the type of the data that follows the base header in the datagram. • Hop limit: The 8-bit hop limit field serves the same purpose as the TTL field in IPv4. • Source and destination addresses. The source address field is a 16-byte (128-bit) Internet address that identifies the original source of the datagram. • Payload: Compared to IPv4, the payload field in IPv6 has a different format and meaning 1/27/2024 Dr. Shivashankar, E&CE, RRIT 30
  • 31.
    Extension Header • AnIPv6 packet is made of a base header and some extension headers. The length of the base header is fixed at 40 bytes. • Six types of extension headers have been defined. ➢ hop-by-hop option ➢ source routing ➢ Fragmentation ➢ authentication ➢ encrypted security payload and ➢ destination option. 1/27/2024 Dr. Shivashankar, E&CE, RRIT 31 Figure 22.8 Extension header types
  • 32.
    Unicast Routing • Unicastmeans the transmission from a single sender to a single receiver. • One to one delivery. • One to many called multicasting. Least-Cost Routing • When an internet is modeled as a weighted graph, one of the ways to interpret the best route from the source router to the destination router is to find the least cost between the two. • The source router chooses a route to the destination router in such a way that the total cost for the route is the least cost among all possible routes. 1/27/2024 32 Dr. Shivashankar, E&CE, RRIT Figure 20.1 An internet and its graphical representation
  • 33.
    ROUTING ALGORITHMS Distance-Vector RoutingProtocol • It calculates the distance and direction of the vector of the next hop from the information obtained by the neighboring router. • Distance Vector routing protocols base their decisions on the best path to a given destination based on the distance. • Distance is usually measured in hops, though the distance metric could be delay, packets lost, or something similar. • It is necessary to keep track of the topology and inform neighboring devices if any changes occur in the topology. • Distance vector protocols send their entire routing table to directly connected neighbors. • Examples of distance vector protocols include RIP - Routing Information Protocol and IGRP - Interior Gateway Routing Protocol. 1/27/2024 33 Dr. Shivashankar, E&CE, RRIT
  • 34.
    Cont.. Bellman-Ford Equation Bellman-Ford isa single source shortest path algorithm that determines the shortest path between a given source vertex and every other vertex in a graph. This algorithm can be used on both weighted and unweighted graphs. Let dx(y) be the cost of the least-cost path from node x to node y. The least costs are related by Bellman-Ford equation. Where the minv is the equation taken for all x neighbors. After traveling from x to v, if we consider the least-cost path from v to y, the path cost will be c(x,v)+dv(y). The least cost from x to y is the minimum of c(x,v)+dv(y) taken over all neighbors. 1/27/2024 34 Dr. Shivashankar, E&CE, RRIT dx(y) = minv{c(x,v) + dv(y)} (3.1)
  • 35.
  • 36.
    Link-State Routing • Linkstate routing is a method in which each router shares its neighbourhood’s knowledge with every other router in the internetwork. • In this algorithm, each router in the network understands the network topology then makes a routing table depend on this topology. • Each router will share data about its connection to its neighbour, who will, consecutively, reproduce the data to its neighbours, etc. • This appears just before all routers have constructed a topology of the network. • This method uses the term link-state to define the characteristic of a link (an edge) that represents a network in the internet. • In this algorithm the cost associated with an edge defines the state of the link. Links with lower costs are preferred to links with higher costs; if the cost of a link is infinity, it means that the link does not exist or has been broken. 1/27/2024 36 Dr. Shivashankar, E&CE, RRIT
  • 37.
    Figure 20.9 LSPscreated and sent out by each node to build LSDB 1/27/2024 37 Dr. Shivashankar, E&CE, RRIT
  • 38.
    Path-Vector Routing • Bothlink-state and distance-vector routing are based on the least-cost goal. • However, there are instances where this goal is not the priority. • A path-vector routing protocol is a network routing protocol which maintains the path information that gets updated dynamically. • Updates that have looped through the network and returned to the same node are easily detected and discarded. • A routing policy is a set of rules that determines how routes are selected, advertised, or filtered based on various criteria, such as performance, security, or business agreements. • It has three phases: ➢ Initiation ➢ Sharing ➢ Updating 1/27/2024 38 Dr. Shivashankar, E&CE, RRIT
  • 39.
    Path-Vector Routing 1/27/2024 39 Dr.Shivashankar, E&CE, RRIT Figure 20.11 Spanning trees in path-vector routing Figure 20.13 Updating path vectors
  • 40.
    Objective Questions 1. Thenetwork layer is concerned with __________ of data. a) bits b) frames c) packets d) bytes 2. Which one of the following is not a function of network layer? a) routing b) inter-networking c) congestion control d) error control 3. A 4 byte IP address consists of __________ a) only network address b) only host address c) network address & host address d) network address & MAC address 4. In virtual circuit network each packet contains ___________ a) full source and destination address b) a short VC number c) only source address d) only destination address 5. Which of the following routing algorithms can be used for network layer design? a) shortest path algorithm b) distance vector routing c) link state routing d) all of the mentioned 1/27/2024 40 Dr. Shivashankar, E&CE, RRIT
  • 41.
    Objective Questions 6. Whichof the following is not correct in relation to multi-destination routing? a) is same as broadcast routing b) contains the list of all destinations c) data is not sent by packets d) there are multiple receivers 7. A subset of a network that includes all the routers but contains no loops is called ________ a) spanning tree b) spider structure c) spider tree d) special tree 8. Which one of the following algorithm is not used for congestion control? a) traffic aware routing b) admission control c) load shedding d) routing information protocol 9. The network layer protocol for internet is __________ a) ethernet b) internet protocol c) hypertext transfer protocol d) file transfer protocol 10. ICMP is primarily used for __________ a) error and diagnostic functions b) addressing c) forwarding d) routing 1/27/2024 41 Dr. Shivashankar, E&CE, RRIT
  • 42.