Unit 4 Networking (GZRSC)
Unit 4 Networking (GZRSC)
What is IPv4?
IP stands for Internet Protocol and v4 stands for Version Four (IPv4). IPv4 was the primary
version brought into action for production within the ARPANET in 1983. An Internet Protocol
address is a unique identifier for devices connected to a network. The unique identifier makes it
possible for devices to find and communicate with each other.
IP version four addresses are 32-bit
32 bit integers which will be expressed in hexadecimal
packet
notation. IPv4 is a connectionless protocol for use on packet-switched networks.
The address space of IPv4 is 232 or 4,294,967,296
Characteristics of IPv4
1) IPv4 could be a 32-BitBit IP Address.
2) IPv4 could be a numeric address, and its bits are separated by a dot.
3) The number of header fields are twelve and the length of the header filed is twent
twenty.
4) It has Unicast, broadcast, and multicast style of addresses.
5) IPv4 supports VLSM (Virtual Length Subnet Mask).
6) IPv4 uses the Post Address Resolution Protocol to map to mack address.
7) RIP may be a routing protocol supported by the routed daemon.
8) Networks oughtught to be designed either manually or with DHCP.
9) Packet fragmentation permits from routers and causing host.
Types Of IP Address-
IP Addresses may be of the following two types-
types
1. Static IP Address-
Static IP Address is an IP Address that
once assigned to a network element
always remains the same.
They are configured manually.
2. Dynamic IP Address-
IP Address Format-
IP Address is a 32 bit binary address
written as 4 numbers separated by dots.
The 4 numbers are called as octets where
each octet has 8 bits.
The octets are divided into 2 components-
components
Net ID and Host ID.
1. Network ID represents the IP Address of the network and is used to identify the network.
2. Host ID represents the IP Address of the host and is used to identify the host within the network
Example of an IP Address is-
IP Address Format-
IP Addressing-
There are two systems in which classified
hich IP Addresses are classified-
Classful Addressing-
classes-
In Classful Addressing System, IP Addresses are organized into following 5 classes
Networking I Unit 4 (GZRSC) 2021
1. Class A
If the 32 bit binary address starts with a bit 0, then IP Address belongs to class A.
Octet
00000000.00000000.00000000.00000000
.00000000.00000000.00000000 Or 0.0.0.0 Or 0 - 127
To to
01111111. .00000000.00000000.0000000
.00000000.00000000.00000000 127.0.0.0
64 32 16 8 4 2 1=127
Class A is used by organizations requiring very large size networks like NASA, Pentagon etc.
No of subnet= 214
No. of hosts=216
128
10000000.00000000.00000000.00000000
.00000000.00000000.00000000 Or 0.0.0.0 Or 128 - 191
Octet To to
10111111. .00000000.00000000.00000000 127.0.0.0
128 0 32 16 8 4 2 1=191
Class B is used by organizations requiring medium size networks like IRCTC, banks etc.
No of subnet= 221
Networking I Unit 4 (GZRSC) 2021
No. of hosts=28
128 64 =192
11000000.00000000.00000000.00000000 Or 0.0.0.0 Or 192 - 223
To to
11011111. .00000000.00000000.00000000 127.0.0.0
128 64 0 16 8 4 2 1=223
4. Class D
1 1 1 0 Multicast Address
128 64 32 =224
11100000.00000000.00000000.00000000 Or 0.0.0.0 Or 224 - 239
To to
11101111. .00000000.00000000.00000000 127.0.0.0
128 64 32 0 8 4 2 1=239
5. Class E
128 64 32 16 =240
11110000.00000000.00000000.00000000 Or 0.0.0.0 Or 240 - 293
To to
11111111. .00000000.00000000.00000000 127.0.0.0
128 64 32 16 8 4 2 1=255
Classes of IP Address-
Page 4
Networking I Unit 4 (GZRSC) 2021
128 –
Class B 230 214 216 – 2 255.255.0.0
191
192 –
Class C 229 221 28 – 2 255.255.255.0
223
Page 5
Networking I Unit 4 (GZRSC) 2021
IPv4 Header-
The following diagram represents the IPv4 header
Page 6
Networking I Unit 4 (GZRSC) 2021
IPv6
IPv6 is the latest version of the Internet Protocol, which identifies devices across the internet
so they can be located. Every device that uses the internet is identified through its own IP address in
order for internet communication to work.
The previous version, IPv4, uses a 32-bit
32 bit addressing scheme to support 4.3 billion devices,
which was thought to be enough. However, the growth of the internet, personal computers,
smartphones and now Internet of Things devices proves that the world needed more addresses.
Fortunately, the Internet Engineering Task Force (IETF) recognized this 20 years ago. In
128 bit addressing to support approximately 340 trillion
1998 it created IPv6, which instead uses 128-bit
like). Instead of the IPv4 address method of four sets of one
trillion (or 2 to the 128th power, if you like). one-
to three-digit
digit numbers, IPv6 uses eight groups of four hexadecimal digits, separated by colons.
Networking I Unit 4 (GZRSC) 2021
1.Unicast Addresses :The packet sent to a unicast address must be delivered to the specific computer.
2. Multicast Addresses : The packet sent to a multicast address must be delivered to the each member
of the group.
3. Anycast Addresses : The packet sent to a anycast address is delivered to only one of the member
of the group, the nearest one.
Note : Broadcast is not defined in IPv6.
Page 8
Networking I Unit 4 (GZRSC) 2021
NAT Types
There are three different types of NATs. People use them for different reasons, but they all still work
as a NAT.
1. Static NAT
When the local address is converted to a public one, this NAT chooses the same one. This means
there will be a consistent public IP address associated with that router or NAT device.
2. Dynamic NAT
Instead of choosing the same IP address every time, this NAT goes through a pool of public IP
addresses. This results in the router or NAT device getting a different address each time the router
translates the local address to a public address.
3. PAT
PAT stands for port address translation. It’s a type of dynamic NAT, but it bands several local IP
addresses to a singular public one. Organizations that want all their employees’ activity to use a
singular IP address use a PAT, often under the supervision of a network administrator.
ICMP Protocol
Page 9
Networking I Unit 4 (GZRSC) 2021
The ICMP stands for Internet Control Message Protocol. It is a network layer protocol. It
is used for error handling in the network layer, and it is primarily used on network devices such
as routers. As different types of errors can exist in the network layer, so ICMP can be used to
report these errors and to debug those errors
ICMP messages are organized in types and codes. Types and codes are numeric values.
Page 10
Networking I Unit 4 (GZRSC) 2021
Type: It is an 8-bit field. It defines the ICMP message type. The values range from 0 to 127 are
defined for ICMPv6, and the values from 128 to 255 are the informational messages.
Code: It is an 8-bit field that defines the subtype of the ICMP message
Checksum: It is a 16-bit field to detect whether the error exists in the message or not.
It sets the value checksum field to 0 and performs the same checksum operation. After running
the checksum operation, it compares the result with the value stored in the checksum field. If
both values are the same, the message is considered valid. All valid messages are processed
while are invalid messages are discarded.
Message body
Every IP packet consists of two fields: header and data. IP protocol includes all necessary
information in every IP packet making it capable to reach its destination by taking whatever
path is available. This information is included in the header field of IP packets. The first 64 bits
of the data field contain the header of the upper layer. It contains the source and destination port
number field used by the TCP layer.
ICMP uses this information to inform the sender which IP packet failed. The message body
field of an ICMP error message contains two fields: the original message header and the
original message data. These fields are used to include the header and the first 64 bits of the
data field of the failed message. When a source receives an ICMP error message, by examining
the message body field it can determine which IP packet was failed.
Routing is a process which is performed by layer 3 (or network layer) devices in order to deliver
the packet by choosing an optimal path from one network to another.
What is routing?
Network routing is the process of selecting a path across one or more networks. The principles
of routing can apply to any type of network, from telephone networks to public transportation.
In packet-switching networks, such as the Internet, routing selects the paths for Internet
Protocol (IP) packets to travel from their origin to their destination. These Internet routing
decisions are made by specialized pieces of network hardware called routers.
Page 11
Networking I Unit 4 (GZRSC) 2021
What is routing?
Routing is a procedure of maintaining a routing table at each router, to send packets/
information/data to the desired destination. It uses algorithms that calculate the most optimal path in
terms of effective distance, cost, bandwidth, and reliability, etc. (also known as Routing algorithm
metrics). At each router, a table is maintained that contains information about its neighbors,
destination, distance, and next hop. When a packet arrives at a router, the destination is checked, and
depending on it, the packet is sent forward. All tables are shared frequently among routers to keep a
track of path information. On the Internet, routing is used.
Network routing is the process of selecting a path across one or more networks. Routing is a
process which is performed by layer 3 (or network layer) devices in order to deliver the packet by
choosing an optimal path from one network to another
Routing algorithm
1. Adaptive algorithm (Dynamic routing)
a) Distance-vector routing
b) Link state routing
2. Non-Adaptive algorithm (Static routing)
a) Flooding
Page 12
Networking I Unit 4 (GZRSC) 2021
When a node x receives new DV estimate from any neighbor v, it saves v’s distance vector and it
updates its own DV using B-F equation:
Dx(y) = min { C(x,v) + Dv(y), Dx(y) } for each node y ∈ N
9
B E Destination Cost Next hop
1 A 1 A
A
3 2
C 3 C
5 D 7 C
C D
4 E 9 E
Source Destination
B as a source
B to A : B-A=1
B-C-A=3+5=8
B-E-D-C-A=9+2+4+5=20
B to C : B-C=3
B-A-C=6
B-E-D-C=9+2+4=15
B to D : B-A-C-D=1+5+4=10
B-C-D=3+4=7
B-E-D=9+2=11
B to E : B-E=9
B-C-D-E=3+4+2=9
B-A-C-D-E=1+5+4+2=12
Page 13
Networking I Unit 4 (GZRSC) 2021
Link state database – A collection information gathered from link state packet.
Shortest path first algorithm (Dijkstra algorithm) – A calculation performed on the database results
into shortest path
Routing table – A list of known paths and interfaces.
2
C 1
A
3 5 2
D F
1 3 2
B
4 E
Iteration Tree B C D E F
Initial A 3 2 5 ∞ ∞
1 A,C 3 - 4 ∞ 3
2 A,B,C - - 4 7 3
3 A,B,C,F - - 4 5 -
4 A,B,C,D,F - - - 5 -
5 A,B,C,D,E,F - - - - -
Unicast – Unicast means the transmission from a single sender to a single receiver. It is a point to
point communication between sender and receiver. There are various unicast protocols such as TCP,
HTTP, etc.
TCP is the most commonly used unicast protocol. It is a connection oriented protocol that
relay on acknowledgement from the receiver side.
HTTP stands for Hyper Text Transfer Protocol. It is an object oriented protocol for communication.
There are three major protocols for unicast routing:
Page 14
Networking I Unit 4 (GZRSC) 2021
Flooding is used in computer networks routing algorithm in which every incoming packet is
sent through every outgoing link except the one it arrived on. Flooding, which is similar to
broadcasting, occurs when source packets (without routing data) are transmitted to all attached
network nodes. Because flooding uses. When a packet is received, the routers send it to all the
interfaces except the one on which it was received. This creates too much burden on the network and
lots of duplicate packets wandering in the network
Flooding is used in bridging and in systems such as Usenet and peer-to-peer file sharing and
as part of some routing protocols, including OSPF, DVMRP, and those used in ad-hoc wireless
networks (WANETs)
B C D
A Data : Packet
Z
Source
E F Destination
Types
1.Uncontrolled Flooding: In uncontrolled flooding each node unconditionally distributes
packets to each of its neighbors. Without conditional logic to prevent indefinite recirculation of the
same packet, broadcast storms are a hazard.
2.Controlled flooding: Controlled flooding has its own two algorithms to make it reliable,
SNCF (Sequence Number Controlled Flooding) and RPF (Reverse Path Forwarding). In SNCF, the
node attaches its own address and sequence number to the packet, since every node has a memory of
addresses and sequence numbers. If it receives a packet in memory, it drops it immediately while in
RPF, the node will only send the packet forward. If it is received from the next node, it sends it back
to the sender.
Advantages
The advantages of this method are that it is very simple to implement, if a packet can be
delivered then it will (probably multiple times), and since flooding naturally utilizes every path
through the network it will also use the shortest path.
Disadvantages
Flooding can be costly in terms of wasted bandwidth. While a message may only have one
destination it has to be sent to every host. In the case of a ping flood or a denial of service attack, it
can be harmful to the reliability of a computer network.
Messages can become duplicated in the network further increasing the load on the network as
well as requiring an increase in processing complexity to disregard duplicate messages. Duplicate
packets may circulate forever, unless certain precautions are taken:
Page 15
Networking I Unit 4 (GZRSC) 2021
The header of a TCP segment can range from 20-60 bytes. 40 bytes are for options. If there
are no options, header is of 20 bytes else it can be of upmost 60 bytes.
Page 17
Networking I Unit 4 (GZRSC) 2021
Header fields:
Source Port Address –
16 bit field that holds the port address of the application that is sending the data segment.
Destination Port Address –
16 bit field that holds the port address of the application in the host that is receiving the data
segment.
Sequence Number –
32 bit field that holds the sequence number, i.e, the byte number of the first byte that is sent
in that particular segment. It is used to reassemble the message at the receiving end if the segments
are received out of order.
Acknowledgement Number –
32 bit field that holds the acknowledgement number, i.e, the byte number that the receiver
expects to receive next. It is an acknowledgment for the previous bytes being received successfully.
Header Length (HLEN) –
This is a 4 bit field that indicates the length of the TCP header by number of 4-byte words in
the header, i.e, if the header is of 20 bytes(min length of TCP header), then this field will hold 5
(because 5 x 4 = 20) and the maximum length: 60 bytes, then it’ll hold the value 15(because 15 x 4 =
60). Hence, the value of this field is always between 5 and 15.
Control flags –
These are 6 1-bit control bits that control connection establishment, connection termination,
connection abortion, flow control, mode of transfer etc. Their function is:
1) URG: Urgent pointer is valid
2) ACK: Acknowledgement number is valid( used in case of cumulative
acknowledgement)
3) PSH: Request for push
4) RST: Reset the connection
5) SYN: Synchronize sequence numbers
6) FIN: Terminate the connection
Window size –
This field tells the window size of the sending TCP in bytes.
Checksum –
This field holds the checksum for error control. It is mandatory in TCP as opposed to UDP.
Urgent pointer –
This field (valid only if the URG control flag is set) is used to point to data that is urgently
required that needs to reach the receiving process at the earliest. The value of this field is added to
the sequence number to get the byte number of the last urgent byte.
TCP Connection –
TCP is connection oriented. A TCP connection is established by 3-way handshake.
The Transmission Control Protocol is the most common transport layer protocol. It works
together with IP and provides a reliable transport service between processes using the network layer
service provided by the IP protocol.
The various services provided by the TCP to the application layer are as follows:
1. Process-to-Process Communication –
TCP provides process to process communication, i.e, the transfer of data takes place between
individual processes executing on end systems. This is done using port numbers or port addresses.
Port numbers are 16 bit long that help identify which process is sending or receiving data on a host.
Page 18
Networking I Unit 4 (GZRSC) 2021
2. Stream oriented –
This means that the data is sent and received as a stream of bytes(unlike UDP or IP that
divides the bits into datagrams or packets). However, the network layer, that provides service for the
TCP, sends packets of information not streams of bytes. Hence, TCP groups a number of bytes
together into a segment and adds a header to each of these segments and then delivers these segments
to the network layer. At the network layer, each of these segments are encapsulated in an IP packet
for transmission. The TCP header has information that is required
required for control purpose which will be
discussed along with the segment structure.
3. Full duplex service –
This means that the communication can take place in both directions at the same time.
4. Connection oriented service –
connection oriented service. It defines 3 different phases:
Unlike UDP, TCP provides connection
Connection establishment
Data transfer
Connection termination
(IMP: This is a virtual connection, not a physical connection, means during the transmission
segments will not follow the same path to reach the
the resources will not be reserved and the segments
destination but it is a connection orientation in the sense that segments will arrive in order by the
help of sequence number.)
5. Reliability –
attempts to recover lost or corrupted
TCP is reliable as it uses checksum for error detection, attempts
packets by re-transmission,
transmission, acknowledgement policy and timers. It uses features like byte number
and sequence number and acknowledgement number so as to ensure reliability. Also, it uses
congestion control mechanisms.
6. Multiplexing –
de multiplexing at the sender and receiver ends respectively as a
TCP does multiplexing and de-multiplexing
number of logical connections can be established between port numbers over a physical connection.
Byte number, Sequence number and Acknowledgement number: numbe
All the data bytes that are to be transmitted are numbered and the beginning of this
numbering is arbitrary. Sequence numbers are given to the segments so as to reassemble the bytes at
the receiver end even if they arrive in a different order. Sequence number of a segment is the byte
number of the first byte that is being sent. Acknowledgement number is required since TCP provides
full duplex service. Acknowledgement number is
the next byte number that the receiver expects to
receive which also provides acknowledgement for
receiving the previous bytes.
Example:
Applications of UDP:
1. Used for simple request response communication when size of data is less and hence there
is lesser concern about flow and error control.
2. It is suitable protocol for multicasting as UDP supports packet switching.
3. UDP is used for some routing update protocols like RIP(Routing Information Protocol).
4. Normally used for real time applications which can not tolerate uneven delays between
sections of a received message.
5. Following implementations uses UDP as a transport layer protocol:
a) NTP (Network Time Protocol)
b) DNS (Domain Name Service)
c) BOOTP, DHCP.
d) NNP (Network News Protocol)
e) Quote of the day protocol
f) TFTP, RTSP, RIP.
6. Application layer can do some of the tasks through UDP-
a) Trace Route
b) Record Route
c) Time stamp
7. UDP takes datagram from Network Layer, attach its header and send it to the user. So, it
works fast.
8. Actually UDP is null protocol if you remove checksum field.
a) Reduce the requirement of computer resources.
b) When using the Multicast or Broadcast to transfer.
c) The transmission of Real-time packets, mainly in multimedia applications.
Page 21
Networking I Unit 4 (GZRSC) 2021
MCQ
2.Broadcasting applications like WHOD (who daemon on UNIX) uses what transport layer protocol?
a) TCP
b) UDP
c) Either TCP or UDP
d) IGMP
Solution-
Broadcasting and multicasting applications use UDP.
Page 22
Networking I Unit 4 (GZRSC) 2021
Thus, Option (B) is correct.
3.The transport layer protocols used for real time multimedia, file transfer, DNS and email,
respectively are:
(A) TCP, UDP, UDP and TCP
(B) UDP, TCP, TCP and UDP
(C) UDP, TCP, UDP and TCP
(D) TCP, UDP, TCP and UDP
Answer: (C)
Explanation: TCP (Transmission Control Protocol) and UDP(User Datagram Protocol) are two
main transport layer protocols.
TCP is connection oriented and UDP is connectionless, this makes TCP more reliable than UDP.
But UDP is stateless (less overhead), that makes UDP is suitable for purposes where error
checking and correction is less important than timely delivery.
For real time multimedia, timely delivery is more important than correctness. –> UDP
For file transfer, correctness is necessary. –> TCP
DNS, timely delivery is more important –> UDP
Email again same as file transfer –> TCP
4. Which of the following transport layer protocols is used to support electronic mail?
(A) SMTP
(B) IP
(C) TCP
(D) UDP
Answer: (C)
Explanation: E-mail uses SMTP as application layer protocol.
TCP and UDP are two transport layer protocols. SMTP uses TCP as transport layer protocol as TCP
is reliable.
Answer: (C)
Explanation:
UDP is a stateless ,connectionless and unreliable protocol.
HTTP needs connection to be established and thus,uses TCP.
Telnet is a byte stream protocol which again needs connection establishment ,thus uses TCP.
DNS needs request and response ,it needs a protocol in which a server can answer the small
queries of large number of users. As UDP is fast and stateless it is the most suitable protocol and
thus,it is used in DNS querying .
SMTP needs reliability and thus,uses TCP.
Page 23
Networking I Unit 4 (GZRSC) 2021
//………….//
DNS uses UDP.
HTTP, Telnet and SMTP uses TCP.
Thus, C is the correct choice.
Answer: (B)
Answer: (B)
Explanation: 1: with the help of TCP window=>flow control and with the help of congestion
window=> Congestion control
2: No field are there in UDP header to control flow or congestion
3: It is used by TCP to overcome the problem of out of order segments by re-transmission
4: Slow start, nothing to do with flow control
Page 24