CN Mod3
CN Mod3
Here a server sends packets which are entertained by more than one servers. Every network
has one IP address reserved for the Network Number which represents the network and one
IP address reserved for the Broadcast Address, which represents all the hosts in that network.
A single IP address can contain information about the network and its sub-network and
ultimately the host. This scheme enables the IP Address to be hierarchical where a network
can have many sub-networks which in turn can have many hosts.
Subnet Mask
The 32-bit IP address contains information about the host and its network. It is very necessary
to distinguish both. For this, routers use Subnet Mask, which is as long as the size of the
network address in the IP address. Subnet Mask is also 32 bits long. If the IP address in
binary is ANDed with its Subnet Mask, the result yields the Network address. For example,
say the IP Address is 192.168.1.152 and the Subnet Mask is 255.255.255.0 then −
This way the Subnet Mask helps extract the Network ID and the Host from an IP Address. It
can be identified now that 192.168.1.0 is the Network number and 192.168.1.152 is the host
on that network.
Binary Representation
The positional value method is the simplest form of converting binary from decimal value. IP
address is 32 bit value which is divided into 4 octets. A binary octet contains 8 bits and the
value of each bit can be determined by the position of bit value '1' in the octet.
Positional value of bits is determined by 2 raised to power (position – 1), that is the value of a
bit 1 at position 6 is 2^(6-1) that is 2^5 that is 32. The total value of the octet is determined by
adding up the positional value of bits. The value of 11000000 is 128+64 = 192. Some
examples are shown in the table below −
Classful Addressing
IP address is an address having information about how to reach a specific host, especially
outside the LAN. An IP address is a 32-bit unique address having an address space of 232.
Generally, there are two notations in which IP address is written, dotted decimal notation and
hexadecimal notation.
Hexadecimal Notation:
1. The value of any segment (byte) is between 0 and 255 (both included).
2. There are no zeroes preceding the value in any segment (054 is wrong, 54 is correct).
Classful Addressing
The 32-bit IP address is divided into five sub-classes. These are:
• Class A
• Class B
• Class C
• Class D
• Class E
Each of these classes has a valid range of IP addresses. Classes D and E are reserved for
multicast and experimental purposes respectively. The order of bits in the first octet
determine the classes of IP address.
IPv4 address is divided into two parts:
• Network ID
• Host ID
The class of IP address is used to determine the bits used for network ID and host ID and the
number of total networks and hosts possible in that particular class. Each ISP or network
administrator assigns IP address to each device that is connected to its network.
Note: While finding the total number of host IP addresses, 2 IP addresses are not counted and are
therefore, decreased from the total count because the first IP address of any network is the network
number and whereas the last IP address is reserved for broadcast IP.
Class A:
IP address belonging to class A are assigned to the networks that contain a large number of
hosts.
The higher order bit of the first octet in class A is always set to 0. The remaining 7 bits in first
octet are used to determine network ID. The 24 bits of host ID are used to determine the host
in any network. The default subnet mask for class A is 255.x.x.x. Therefore, class A has a
total of:
• 2^7-2= 126 network ID (Here 2 address is subtracted because 0.0.0.0 and 127.x.y.z
are special address. )
• 2^24 – 2 = 16,777,214 host ID
Class B:
IP address belonging to class B are assigned to the networks that ranges from medium-sized
to large-sized networks.
The higher order bits of the first octet of IP addresses of class B are always set to 10. The
remaining 14 bits are used to determine network ID. The 16 bits of host ID is used to
determine the host in any network. The default sub-net mask for class B is 255.255.x.x. Class
B has a total of:
Class C:
The higher order bits of the first octet of IP addresses of class C are always set to 110. The
remaining 21 bits are used to determine network ID. The 8 bits of host ID is used to
determine the host in any network. The default sub-net mask for class C is 255.255.255.x.
Class C has a total of:
Class D:
IP address belonging to class D are reserved for multi-casting. The higher order bits of the
first octet of IP addresses belonging to class D are always set to 1110. The remaining bits are
for the address that interested hosts recognize.
Class D does not posses any sub-net mask. IP addresses belonging to class D ranges from
224.0.0.0 – 239.255.255.255.
Class E:
IP addresses belonging to class E are reserved for experimental and research purposes. IP
addresses of class E ranges from 240.0.0.0 – 255.255.255.254. This class doesn’t have any
sub-net mask. The higher order bits of first octet of class E are always set to 1111.
Host ID’s are used to identify a host within a network. The host ID are assigned based on the
following rules:
• Within any network, the host ID must be unique to that network.
• Host ID in which all bits are set to 0 cannot be assigned because this host ID is used
to represent the network ID of the IP address.
• Host ID in which all bits are set to 1 cannot be assigned because this host ID is
reserved as a broadcast address to send packets to all the hosts present on that
particular network.
Hosts that are located on the same physical network are identified by the network ID, as all
host on the same physical network is assigned the same network ID. The network ID is
assigned based on the following rules:
• The network ID cannot start with 127 because 127 belongs to class A address and is
reserved for internal loop-back functions.
• All bits of network ID set to 1 are reserved for use as an IP broadcast address and
therefore, cannot be used.
• All bits of network ID set to 0 are used to denote a specific host on the local network
and are not routed and therefore, aren’t used.
The problem with this classful addressing method is that millions of class A address are wasted,
many of the class B address are wasted, whereas, number of addresses available in class C is
so small that it cannot cater the needs of organizations. Class D addresses are used for multicast
routing and are therefore available as a single block only. Class E addresses are reserved.
Design Issues in Network Layer
Network layer is majorly focused on getting packets from the source to the destination, routing
error handling and congestion control.
• Addressing:
Maintains the address at the frame header of both source and destination and performs
addressing to detect various devices in network.
• Packeting:
This is performed by Internet Protocol. The network layer converts the packets from its
upper layer.
• Routing:
It is the most important functionality. The network layer chooses the most relevant and
best path for the data transmission from source to destination.
• Inter-networking:
It works to deliver a logical connection across multiple devices.
Network layer design issues:
The network layer comes with some design issues they are described as follows:
1. Store and Forward packet switching:
The host sends the packet to the nearest router. This packet is stored there until it has fully
arrived once the link is fully processed by verifying the checksum then it is forwarded to the next
router till it reaches the destination. This mechanism is called “Store and Forward packet
switching.”
2. Services provided to Transport Layer:
Through the network/transport layer interface, the network layer transfers it’s services to the
transport layer. These services are described below.
But before providing these services to the transfer layer following goals must be kept in mind :-
• Offering services must not depend on router technology.
• The transport layer needs to be protected from the type, number and topology of the
available router.
• The network addresses for the transport layer should use uniform numbering pattern also
at LAN and WAN connections.
Based on the connections there are 2 types of services provided :
• Connectionless – The routing and insertion of packets into subnet is done individually.
No added setup is required.
• Connection-Oriented – Subnet must offer reliable service and all the packets must be
transmitted over a single route.
3. Implementation of Connectionless Service:
Packet are termed as “datagrams” and corresponding subnet as “datagram subnets”. When the
message size that has to be transmitted is 4 times the size of the packet, then the network layer
divides into 4 packets and transmits each packet to router via. a few protocol.Each data packet
has destination address and is routed independently irrespective of the packets.
4. Implementation of Connection Oriented service:
To use a connection-oriented service, first we establishes a connection, use it and then release it.
In connection-oriented services, the data packets are delivered to the receiver in the same order
in which they have been sent by the sender.
It can be done in either two ways :
• Circuit Switched Connection – A dedicated physical path or a circuit is established
between the communicating nodes and then data stream is transferred.
• Virtual Circuit Switched Connection – The data stream is transferred over a packet
switched network, in such a way that it seems to the user that there is a dedicated path
from the sender to the receiver. A virtual path is established here. While, other
connections may also be using the same path.
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Internet Protocol Version 4-
• IPv4 short for Internet Protocol Version 4 is the fourth version of the Internet
Protocol (IP).
• IP is responsible to deliver data packets from the source host to the destination
host.
• This delivery is solely based on the IP Addresses in the packet headers.
• IPv4 is the first major version of IP.
• IPv4 is a connectionless protocol for use on packet-switched networks.
IPv4 Header-
1. Version-
• Header length is a 4 bit field that contains the length of the IP header.
• It helps in knowing from where the actual data begins.
Minimum And Maximum Header Length-
In general,
Examples-
• Type of service is a 8 bit field that is used for Quality of Service (QoS).
• The datagram is marked for giving a certain treatment using this field.
4. Total Length-
• Total length is a 16 bit field that contains the total length of the datagram (in
bytes).
• Minimum total length of datagram = 20 bytes (20 bytes header + 0 bytes data)
• Maximum total length of datagram = Maximum value of 16 bit word = 65535
bytes
5. Identification-
6. DF Bit-
8. Fragment Offset-
8. Fragment Offset-
9. Time To Live-
NOTES
It is important to note-
• Both intermediate devices having network layer and destination
decrements the TTL value by 1.
• If the value of TTL is found to be zero at any intermediate device,
then the datagram is discarded.
• So, at any intermediate device, the value of TTL must be greater
than zero to proceed further.
• If the value of TTL becomes zero at the destination, then the
datagram is accepted.
• So, at the destination, the value of TTL may be greater than or
equal to zero.
10. Protocol-
Consider-
• An IP datagram is sent by the sender to the receiver.
• When datagram reaches at the router, it’s buffer is already full.
In such a case,
• Router does not discard the datagram directly.
• Before discarding, router checks the next level protocol number
mentioned in its IP header.
• If the datagram belongs to TCP, then it tries to make room for the
datagram in its buffer.
• It creates a room by eliminating one of the datagrams having
lower priority.
• This is because it knows that TCP is a reliable protocol and if it
discards the datagram, then it will be sent again by the sender.
• The order in which router eliminate the datagrams from its buffer
is-
ICMP > IGMP > UDP > TCP
At each hop,
• The header checksum is compared with the value contained in this field.
• If header checksum is found to be mismatched, then the datagram is discarded.
• Router updates the checksum field whenever it modifies the datagram header.
NOTE
It is important to note-
• Computation of header checksum includes IP header only.
• Errors in the data field are handled by the encapsulated protocol.
14. Options-
1. Record Route-
• A record route option is used to record the IP Address of the routers through
which the datagram passes on its way.
• When record route option is set in the options field, IP Address of the router gets
recorded in the Options field.
NOTE
The maximum number of IPv4 router addresses that can be recorded in the
Record Route option field of an IPv4 header is 9.
Explanation-
2. Source Routing-
• A source routing option is used to specify the route that the datagram must take
to reach the destination.
• This option is generally used to check whether a certain path is working fine or
not.
• Source routing may be loose or strict.
3. Padding-
• Addition of dummy data to fill up unused space in the transmission unit and make
it conform to the standard size is called as padding.
• Options field is used for padding.
Example-
• When header length is not a multiple of 4, extra zeroes are padded in the Options
field.
• By doing so, header length becomes a multiple of 4.
• If header length = 30 bytes, 2 bytes of dummy data is added to the header.
• This makes header length = 32 bytes.
• Then, the value 32 / 4 = 8 is put in the header length field.
• In worst case, 3 bytes of dummy data might have to be padded to make the
header length a multiple of 4.
Introduction to Internet Protocol version 6
IP version 6 is the new version of Internet Protocol, which is way better than
IP version 4 in terms of complexity and efficiency. Let’s look at the header of
IP version 6 and understand how it is different from the IPv4 header.
IP version 6 Header Format :
IPv6 packet may contain zero, one or more extension headers but these
should be present in their recommended order:
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Distance Vector Routing
a) The least-cost route between any two nodes is the route with
minimum distance.
b) Each node maintains a vector(table) of minimum distances to
every node.
c) The table at each node also guides the packets to the desired
node by showing the next hop routing.
Example:
Assume each node as the cities.
Lines as the roads connecting them.
1
Final Distance vector routing tables
2
Initialization
a) The table in figure are stable.
b) Each node knows how to reach any other node and their cost.
c) At the beginning, each node know the cost of itself and its
immediate neighbor.[those node directly connected to it.]
d) Assume that each node send a message to the immediate neighbors
and find the distance between itself and these neighbors.
e) The distance of any entry that is not a neighbor is marked as
infinite(unreachable).
3
Initialization of tables in distance vector routing (DVR)
4
Sharing
a) Idea is to share the information between neighbors.
b) The node A does not know the distance about E, but node C does.
c) If node C share it routing table with A, node A can also know how
to reach node E.
d) On the other hand, node C does not know how to reach node D, but
node A does.
e) If node A share its routing table with C, then node C can also know
how to reach node D.
f) Node A and C are immediate neighbors, can improve their routing
tables if they help each other.
5
Sharing Contd.,
a) How much of the table must be shared with each neighbor?
b) The third column of the table(next hop) is not useful for the
neighbor.
c) When the neighbor receives a table, this column needs to be
replaced with the sender’s name.
d) If any of the rows can be used, the next node column filled with
sender of the table.
e) Therefore, a node can send only the first two column of its table to
any neighbor.
6
7
Updating in distance vector routing example: C to A
From C From A
8
When to share
a) Periodic Update: A node sends its table, normally every 30s, in a
periodic update, it depends on the protocol that is using DVR.
b) Triggered Update: A node sends its two-column routing table to its
neighbors anytime there is a change in its routing table.
c) This is called triggered update the change can result from the
following:
A node receives a table from a neighbor, resulting in changes in its
own table after updating.
A node detects some failure in the neighboring links which results
in a distance change to infinity.
9
Distance Vector Routing (DVR)
a) 3 keys to understand how this algorithm works:
• Sharing knowledge about the entire AS. Each router
shares its knowledge about the entire AS with
neighbours. It sends whatever it has.
• Sharing only with immediate neighbours. Each router
sends whatever knowledge it has thru all its interface.
• Sharing at regular intervals. sends at fixed intervals,
e.g. every 30 sec.
10
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Write a short note on: Open loop congestion techniques
i. In this method, policies are used to prevent the congestion before it happens.
ii. Congestion control is handled either by the source or by the destination. The various
methods used for open loop congestion control are:
1) Retransmission Policy
a. The sender retransmits a packet, if it feels that the packet it has sent is lost or corrupted.
b. However retransmission in general may increase the congestion in the network. But we
need to implement good retransmission policy to prevent congestion.
c. The retransmission policy and the retransmission timers need to be designed to optimize
efficiency and at the same time prevent the congestion.
2) Window Policy
a. To implement window policy, selective reject window method is used for congestion
control.
c. Selective reject method sends only the specific lost or damaged packets.
3) Acknowledgement Policy
a. The acknowledgement policy imposed by the receiver may also affect congestion.
b. If the receiver does not acknowledge every packet it receives it may slow down the sender
and help prevent congestion.
c. Acknowledgments also add to the traffic load on the network. Thus, by sending fewer
acknowledgements we can reduce load on the network.
4) Discarding Policy
a. A router may discard less sensitive packets when congestion is likely to happen.
b. Such a discarding policy may prevent congestion and at the same time may not harm the
integrity of the transmission.
5) Admission Policy
b. Switches in a flow first check the resource requirement of a flow before admitting it to the
network.
c. A router can deny establishing a virtual circuit connection if there is congestion in the
"network or if there is a possibility of future congestion.