0% found this document useful (0 votes)
11 views12 pages

module3_part2

The document provides an overview of Network Address Translation (NAT) and its types, including Static NAT, Dynamic NAT, and Port Address Translation (PAT), highlighting their functions and advantages. It also discusses IPv4 and IPv6 protocols, their header formats, and routing concepts, including static, default, and dynamic routing, along with various routing algorithms. Additionally, it covers unicast, multicast, and broadcast routing, detailing their mechanisms and protocols.

Uploaded by

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

module3_part2

The document provides an overview of Network Address Translation (NAT) and its types, including Static NAT, Dynamic NAT, and Port Address Translation (PAT), highlighting their functions and advantages. It also discusses IPv4 and IPv6 protocols, their header formats, and routing concepts, including static, default, and dynamic routing, along with various routing algorithms. Additionally, it covers unicast, multicast, and broadcast routing, detailing their mechanisms and protocols.

Uploaded by

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

Computer Networks Notes (3rd Module)

Network Address Translation


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. Also, 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) Types –
There are 3 ways to configure NAT:

1. 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. These are not used
in organisations as there are many devices who will need Internet access and
to provide Internet access, the public IP address is needed.

Suppose, if there are 3000 devices who need access to the Internet, the
organisation has to buy 3000 public addresses that will be very costly.

2. 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.

Suppose, if there is a pool of 2 public IP addresses then only 2 private IP


addresses can be translated at a given time. If 3rd private IP address wants to
access Internet, then the packet will be dropped therefore many private IP
addresses are mapped to a pool of public IP addresses. NAT is used when the
number of users who wants to access the Internet is fixed. This is also very
costly as the organisation have to buy many global IP addresses to make a
pool.

3. 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 tunnelling 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.

IPv4:
IPv4 is a connectionless protocol used for packet-switched networks. It operates on
a best effort delivery model, in which neither delivery is guaranteed, nor proper sequencing
or avoidance of duplicate delivery is assured. Internet Protocol Version 4 (IPv4) is the
fourth revision of the Internet Protocol and a widely used protocol in data communication
over different kinds of networks. IPv4 is a connectionless protocol used in packet-switched
layer networks, such as Ethernet. It provides a logical connection between network
devices by providing identification for each device. There are many ways to configure IPv4
with all kinds of devices – including manual and automatic configurations – depending on
the network type.
IPv4 uses 32-bit (4 byte) addressing, which gives 232 addresses. IPv4 addresses
are written in the dot-decimal notation, which comprises of four octets of the address
expressed individually in decimal and separated by periods, for instance, 192.168.1.5.

IPv4 Datagram Header


Size of the header is 20 to 60 bytes.

VERSION: Version of the IP protocol (4 bits), which is 4 for IPv4

HLEN: IP header length (4 bits), which is the number of 32-bit words in the header. The
minimum value for this field is 5 and the maximum is 15.

Type of service: Low Delay, High Throughput, Reliability (8 bits)

Total Length: Length of header + Data (16 bits), which has a minimum value 20 bytes and
the maximum is 65,535 bytes.

Identification: Unique Packet Id for identifying the group of fragments of a single IP


datagram (16 bits)
Flags: 3 flags of 1 bit each: reserved bit (must be zero), do not fragment flag, more
fragments flag (same order)

Fragment Offset: Represents the number of Data Bytes ahead of the particular fragment
in the particular Datagram. Specified in terms of number of 8 bytes, which has the
maximum value of 65,528 bytes.

Time to live: Datagram’s lifetime (8 bits), It prevents the datagram to loop through the
network by restricting the number of Hops taken by a Packet before delivering to the
Destination.

Protocol: Name of the protocol to which the data is to be passed (8 bits)

Header Checksum: 16 bits header checksum for checking errors in the datagram header

Source IP address: 32 bits IP address of the sender

Destination IP address: 32 bits IP address of the receiver

Option: Optional information such as source route, record route. Used by the Network
administrator to check whether a path is working or not.

Internet Protocol version 6 (IPv6)


IP v6 is 128-bits address having an address space of 2^128, which is way bigger
than IPv4. In IPv6 we use Colon-Hexa representation. There are 8 groups and each group
represents 2 Bytes.
In IPv6 representation, we have three addressing methods:
 Unicast
 Multicast
 Anycast

Unicast Address: Unicast Address identifies a single network interface. A packet sent to
unicast address is delivered to the interface identified by that address.

Multicast Address: Multicast Address is used by multiple hosts, called as Group, acquires a
multicast destination address. These hosts need not be geographically together. If any
packet is sent to this multicast address, it will be distributed to all interfaces corresponding to
that multicast address.

Anycast Address: Anycast Address is assigned to a group of interfaces. Any packet sent to
anycast address will be delivered to only one member interface (mostly nearest host
possible).

Note: Broadcast is not defined in IPv6.


IP version 6 Header Format:

Version (4-bits): Indicates version of Internet Protocol which contains bit sequence 0110.

Traffic Class (8-bits): The Traffic Class field indicates class or priority of IPv6 packet
which is similar to Service Field in IPv4 packet. It helps routers to handle the traffic based
on priority of the packet. If congestion occurs on router, then packets with least priority will
be discarded.
As of now only 4-bits are being used (and remaining bits are under research), in which 0 to
7 are assigned to Congestion controlled traffic and 8 to 15 are assigned to Uncontrolled
traffic.

Flow Label (20-bits): Flow Label field is used by source to label the packets belonging to
the same flow in order to request special handling by intermediate IPv6 routers, such as
non-default quality of service or real time service. Routers or Host that do not support the
functionality of flow label field and for default router handling, flow label field is set to 0.
While setting up the flow label, source is also supposed to specify the lifetime of flow.
Payload Length (16-bits): It is a 16-bit (unsigned integer) field, indicates total size of the
payload which tells routers about amount of information a particular packet contains in its
payload.
Next Header (8-bits): Next Header indicates type of extension header (if present)
immediately following the IPv6 header. Whereas In some cases it indicates the protocols
contained within upper-layer packet, such as TCP, UDP.
Hop Limit (8-bits): Hop Limit field is same as TTL in IPv4 packets. It indicates the
maximum number of intermediate nodes IPv6 packet is allowed to travel. Its value gets
decremented by one, by each node that forwards the packet and packet is discarded if
value decrements to 0. This is used to discard the packets that are stuck in infinite loop
because of some routing error.

Source Address (128-bits): Source Address is 128-bit IPv6 address of the original source
of the packet.

Destination Address (128-bits): Destination Address field indicates the IPv6 address of
the final destination (in most cases). All the intermediate nodes can use this information in
order to correctly route the packet.
Extension Headers: In order to rectify the limitations of IPv4 Option Field, Extension
Headers are introduced in IPversion 6. The extension header mechanism is very important
part of the IPv6 architecture. Next Header field of IPv6 fixed header points to the first
Extension Header and this first extension header points to the second extension header
and so on.

Routing

o A Router is a process of selecting path along which the data can be transferred from
source to the destination. Routing is performed by a special device known as a
router.
o A Router works at the network layer in the OSI model and internet layer in TCP/IP
model
o A router is a networking device that forwards the packet based on the information
available in the packet header and forwarding table.
o The routing algorithms are used for routing the packets. The routing algorithm is
nothing but a software responsible for deciding the optimal path through which
packet can be transmitted.
o The routing protocols use the metric to determine the best path for the packet
delivery. The metric is the standard of measurement such as hop count, bandwidth,
delay, current load on the path, etc. used by the routing algorithm to determine the
optimal path to the destination.
o The routing algorithm initializes and maintains the routing table for the process of
path determination.

Types of Routing

Routing can be classified into three categories:

o Static Routing
o Default Routing
o Dynamic Routing

Static Routing
o Static Routing is also known as Nonadaptive Routing.
o It is a technique in which the administrator manually adds the routes in a routing
table.
o A Router can send the packets for the destination along the route defined by the
administrator.
o In this technique, routing decisions are not made based on the condition or topology
of the networks

Default Routing
o Default Routing is a technique in which a router is configured to send all the packets
to the same hop device, and it doesn't matter whether it belongs to a particular
network or not. A Packet is transmitted to the device for which it is configured in
default routing.
o Default Routing is used when networks deal with the single exit point.
o It is also useful when the bulk of transmission networks have to transmit the data to
the same hp device.
o When a specific route is mentioned in the routing table, the router will choose the
specific route rather than the default route. The default route is chosen only when a
specific route is not mentioned in the routing table.

Dynamic Routing
o It is also known as Adaptive Routing.
o It is a technique in which a router adds a new route in the routing table for each
packet in response to the changes in the condition or topology of the network.
o Dynamic protocols are used to discover the new routes to reach the destination.
o In Dynamic Routing, RIP and OSPF are the protocols used to discover the new
routes.
o If any route goes down, then the automatic adjustment will be made to reach the
destination.

Routing algorithm

In order to transfer the packets from source to the destination, the network layer must
determine the best route through which packets can be transmitted.

o The routing protocol is a routing algorithm that provides the best path from the source
to the destination. The best path is the path that has the "least-cost path" from source
to the destination.
o Routing is the process of forwarding the packets from source to the destination but
the best route to send the packets is determined by the routing algorithm.

Classification of a Routing algorithm


The Routing algorithm is divided into two categories:

Adaptive Routing algorithm

o An adaptive routing algorithm is also known as dynamic routing algorithm.


o This algorithm makes the routing decisions based on the topology and network
traffic.
o The main parameters related to this algorithm are hop count, distance and estimated
transit time.

An adaptive routing algorithm can be classified into three parts:

 Centralized algorithm − It finds the least-cost path between source and destination
nodes by using global knowledge about the network. So, it is also known as global
routing algorithm.
 Isolated algorithm − This algorithm procures the routing information by using local
information instead of gathering information from other nodes.
 Distributed algorithm − This is a decentralized algorithm that computes the least-
cost path between source and destination iteratively in a distributed manner.

Non-Adaptive Routing algorithm


o Non-Adaptive routing algorithm is also known as a static routing algorithm.
o When booting up the network, the routing information stores to the routers.
o Non-Adaptive routing algorithms do not take the routing decision based on the
network topology or network traffic.

The Non-Adaptive Routing algorithm is of two types:

Flooding: In case of flooding, every incoming packet is sent to all the outgoing links except
the one from it has been reached. The disadvantage of flooding is that node may contain
several copies of a particular packet.

Random walks: In case of random walks, a packet sent by the node to one of its
neighbours randomly. An advantage of using random walks is that it uses the alternative
routes very efficiently.

Basis of Adaptive Routing algorithm Non-Adaptive Routing algorithm


Comparison

Define Adaptive Routing algorithm is The Non-Adaptive Routing


an algorithm that constructs the algorithm is an algorithm that
routing table based on the constructs the static table to
network conditions. determine which node to send the
packet.

Usage Adaptive routing algorithm is The Non-Adaptive Routing


used by dynamic routing. algorithm is used by static routing.

Routing Routing decisions are made Routing decisions are the static
decision based on topology and network tables.
traffic.

Categorization The types of adaptive routing The types of Non-Adaptive routing


algorithm, are Centralized, algorithm are flooding and
isolation and distributed random walks.
algorithm.

Complexity Adaptive Routing algorithms Non-Adaptive Routing algorithms


are more complex. are simple.

Unicast routing
Most of the traffic on the internet and intranets known as unicast data or unicast traffic is
sent with specified destination. Routing unicast data over the internet is called unicast
routing.
Broadcast routing
By default, the broadcast packets are not routed and forwarded by the routers on any
network. Routers create broadcast domains. But it can be configured to forward broadcasts
in some special cases. A broadcast message is destined to all network devices.
Broadcast routing can be done in two ways (algorithm):
 A router creates a data packet and then sends it to each host one by one. In this
case, the router creates multiple copies of single data packet with different
destination addresses. All packets are sent as unicast but because they are sent to
all, it simulates as if router is broadcasting.
 Secondly, when router receives a packet that is to be broadcasted, it simply floods
those packets out of all interfaces. All routers are configured in the same way.
Multicast Routing
Multicast routing is special case of broadcast routing with significance difference and
challenges. In broadcast routing, packets are sent to all nodes even if they do not want it.
But in Multicast routing, the data is sent to only nodes which wants to receive the packets.

Anycast Routing

Anycast packet forwarding is a mechanism where multiple hosts can have same logical
address. When a packet destined to this logical address is received, it is sent to the host
which is nearest in routing topology.

Unicast Routing Protocols


There are three major protocols for unicast routing:
 Distance Vector Routing
 Link State Routing
 Path-Vector Routing

Distance Vector Routing –


 It is a dynamic routing algorithm in which each router computes distance
between itself and each possible destination i.e., its immediate neighbours.
 The router shares its knowledge about the whole network to its neighbours and
accordingly updates table based on its neighbours.
 The sharing of information with the neighbours takes place at regular intervals.
 It makes use of Bellman Ford Algorithm for making routing tables.
 Problems – Count to infinity problem which can be solved by splitting horizon.
– Good news spread fast and bad news spread slowly.
– Persistent looping problem i.e., loop will be there forever.

Link State Routing –


 It is a dynamic routing algorithm in which each router shares knowledge of its
neighbours with every other router in the network.
 A router sends its information about its neighbours only to all the routers through
flooding.
 Information sharing takes place only whenever there is a change.
 It makes use of Dijkstra’s Algorithm for making routing tables.
 Problems – Heavy traffic due to flooding of packets.
– Flooding can result in infinite looping which can be solved by using Time to
live (TTL) field.

Comparison between Distance Vector Routing and Link State Routing:


Network Layer Protocols

ARP
o ARP stands for Address Resolution Protocol.
o It is used to associate an IP address with the MAC address.
o Each device on the network is recognized by the MAC address imprinted on the NIC.
Therefore, we can say that devices need the MAC address for communication on a
local area network. MAC address can be changed easily. For example, if the NIC on
a particular machine fails, the MAC address changes but IP address does not
change. ARP is used to find the MAC address of the node when an internet address
is known.

How ARP works

If the host wants to know the physical address of another host on its network, then it sends
an ARP query packet that includes the IP address and broadcast it over the network. Every
host on the network receives and processes the ARP packet, but only the intended recipient
recognizes the IP address and sends back the physical address. The host holding the
datagram adds the physical address to the cache memory and to the datagram header, then
sends back to the sender.

RARP
o RARP stands for Reverse Address Resolution Protocol.
o If the host wants to know its IP address, then it broadcast the RARP query packet
that contains its physical address to the entire network. A RARP server on the
network recognizes the RARP packet and responds back with the host IP address.
o The protocol which is used to obtain the IP address from a server is known
as Reverse Address Resolution Protocol.
o The message format of the RARP protocol is similar to the ARP protocol.
o Like ARP frame, RARP frame is sent from one machine to another encapsulated in
the data portion of a frame.

ICMP
o ICMP stands for Internet Control Message Protocol.
o The ICMP is a network layer protocol used by hosts and routers to send the
notifications of IP datagram problems back to the sender.
o ICMP uses echo test/reply to check whether the destination is reachable and
responding.
o ICMP handles both control and error messages, but its main function is to report the
error but not to correct them.
o An IP datagram contains the addresses of both source and destination, but it does
not know the address of the previous router through which it has been passed. Due
to this reason, ICMP can only send the messages to the source, but not to the
immediate routers.
o ICMP protocol communicates the error messages to the sender. ICMP messages
cause the errors to be returned back to the user processes.
o ICMP messages are transmitted within IP datagram.

The Format of an ICMP message

o The first field specifies the type of the message.


o The second field specifies the reason for a particular message type.
o The checksum field covers the entire ICMP message.

IGMP
o IGMP stands for Internet Group Message Protocol.
o The IP protocol supports two types of communication:
o Unicasting: It is a communication between one sender and one receiver.
Therefore, we can say that it is one-to-one communication.
o Multicasting: Sometimes the sender wants to send the same message to a
large number of receivers simultaneously. This process is known as
multicasting which has one-to-many communication.
o The IGMP protocol is used by the hosts and router to support multicasting.
o The IGMP protocol is used by the hosts and router to identify the hosts in a LAN that
are the members of a group.
o IGMP is a part of the IP layer, and IGMP has a fixed-size message.
o The IGMP message is encapsulated within an IP datagram.

The Format of IGMP message

Type: It determines the type of IGMP message. There are three types of IGMP message:
Membership Query, Membership Report and Leave Report.

Maximum Response Time: This field is used only by the Membership Query message. It
determines the maximum time the host can send the Membership Report message in
response to the Membership Query message.

Checksum: It determines the entire payload of the IP datagram in which IGMP message is
encapsulated.

You might also like