I.P. Protocol AND Network Applications: Authors Mayur Patel Jitendra Shishangiya
I.P. Protocol AND Network Applications: Authors Mayur Patel Jitendra Shishangiya
I.P. Protocol AND Network Applications: Authors Mayur Patel Jitendra Shishangiya
I.P. PROTOCOL
AND
NETWORK
APPLICATIONS
Authors
Mayur Patel Jitendra Shishangiya
I.P. PROTOCOL AND NETWORK APPLICATIONS
The need for more addresses, in addition to other concerns about the IP
layer, motivated a new design of the IP layer called the new generation of IP
or IPv6 (IP version 6).
I.P. PROTOCOL AND NETWORK APPLICATIONS
In this version, the Internet addresses are 128 bits in length; this gives us a
maximum of 2128 addresses.
128-bit addresses give much greater flexibility in address allocation. These
addresses are referred to as IPv6 (IP version 6) addresses.
In this chapter, we first discuss IPv4 addresses, which are currently being
used in the Internet. We then discuss the IPv6 addresses, which may
become dominant in the future.
IP Protocol
IP protocol works at network layer, It is unreliable and connectionless
protocol. It doesn’t facilitate for error checking. It has neither error control nor flow
control. IP uses only error detection mechanism and discards the corrupted
packets.
IP does its best service for to packet transmission, but it doesn’t guarantee
for it. For data transmission, reliability is important; So IP must be paired with a
reliable protocol TCP.
1) IPV4
IPv4 addresses are unique and universal. They are unique in the sense that
each address defines one, and only one, connection to the Internet. Two devices on
the Internet can never have the same address at the same time.
Address Space
I.P. PROTOCOL AND NETWORK APPLICATIONS
IPv4 protocol defines several addresses has an 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 because each bit can have two
different values (0 or 1) N bits can have 2N values. IPv4 uses 32-bit addresses,
which means that the address space is 232 or 4,294,967,296 (more than 4 billion).
Dotted-Decimal Notation
To make the IPv4 address more compact and easier to read, Internet
addresses are usually written in decimal form with a decimal point (dot) separating
the bytes. Now, as we know IPv4 addresses are 32 bits long, these 32 bits can be
divided into 4 parts, each with 8 bits.
HPv4 Header
ToS: The ToS field could specify a datagram's priority and request a route for low-
delay, high-throughput, or highly-reliable service. Based on these ToS values, a
packet would be placed in a prioritized outgoing queue and take a route with
appropriate latency, throughput, or reliability.
In practice, the ToS field is not used widely.
Total Length: Length of entire IP Packet (including IP header and IP Payload)
Fragment Offset: This offset tells the exact position of the fragment in the original
IP Packet.
TTL: TTL stands for Time to Live. It is used to avoid looping in the network, every
packet is sent with some TTL value set, which tells the network how many routers
(hops) this packet can cross. At each hop, its value is decremented by one and
when the value reaches zero, the packet is discarded.
I.P. PROTOCOL AND NETWORK APPLICATIONS
0 4 8 16 31
Protocol: Tells the Network layer at the destination host, to which Protocol this
packet belongs to, i.e. the next level Protocol. For example protocol number of TCP
is 6, UDP is 17 and ICMP is 1.
Header Checksum: This field is used to keep checksum value of entire header
which is then used to check if the packet is received error-free.
Source Address: 32-bit address of the Sender (or source) of the packet.
Destination Address: 32-bit address of the Receiver (or destination) of the packet.
Options: This is an optional field, which is used if the value of IHL is greater than
5. These options may contain values for options such as Security, Record Route,
Time Stamp etc.
I.P. PROTOCOL AND NETWORK APPLICATIONS
2) IPv6
Internet Protocol version 6 (IPv6) is the latest version of the Internet
Protocol (IP). It provides an identification and location system for computers on
networks and routes traffic across the Internet. IPv6 was developed to deal with
the long-anticipated problem of IPv4 address exhaustion. As IPv6 uses 128 bits for
address, it allows 2128 different addresses.
In IPv6 new features are added. It has a large address space and a new
efficient header. IPv6 is intended to replace IPv4, which still carries more than 96%
of Internet traffic worldwide as of May 2014.
Every device on Internet is assigned an IP address for identification and
location definition. IPv6 provides other technical benefits in addition to a large
addressing space. The use of multicast addressing is expanded and simplified. It
also provides additional optimization for the delivery of services.
IPv6 addresses are represented by 8 groups of 4 hexadecimal digits,
separated by colons for ex. 3FFE:085B:1F1F:0000:0000:0000:00A9:1234. IPv6
header differs from IPv4 header. Figure 3 shows IPv6 Header. Various fields has
significant meaning in the header as given below.
Ver: It is a 4 bits version field. It is used to identify the version of the IP. Here, it is
set to 6.
Traffic class: This field is 4-bit priority field it defines the priority of the packet with
respect to traffic congestion. The traffic class field is used to distinguish between
packets with different real time delivery requirements.
Flow label: The flow label is a 3-byte (24-bit) field that is designed to provide
special handling for a particular flow of data. We will discuss this field later.
Payload length: The 2-byte payload length field defines the length of the IP
datagram excluding the base header.
Next header: The next header is an 8-bit field defining the header that follows the
base header in the datagram. The next header is either one of the optional
extension headers used by IP or the header of an encapsulated packet such as
UDP or TCP.
I.P. PROTOCOL AND NETWORK APPLICATIONS
0 4 12 31
40
Source IP Address (128 bits)
Bytes
Hop limit: It indicates maximum number of links over which IPv6 packet can travel
before being discarded. When the hope limit becomes 0, the packet is discarded.
This 8-bit hop limit field serves the same purpose as the TTL field in IPv4.
Source address: The source address field is a 128-bit Internet address that
identifies the original source of the datagram.
Thus, IPv6 header differs from that of IPv4 header. In IPv6 header some
fields are removed like Header length, total length, option field, header checksum
etc. while some fields are added to support routing, authentication, encapsulation
and Confidentiality. The difference between IPv4 and IPv6 are shown in Table 1.
I.P. PROTOCOL AND NETWORK APPLICATIONS
IPV4 IPV6
1) Source and Destination Addresses are 1) Source and Destination Addresses
32 bits long. are 128 bits long.
2) The header checksum is eliminated
2) It includes Header Checksum. because the checksum is provided by
upper-layer Protocols.
3) Header doesn’t include Options. But
3) Header includes Options.
Extension headers are available.
4) Header Length field is removed
4) Header Length field is there. (IHL) because the length of the header is
fixed in this version.
5) Time to Live Field is replaced by Hop
5) Time to Live Field is there. (TTL) Limit.
2 Addressing Schemes
The Two Parts of an IP Address
An IP address consists of two parts, one identifying the network and one
identifying the node, or host. The Class of the address determines which part
belongs to the network address and which part belongs to the node address. All
nodes on a given network share the same network prefix but must have a unique
host number.
Class A 0
Class B 10 For Unicasting
Class C
110
Class E Reserved
11110
Based on the initial bits for the IP address in various classes, Range of the
IP addresses also differs. It is shown in the in the table 2. The table also shows the
number of network bits, host bits and the maximum number of networks (without
sub netting) possible in each class.
Class A Network
As show in the table, In a Class A Network, there are 8 network bits and
address always starts with 0. Thus, first position in class A network is fixed. For
remaining 7 positions 27 = 128 no. of different networks can be constructed.
Therefore for the first byte, the decimal number can be anywhere from 0 to 127.
In class A network, first 8 bits identify the network and the remaining 24
bits indicate the host within the network. An example of a Class A IP address is
102.168.212.226, where "102" identifies the network and "168.212.226" identifies
the host on that network. Class A addresses are assigned to networks with a very
large number of hosts.
Reserved for
Class E 1111 240.0.0.0 to 255.255.255.255
Research and development
Note: Class A IP address 127.x.y.z is reserved for loopback testing and is used for
internal testing on the local machine.
I.P. PROTOCOL AND NETWORK APPLICATIONS
Class B Network
As show in the table, In a Class B Network, there are 16 network bits and
address always starts with 10. Thus, first two positions in class B network are
fixed. For remaining 14 positions 214 (= 16,384) no. of different networks can be
constructed. Therefore for the first byte the decimal number can be anywhere from
128 to 191.
In class B network, The first 16 bits (the first two octets) identify the
network and the remaining 16 bits indicate the host within the network. An
example of a Class B IP address is 168.212.226.204 where "168.212" identifies the
network and "226.204" identifies the host on that network. Class B addresses are
assigned to medium to large sized networks.
Class C Network
As show in the table, In a Class C Network, there are 24 network bits and
binary address always starts with 110. Thus, first three positions in class C
network are fixed. For remaining 21 positions 221 (= 16,384) no. of different
networks can be constructed. Therefore for the first byte the decimal number can
be anywhere from 192 to 223.
The first 24 bits (the first three octets) identify the network and the
remaining 8 bits indicate the host within the network. An example of a Class C IP
address is 200.168.212.226 where "200.168.212" identifies the network and "226"
identifies the host on that network. Class C addresses are used for small networks.
Class D Network
Class E Network
In a Class E Network, binary addresses start with 1111. Therefore for the
first byte, the decimal number can be anywhere from 240 to 255. Class E
I.P. PROTOCOL AND NETWORK APPLICATIONS
networks are used for experimentation. They have never been documented or
utilized in a standard way. An example of a Class E IP address is 240.240.240.240
Network Address
Network address is a special address that defines the network itself. It
cannot be assigned to any host. In network address all the host Id bits are zeros.
In other words network address is the first address of the block. A router can
route a packet based on the network address. Ex. 192.168.2.0 is a class C network
address and it supports up to 254 (28 -2) hosts. Two is subtracted because first
and last addresses (all 0s and all 1s) cannot be used. First address is assigned to
the network and the last address is reserved for special purpose.
Network Id → Host Id
10000000.10000000.00000000.0000000
Here, some of the last 16 host bits may be used as the subnet bits. To
create 2 subnets, 1 host bit can be used. Which can allow 32,766 hosts per
subnet.
Masking
When a router receives a packet with a destination address, it needs to
route a packet. The routing is based on the Network address and subnetwork
address. The routers outside the organization (network) routes the packet based
on Network Address. The router inside the organization routes the packet based on
subnetwork address.
How can a router find network address and subnetwork address? Here is
the answer: The network administrator knows the network address and
subnetwork address, but router doesn’t. So Router uses a process known as
‘Masking’.
Masking can be done with and without subnetting. If we have not subnetted
the network, masking extracts the network address from an IP address. If the
network is divided into several subnetworks then masking extracts the subnet
address from an IP address.
Class A – 255.0.0.0
Class B – 255.255.0.0
Class C – 255.255.255.0
I.P. PROTOCOL AND NETWORK APPLICATIONS
168.212.226.204 168.212.0.0
Mask
255.255.0.0
IP Address Network Address
168.212.226.204 168.212.226.0
Mask
255.255.255.0
IP Address Sub - Network Address
4 DNS
DNS stands for Domain Name System. To identify an entity, TCP/IP
protocols use the IP address, which uniquely identifies the connection of a host to
the Internet. However, people prefer to use names instead of numeric addresses.
Therefore, we need a system that can map a name to an address or an address to
a name. DNS does this mapping. DNS transfers the name into IP address. For
example if a user types “www.google.com”, DNS will map this site’s name into its IP
address.
top. The tree can have only 128 levels: level 0 (root) to level 127 (see Figure 2).
Each node in the tree has a label; the root label is a null string (empty string). DNS
requires that children of a node should have different labels, which guarantees the
uniqueness of the domain names.
A domain is a “sub tree of the domain name space”. The name of the
domain is the domain name of the node at the top of the sub tree.
“The information stored in the domain name spaces are distributed among
many computers called DNS servers”. The whole space is divided into many
domains based on the first level. As DNS allows domains to be divided further into
smaller domains (subdomains). Thus, we have a hierarchy of servers in the same
way that we have a hierarchy of names as shown in figure 9.
Root Server
A root server is a server whose zone (a name server) consists of the whole
tree. A root server usually does not store any information about domains but
delegates its authority to other servers, keeping references to those servers.
I.P. PROTOCOL AND NETWORK APPLICATIONS
Root
gtu.ac.in
DNS defines two types of servers: primary and secondary. A primary server
is a server that stores a file about the zone for which it is an authority. A
secondary server is a server that transfers the complete information about a zone
from another server (primary or secondary) and stores the file on its local disk. The
secondary server neither creates nor updates the zone files. If updating is required,
it must be done by the primary server, which sends the updated version to the
secondary server. The primary and secondary servers are both authoritative for the
zones they serve. When the secondary downloads information from the primary
server, it is called zone transfer.
I.P. PROTOCOL AND NETWORK APPLICATIONS
Types of DNS
The domain name space (tree) is divided into three different sections:
generic domains, country domains, and the inverse domain.
1) Generic Domains
Label Description
2) Country Domains
3) Inverse Domain
The server asks its resolver to send a query to the DNS server to map an
address to a name to determine if the client is on the authorized list. This type of
query is called an inverse or pointer query.
I.P. PROTOCOL AND NETWORK APPLICATIONS
To handle a pointer query, the inverse domain is added to the domain name
space with the first-level node called arpa. The second level is also one single node
named in-addr (for inverse address).
Root “.” Least Specific
. . . . . .
arpa edu com
In-addr
10 172
62 63 8
33 101 15
81 2 5
Most Specific
10.62.33.81 81.33.62.10.in-addr.arpa.
10.63.101.2 2.101.63.10.in-addr.arpa.
172.8.15.5 5.15.8.172.in-addr.arpa.
The rest of the domain defines IP addresses. The servers that handle the
inverse domain are also hierarchical. This means the netid part of the address
should be at a higher level than the subnetid part, and the subnetid part higher
than the hostid part. This configuration makes the domain look inverted. The
figure 10 illustrates the inverse domain.
5 Email
One of the most popular Internet services is electronic mail (e-mail). Its
architecture consists of several components. At the beginning of the Internet era,
the messages sent by electronic mail were short and consisted of text only.
E-mail system includes the three main components: user agent, message
transfer agent, and message access agent.
User Agent
User Agent
1) Reading Messages
2) Composing Messages
A user agent allows users to compose the e-mail message to be sent out.
Most user agents provide a template on the screen to be filled in by the user. Some
even have a built-in editor that can do spell checking, grammar checking, and
other tasks expected from a sophisticated word processor.
A user, of course, could alternatively use his or her favorite text editor or
word processor to create the message and import it, or cut and paste it, into the
user agent template.
3) Replying to Messages
After reading a message, a user can use the user agent to reply to a
message. A user agent usually allows the user to reply to the original sender or to
reply to all recipients of the message. The reply message may contain the original
message (for quick reference) and the new message.
4) Forwarding Messages
5) Handling Mailboxes
A user agent normally creates two mailboxes: an inbox and an outbox. Each
box is a file with a special format that can be handled by the user agent. The inbox
keeps all the received e-mails until they are deleted by the user.
The outbox keeps all the sent e-mails until the user deletes them. Most user
agents today are capable of creating customized mailboxes.
Sending Mail
Header Meaning
To: E-mail addresses of primary recipient(s)
Cc: E-mail addresses of secondary recipient(s)
Bcc: E-mail addresses for blind carbon copies
From: Person or people who created the message
Sender: E-mail address of the actual sender
To: The e-mail addresses of the primary recipients are written in this field.
Cc: Carbon copy : E-mail addresses of secondary recipient(s) are written here.
Many email clients will mark email in one’s inbox differently depending on whether
they are in To: or Cc: list.
E-mail envelope usually contains the sender and the receiver addresses.
Message The message contains the header and the body. The header of the
message defines the sender, the receiver, the subject of the message, and some
other information. The body of the message contains the actual information to be
read by the recipient.
I.P. PROTOCOL AND NETWORK APPLICATIONS
Receiving Mail
The user agent is triggered by the user (or a timer). If a user has mail, the
VA informs the user with a notice. If the user is ready to read the mail. A list is
displayed in which each line contains a summary of the information about a
particular message in the mailbox. The summary usually includes the sender mail
address, the subject, and the time the mail was sent or received. The user can
select any of the messages and display its contents on the screen.
6 FTP
Transferring files from one computer to another is one of the most common
tasks expected from a networking or internetworking environment. FTP is a
popular protocol involved in transferring files. FTP stands for File Transfer
Protocol.
Figure 12 shows the basic model of FTP. The client has three components:
user interface, client control process, and the client data transfer process. The
server has two components: the server control process and the server data transfer
I.P. PROTOCOL AND NETWORK APPLICATIONS
process. The control connection is made between the control processes. The data
connection is made between the data transfer processes.
User
Interface
Client Server
Figure 12 FTP
The control connection remains connected during the entire interactive FTP
session. The data connection is opened and then closed for each file transferred. It
opens each time commands that involve transferring files are used, and it closes
when the file is transferred. In other words, when a user starts an FTP session, the
control connection opens. While the control connection is open, the data
connection can be opened and closed multiple times if several files are transferred.
Trivial FTP
TFTP stands for Trivial File Transfer Protocol. It is very simple to implement.
One of its primary uses is in the early stages of nodes booting from a Local Area
Network. TFTP allows only unidirectional transfer of files. It doesn’t provide
authentication. TFTP depends on UDP, requires less overhead and provides
virtually no control. TFTP uses UDP port number 69 for file transfer. Table 5
shows the difference between FTP and TFTP.
I.P. PROTOCOL AND NETWORK APPLICATIONS
FTP TFTP
1) File Transfer Protocol 1) Trivial File Transfer Protocol
2) FTP is more complex than TFTP. 2) Very simple to implement.
3) One of its primary uses is in the
3) FTP is a complete, session-oriented,
early stages of nodes booting from a
general purpose file transfer protocol
Local Area Network.
4) TFTP allows only unidirectional
4) FTP can ne used interactively.
transfer of files.
5) FTP provides authentication. 5) TFTP doesn’t provide authentication
6) TFTP depends on UDP, requires less
6) FTP depends on TCP, is connection,
overhead and provides virtually no
and provides reliable control
control.
7) FTP uses well known TCP port
7) TFTP uses UDP port number 69 for
numbers: 20 for data, 21 for
file transfer.
connection dialog.
7 HTTP
The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to access
data on the World Wide Web. HTTP functions as a combination of FTP and SMTP.
It is similar to FTP because it transfers files and uses the services of TCP. However,
it is much simpler than FTP because it uses only one TCP connection. There is no
separate control connection; only data are transferred between the client and the
server.
HTTP is like SMTP because the data transferred between the client and the
server look like SMTP messages. In addition, the format of the messages is
controlled by MIME-like headers.
Unlike SMTP, the HTTP messages are not destined to be read by humans;
they are read and interpreted by the HTTP server and HTTP client (browser). SMTP
messages are stored and forwarded, but HTTP messages are delivered immediately.
I.P. PROTOCOL AND NETWORK APPLICATIONS
The commands from the client to the server are embedded in a request message.
The contents of the requested file or other information are embedded in a response
message. HTTP uses the services of TCP on well-known port 80.
HTTP Transaction
Figure 13 illustrates the HTTP transaction between the client and server.
Although HTTP uses the services of TCP, HTTP itself is a stateless protocol. The
client initializes the transaction by sending a request message. The server replies
by sending a response.
The formats of the request and response messages are similar; both are
shown in Figure 14. A request message consists of a request line, a header, and
sometimes a body.
The first line in a request message is called a request line; the first line in
the response message is called the status line.
Request type: This field is used in the request message. In version 1.1 of
HTTP, several request types are defined. The request type is categorized into
methods as defined in Table 6.
I.P. PROTOCOL AND NETWORK APPLICATIONS
Method Action
GET Requests a document from the server
HEAD Requests information about a document but not the document itself
POST Sends some information from the client to the server
PUT Sends a document from the server to the client
TRACE Echoes the incoming request
CONNECT Reserved
OPTION Inquires about available options
********
This is an authorized free edition from
www.obooko.com
Although you do not have to pay for this e-book, the author’s intellectual property
rights remain fully protected by international Copyright law. You are licensed to use
this digital copy strictly for your personal enjoyment only: it must not be
redistributed commercially or offered for sale in any form. If you paid for this free
edition, or to gain access to it, we suggest you demand an immediate refund and
report the transaction to the author and obooko.