0% found this document useful (0 votes)
5 views88 pages

Unit 3 DCN

The document covers the Network Layer in data communication and networking, detailing concepts such as logical addressing, routing protocols, and the differences between connectionless and connection-oriented services. It discusses IPv4 addressing, including address classes, subnetting, and Network Address Translation (NAT) types and their advantages and disadvantages. Additionally, it explains the Dynamic Host Configuration Protocol (DHCP) and the forwarding of IP packets, highlighting various routing techniques and methods for efficient packet delivery.

Uploaded by

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

Unit 3 DCN

The document covers the Network Layer in data communication and networking, detailing concepts such as logical addressing, routing protocols, and the differences between connectionless and connection-oriented services. It discusses IPv4 addressing, including address classes, subnetting, and Network Address Translation (NAT) types and their advantages and disadvantages. Additionally, it explains the Dynamic Host Configuration Protocol (DHCP) and the forwarding of IP packets, highlighting various routing techniques and methods for efficient packet delivery.

Uploaded by

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

Data Communication &

Networking
Unit – III
Prof. Rupali A. Meshram
Network Layer
Network Layer

N1 N2

R1 R2
Network Layer
• Host to Host/Source to Destination/Machine
to Machine
• Logical Addressing(IP Address)
• Router (RIP,OSPF)
• Fragmentation
• Congestion Control
Network Layer
• Network layer must know about the topology of the
network (i.e., the set of all routers and links) and choose
appropriate paths through it, even for large networks.

• It must also take care when choosing routes to avoid


overloading some of the communication lines and
routers while leaving others idle.

• Finally, when the source and destination are in different


networks, new problems occur.
STORE-AND-FORWARD PACKET
SWITCHING
Services Provided To The Transport Layer

• The services should be independent of the router


technology.

• The transport layer should be shielded from the


number, type, and topology of the routers present.

• The network addresses made available to the


transport layer should use a uniform numbering
plan, even across LANs and WANs.
Implementation Of Connectionless Service

• If connectionless service is offered, packets are


injected into the network individually and
routed independently of each other.

• No advance setup is needed.

• The packets are frequently called datagrams


and the network is called a datagram network.
Routing Within A Datagram Network
Implementation Of Connection-oriented
Service
• If connection-oriented service is used, a path
from the source router all the way to the
destination router must be established before
any data packets can be sent.

• This connection is called a VC (virtual circuit),


in analogy with the physical circuits set up by
the telephone system, and the network is
called a virtual-circuit network.
Routing Within A Virtual-circuit Network
Comparison Of Virtual-circuit And
Datagram Networks
IPv4 Addresses
• An IPv4 address is a 32-bit address that
uniquely and universally defines the
connection of a device (for example, a
computer or a router) to the Internet.
IPv4 Addresses
• An IPv4 address is 32 bits long.

• The IPv4 addresses are unique and universal.

• The address space of IPv4 is 232 or


4,294,967,296
Dotted-decimal notation and binary
notation for an IPv4 address
Example
• Change the following IPv4 addresses from
binary notation to dotted-decimal notation.
Solution
• We replace each group of 8 bits with its
equivalent decimal number and add dots for
separation.
Example
• Find the error, if any, in the following IPv4
addresses.
Solution
• There must be no leading zero (045).
• There can be no more than four numbers.
• Each number needs to be less than or equal to
255.
• A mixture of binary notation and dotted-
decimal notation is not allowed.
Finding the classes in binary and dotted-
decimal notation
• In classful addressing, the address space is
divided into five classes: A, B, C, D, and E.
Example
• Find the class of each address.
a. 00000001 00001011 00001011 11101111
b. 11000001 10000011 00011011 11111111
c. 14.23.120.8
d. 252.5.15.111
Solution
a. The first bit is 0. This is a class A address.
b. The first 2 bits are 1; the third bit is 0. This is
a class C address.
c. The first byte is 14; the class is A.
d. The first byte is 252; the class is E.
Default masks for classful addressing
• In IPv4 addressing, a block of
addresses can be defined as x.y.z.t /n in which
x.y.z.t defines one of the addresses and the /n
defines the mask.
Default masks for classful addressing
Classless Addressing
• In IPv4 addressing, a block of
addresses can be defined as x.y.z.t /n in which
x.y.z.t defines one of the addresses and the /n
defines the mask.
Classless Addressing

32 bit

Block ID Host ID
First Address

• The first address in the block can be found by


setting the rightmost 32 − n bits to 0s.
Example
• A block of addresses is granted to a small organization. We
know that one of the addresses is 205.16.37.39/28. What is
the first address in the block?

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

• The last address in the block can be found by


setting the rightmost 32 − n bits to 1s.
Example
• Find the last address for the block in previous Example

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

• The number of addresses in the block can be


found by using the formula 232−n
Example
• Find the number of addresses for given IPv4
address 205.16.37.39/28

Solution
• The value of n is 28, which means that number
of addresses is 2 32−28 or 16.
Example
• Another way to find the first address, the last address, and the
number of addresses is to represent the mask as a 32-bit binary
(or 8-digit hexadecimal) number. This is particularly useful when
we are writing a program to find these pieces of information. In
Example 19.5 the /28 can be represented as
• 11111111 11111111 11111111 11110000
• (twenty-eight 1s and four 0s).

Find
a. The first address
b. The last address
c. The number of addresses.
Solution
• The first address can be found by ANDing the
given addresses with the mask. ANDing here is
done bit by bit. The result of ANDing 2 bits is 1
if both bits are 1s; the result is 0 otherwise.
Solution
• The last address can be found by ORing the
given addresses with the complement of the
mask. Oring here is done bit by bit. The result of
ORing 2 bits is 0 if both bits are 0s; the result is
1 otherwise. The complement of a number is
found by changing each 1 to 0 and each 0 to 1.
Solution
• The number of addresses can be found by
complementing the mask, interpreting it as a
decimal number, and adding 1 to it.
Solution
• A network configuration for the block
205.16.37.32/28
Important
• The first address in a block is
normally not assigned to any device;
it is used as the network address that
represents the organization
to the rest of the world.
Network Address Translation (NAT)
• To access the Internet, one public IP address is needed, but we can
use a private IP address in our private network.

• The idea of NAT is to allow multiple devices to access the Internet


through a single public address.

• To achieve this, the translation of private IP address to a public IP


address is required.

• Network Address Translation (NAT) is a process in which one or more


local IP address is translated into one or more Global IP address and
vice versa in order to provide Internet access to the local hosts.
Network Address Translation (NAT)
• It does the translation of port numbers i.e.
masks the port number of the host with
another port number, in the packet that will be
routed to the destination.

• It then makes the corresponding entries of IP


address and port number in the NAT table.

• NAT generally operates on router or firewall.


Network Address Translation (NAT)
working
• Generally, the border router is configured for NAT i.e the router which
has one interface in local (inside) network and one interface in the
global (outside) network.

• When a packet traverse outside the local (inside) network, then NAT
converts that local (private) IP address to a global (public) IP address.

• When a packet enters the local network, the global (public) IP address is
converted to a local (private) IP address.

• If NAT run out of addresses, i.e., no address is left in the pool configured
then the packets will be dropped and an Internet Control Message
Protocol (ICMP) host unreachable packet to the destination is sent.
Network Address Translation
Network Address Translation
Network Address Translation
Network Address Translation (NAT) Types

• Static NAT – In this, a single unregistered


(Private) IP address is mapped with a legally
registered (Public) IP address i.e one-to-one
mapping between local and global address.

• This is generally used for Web hosting.


Network Address Translation (NAT) Types

• Dynamic NAT – In this type of NAT, an


unregistered IP address is translated into a
registered (Public) IP address from a pool of
public IP address.

• If the IP address of pool is not free, then the


packet will be dropped as an only a fixed
number of private IP address can be translated
to public addresses.
Network Address Translation (NAT) Types
• Port Address Translation (PAT) – This is also known as NAT
overload.

• In this, many local (private) IP addresses can be translated to a


single registered IP address.

• Port numbers are used to distinguish the traffic i.e., which traffic
belongs to which IP address.

• This is most frequently used as it is cost-effective as thousands of


users can be connected to the Internet by using only one real
global (public) IP address.
Advantages of NAT
• NAT conserves legally registered IP addresses .

• It provides privacy as the device IP address,


sending and receiving the traffic, will be
hidden.

• Eliminates address renumbering when a


network evolves.
Disadvantage of NAT
• Translation results in switching path delays.

• Certain applications will not function while NAT is


enabled.

• Complicates tunneling protocols such as IPsec.

• Also, router being a network layer device, should not


tamper with port numbers(transport layer) but it has
to do so because of NAT.
Dynamic Host Configuration Protocol
(DHCP)
• Dynamic Host Configuration Protocol (DHCP)
is a client/server protocol that automatically
provides an Internet Protocol (IP) host with its
IP address and other related configuration
information such as the subnet mask and
default gateway.
DHCP
• TCP/IP-based network must have a unique unicast
IP address to access the network and its resources.

• Without DHCP, IP addresses for new computers or


computers that are moved from one subnet to
another must be configured manually;

• IP addresses for computers that are removed from


the network must be manually reclaimed.
DHCP
• With DHCP, this entire process is automated and managed
centrally.

• The DHCP server maintains a pool of IP addresses and


leases an address to any DHCP-enabled client when it
starts up on the network.

• Because the IP addresses are dynamic (leased) rather than


static (permanently assigned), addresses no longer in use
are automatically returned to the pool for reallocation.
DHCP Message Format
DHCP Message Format
• Operation Code: Specifies the type of the
Dynamic Host Configuration Protocol (DHCP)
message. Set to 1 in messages sent by a client
(requests) and 2 in messages sent by a server
(response).

• Hardware Type: Specifies the network LAN


architecture. For example, the ethernet type is
specified when htype is set to 1.
DHCP Message Format
• Hardware Address Length: Layer 2 (Data-link
layer) address length (MAC address) (in bytes);
defines the length of hardware address in the
chaddr field. For Ethernet (Most widely used
LAN Standard), this value is 6.

• Hops: Number of relay agents that have


forwarded this message.
DHCP Message Format
• Transaction identifier: Used by clients to
match responses from servers with previously
transmitted requests.

• Seconds: Elapsed time (in seconds) since the


client began the Dynamic Host Configuration
Protocol (DHCP) process.
DHCP Message Format
• Flags: Flags field is called the broadcast bit, can be
set to 1 to indicate that messages to the client
must be broadcast.

• Ciaddr: Client's IP address; set by the client when


the client has confirmed that its IP address is valid.

• Yiaddr: Client's IP address; set by the server to


inform the client of the client's IP address.
DHCP Message Format
• Siaddr: IP address of the next server for the client
to use in the configuration process (for example,
the server to contact for TFTP download of an
operating system kernel).

• Giaddr: Relay agent (gateway) IP address; filled in


by the relay agent with the address of the interface
through which Dynamic Host Configuration
Protocol (DHCP) message was received.
DHCP Message Format
• Chaddr: Client's hardware address (Layer 2
address).

• Sname: Name of the next server for client to use


in the configuration process.

• File: Name of the file for the client to request from


the next server (for example the name of the file
that contains the operating system for this client).
Forwarding of IP Packets
• Forwarding means to place the packet in its
route to its destination Since the Internet today
is made of a combination of links, forwarding
means to deliver the packet to the next hop

• Although IP protocol was originally designed as


a connectionless protocol, today the tendency
is to use IP as a connection-oriented protocol
based on the label attached to an IP datagram
Forwarding of IP Packets
• Forwarding based on destination address
Next-hop Network
Specific Method
Host-Specific Method
Default Method

• Forwarding Based on Label


Next-hop routing
• One technique to reduce the contents of a
routing table

• The routing table holds only the address of the


next hop instead of information about the
complete route
Next-hop routing
Network-specific routing
• Reduce the routing table and simplify the
searching process

• The routing table has only one entry that


defines the address of the destination
network itself
Network-specific routing
Host-specific Routing
• The Destination host address is given in the
routing table

• Inverse of network-specific method

• When administrator wants to have more


control
Host-specific Routing
Default Method
• Instead of listing all networks in the entire Internet
host can just have one entry called the default
Simplified Forwarding Module in Classful
Address without Subnetting
Simplified Forwarding Module in Classful
Address with Subnetting
Address Aggregation
Address Aggregation
Longest Mask Matching
Forwarding of IP packets
• Forwarding means to place the packet in its route to its
destination.

• When IP used as a connectionless protocol, the


forwarding is based on the destination address of the IP
datagram.

• When the IP is used as a connection oriented protocol,


the forwarding is based on the label attached to an IP
datagram.
Forwarding Based on Destination Address:

Fig: Simplified forwarding module in classless addressing


• Instead of giving the address-mask combination of
180.70.65.192/26, we can give the value of the 26
leftmost bits-

10110100 01000110 01000001 11


Example: Make a forwarding table for router R1 using the configuration in
figure:

Network Next hop Interface


– Solution table Address/ Mask
shows the 180.70.65.192/26 - m2

corresponding 180.70.65.128/25 - m0
forwarding 201.4.22.0/24 - m3
table for 201.4.16.0/22 - m1
router R1 Default 180.70.65.200 m2
Network Next hop Interface
• Eg. Address/ Mask
180.70.65.192/26 - m2

180.70.65.128/25 - m0

201.4.22.0/24 - m3
201.4.16.0/22 - m1
Default 180.70.65.200 m2

Leftmost bits in the destination address Next hop Interface

10110100 01000110 01000001 11 - m2

10110100 01000110 01000001 1 - m0

11001001 00000100 00011100 - m3


11001001 00000100 000100 - m1
Default 180.70.65.200 m2
Forwarding table for router R1 using prefix bits.
Example: Show the forwarding process
if the packet arrives at R1 with the
destination address 180. 70.65.140.

• Solution:- The router perform the


following steps-

• The first mask (/26) is applied to the


destination address. The result is
180.70.65.128 which does not match
the corresponding network address.

• The second mask(/25) is applied to


the destination address. The result is
180.70.65.128 which match the
corresponding network address. The
next-hop address and the interface
number m0 are extracted for
forwarding the packet
Forwarding Based on Label:
• In the 1980s, an effort started to somehow changes IP to
behave like a connection oriented protocol in which
routing is replaced by switching.
• In a connectionless network (datagram approach), a
router forwards packet based on the destination address
in the header of the packet.
• In the connection oriented network (virtual circuit
approach), a switch forwards packet based on the label
attached to the packet.
• Routing is normally based on searching the content of
the table.
• Switching can be done by accessing the table using an
index.
• Example: Fig. shows a simple searching in a forwarding
table using the longest mask algorithm.
• Example: Figure shows a simple example of using a label
to access switching table. Since the lable are used as
index to the table ,finding the information in the table is
immediate.
• Multi-Protocol Label Switching (MPLS):

• IETF approved standard that is called multi-protocol label


switching.

• In this standard some, conventional routers in the


internet can be replaced by MPLS routers which can be
behave like a router and a switch.

• When behaving like a router the MPLS can forward the


packet based on the destination address.

• When behaving like is switch it can forward a packet


based on the label.
A New Header:
• To simulate the connection oriented switching using a
protocol like IP the first thing is that is needed is to add a
field to the packet that carries the label.
• The ipv4 packet format does not allow this extension.
• The solution is to encapsulate theIPv4 packet in an MPLS
packet.
• The whole IP packet is encapsulated as the payload in an
MPLS packet and an MPLS header is added.
• The MPLS header is actually the stack of subheaders that
is used for the multilevel hierarchical switching. the
figure shows the format of an MPLS header in which
each subheader is 32 bits(4 bytes) long.
• Hierarchical switching:
• A stack of labels in MPLS hierarchical switching.

• This is similar to the conventional hierarchical routing.

• For example of packet with two labels can be used the


top label to forward the packets through the switches
outside an organization; the bottom label can be used to
route the packet inside the organization to reach the
destination subnet.
Router as Packet Switches

• The packet switches that are used in a network layer are


called routers.

• Routers can be configured to act as a either a datagram


switch or the virtual circuit switch.
THANK YOU

You might also like