You are on page 1of 17

NETWORK PROGRAMMING

MT-24C

ASSIGNMENT-1

1
Q.1 Explain the OSI Reference Model?

The OSI model is based on a proposal developed by the International Standards


Organisation as a first step towards international standardisation of the protocols
used in the various layers. The model is called the ISO - OSI (International
Standard Organisation - Open Systems Interconnection) Reference Model
because it deals with connecting open systems — that is, systems that follow the
standard are open for communication with other systems, irrespective of
manufacturer.

Its main objectives were to:

(i) Allow manufacturers of different systems to interconnect equipment through


standard interfaces.
(ii) Allow software and hardware to integrate well and be portable on different
systems.

The OSI model has seven layers shown in Figure 2. The principles that were
applied to arrive at the seven layers are as follows:

1. Each layer should perform a well-defined function.


2. The function of each layer should be chosen with an eye toward defining
internationally standardized protocols.
3. The layer boundaries should be chosen to minimize the information flow
across the interfaces.

The set of rules for communication between entities in a layer is called protocol
for that layer. The seven layers of ISO OSI reference model are:
(a) Physical Layer
(b) Data Link Layer
(c) Network Layer
(d) Transport Layer
(e) Session Layer
(f) Presentation Layer
(g) Application Layer.

The Physical Layer


Physical Layer defines electrical and mechanical specifications of cables,
connectors and signaling options that physically links two nodes on a network.

The Data Link Layer


The main task of the data link layer is to provide error free transmission. It
accomplishes this task by having the sender configure the input data into data
frames, transmit the frames sequentially, between network devices and process
the acknowledgement frames sent back by the intermediate receiver.
The data link layer creates and recognises frame boundaries. This can be
accomplished by attaching special bit patterns to the beginning and end of the
frame. Since these bit patterns can accidentally occur in the data, special care
must be taken to make sure these patterns are not incorrectly interpreted as
frame boundaries.

2
The Network Layer
Whereas the datalink layer is responsible for delivery on a hop, the network
layer ensures that each packet travels from its sources to destination
successfully and efficiently. A key design issue is determining how packets are
routed from source to destination. Routes can be based on static tables that are
“wired into” the network and rarely changed. They can also be determined at
the start of each conversation, for example a terminal session. Finally, they can
be highly dynamic, being determined anew for each packet, to reflect the
current network load. When a packet has to travel from one network to another
to get its destination, many problems can arise. The addressing used by the
second network may be different from the first one. The second network one
may not accept the packet at all because it is too large. The protocols may
differ, and so on. It is up to the network layer to overcome all these problems to
allow heterogeneous networks to be interconnected.

The Transport Layer


The basic function of the transport layer is to accept data from the session layer,
split it up into smaller units if need be, pass these to the network layer, and
ensure that the pieces all arrive correctly at the other end. Furthermore, all this
3
must be done efficiently, and in a way that isolates the upper layers from the
inevitable changes in the hardware technology. Transport Layer provides
location and media independent end-to-end data transfer service to session and
upper layers.

The Session Layer


The main tasks of the session layer is to provide:
-Session Establishment
-Session Release – Orderly or abort
-Synchnonization
-Data Exchange
-Expedited Data Exchange.

The session layer allows users on different machines to establish sessions


between them. A session allows ordinary data transport, as does the transport
layer, but it also provides enhanced services useful in some applications. A
session might be used to allow a user to log into a remote timesharing system or
to transfer a file between two machines.

One of the services of the session layer is to manage dialogue control. Sessions
can allow traffic to go in both directions at the same time, or in only one
direction at a time. If traffic can only go one way at a time (analogous to a single
railroad track), the session layer can help keep track of whose turn it is. A
related session service is token management. For some protocols, it is essential
that both sides do not attempt the same operation at the same time. To manage
these activities, the session layer provides tokens that can be exchanged. Only
the side holding the token may perform the desired operation. Another session
service is synchronization. Consider the problem that might occur when trying to
do a 2 hour file transfer between two machines with a 1 hour mean time
between crashes. After each transfer was aborted, the whole transfer would
have to start over again and would probably fail again the next time as well. To
eliminate
this problem, the session layer provides a way to insert markers after the
appropriate checkpoints.

The Presentation Layer


Unlike all the lower layers, which are just interested in moving bits reliably from
here to there, the presentation layer is concerned with the syntax and semantics
of the information transmitted.

A typical example of a presentation service is encoding data in a standard


agreed upon way. Most user programs do not exchange random binary bit
strings, they exchange things such as people’s names, dates, amounts of money
and invoices. These items are represented as character strings, integers,
floating-point number, and data structures composed of several simpler items.
Different computers have different codes for representing character strings (e.g.,
ASCII and Unicode), integers (e.g., one’s complement and two’s complement),
and so on. In order to make it possible for computers with different
representations to communicate, the data structure to be exchanged can be
defined in an abstract way, along with a standard encoding to be used “on the
wire”. The presentation layer manages these abstract data structure and
converts from the representation used inside the computer to the network
standard representation and back.

Application Layer
4
Application Layer supports functions that control and supervise OSI application
processes such as start/maintain/stop application, allocate/deallocate OSI
resources, accounting, check point and recovering. It also supports remote job
execution, file transfer protocol, message transfer and virtual terminal.

Q.2 Explain the internet control message protocol (ICMP).

The Internet Control Message Protocol (ICMP) is part of the internet protocol
suite and defined in RFC 792. ICMP messages are typically generated in
response to errors in IP datagrams (as specified in RFC1122) or for diagnostic or
routing purposes.

Although ICMP messages are contained within standard IP datagrams, ICMP


messages are usually processed as a special case distinguished from normal IP
processing, rather than processed as a normal sub-protocol of IP. In particular,
ICMP messages should never be generated as a consequence of ICMP message
processing, in order to prevent cascades of ICMP messages.

Many commonly used network utilities are based on ICMP messages. The ping
utility (well known on Unix) is implemented using the ICMP "Echo" and "Echo
reply" messages. The related traceroute command is implemented by
transmitting UDP datagrams with manipulated IP Time-to-live (TTL) header fields
and looking for ICMP "Time to live exceeded in transit" and "Destination
unreachable" messages in response. Every machine (such as intermediate
routers) that forwards an IP datagram has to decrement the TTL by one. If the
TTL reaches 0, an ICMP "Time to live exceeded in transit" message is sent to the
source of the datagram.

Each ICMP message is encapsulated directly within a single IP datagram and


thus, like UDP, ICMP does not guarantee delivery.

List of permitted control messages:


0 - Echo Reply
3 - Destination Unreachable
4 - Source Quench
5 - Redirect
8 - Echo Request
9 - Router Advertisement
10 - Router Solicitation
11 - Time Exceeded
12 - Parameter Problem
13 - Timestamp
14 - Timestamp Reply
15 - Information Request
16 - Information Reply
17 - Address Mask Request
18 - Address Mask Reply
19 - Reserved for security
20-29 - Reserved for robustness experiment
30 - Traceroute
31 - Datagram Conversion Error
32 - Mobile Host Redirect
33 - IPv6 Where-Are-You
34 - IPv6 Here-I-Am

5
35 - Mobile Registration Request
36 - Mobile Registration Reply
37 - Domain Name Request
38 - Domain Name Reply
39 - SKIP
40 - Photuris
41-255 – Reserved

Q.3 Explain UDP. State the difference between TCP and UDP.
TCP is a Transmission Control Protocol. UDP is a User Datagram Protocol.
1. TCP(Transmission Control Protocol): TCP is a connection-oriented
protocol, a connection can be made from client to server, and from then on any
data can be sent along that connection.

Reliable - when you send a message along a TCP socket, you know it will get
there unless the connection fails completely. If it gets lost along the way, the
server
will re-request the lost part. This means complete integrity, things don't get
corrupted.

Ordered - if you send two messages along a connection, one after the other,
you know the first message will get there first. You don't have to worry about
data
arriving in the wrong order.

Heavyweight - when the low level parts of the TCP "stream" arrive in the wrong
order, resend requests have to be sent, and all the out of sequence parts have to
be put back together, so requires a bit of work to piece together.

2. UDP(User Datagram Protocol) : A simpler message-based connectionless


protocol. With UDP you send messages(packets) across the network in chunks.
Unreliable - When you send a message, you don't know if it'll get there, it could
get lost on the way.

Not ordered - If you send two messages out, you don't know what order they'll
arrive in.

Lightweight - No ordering of messages, no tracking connections, etc. It's just


fire and forget! This means it's a lot quicker, and the network card / OS have to
do very little work to translate the data back from the packets
TCP UDP
TCP can establishes a Connection UDP cannot.
TCP provides a stream of unlimited UDP sends small packets.
length
TCP gurantees that as long as you have UDP provides not guarantee delivery.
a connection data sent will arrive at
the destination,
UDP is faster for sending small
amounts of data since no connection
setup is required, the data can be sent
in less

6
time then it takes for TCP to establish a
connection.

Q.4 Explain the process of connection establishment.

To establish a connection, each device must send a SYN and receive an ACK for
it from the other device. Thus, conceptually, we need to have four control
messages pass between the devices. However, it's inefficient to send a SYN and
an ACK in separate messages when one could communicate both
simultaneously. Thus, in the normal sequence of events in connection
establishment, one of the SYNs and one of the ACKs is sent together by setting
both of the relevant bits (a message sometimes called a SYN+ACK). This makes
a total of three messages, and for this reason the connection procedure is called
a three-way handshake.
Connection Establishment Functions

The connection establishment process actually accomplishes several things as it


creates a connection suitable for data exchange:

o Contact and Communication: The client and server make contact with
each other and establish communication by sending each other
messages. The server usually doesn’t even know what client it will be
talking to before this point, so it discovers this during connection
establishment.

o Sequence Number Synchronization: Each device lets the other know


what initial sequence number it wants to use for its first transmission.

o Parameter Exchange: Certain parameters that control the operation of


the TCP connection are exchanged by the two devices.

Table 152: TCP “Three-Way Handshake” Connection Establishment Procedure


Client Server
Move To Move To
Start State Action Start State Action
State State
The client
cannot do
The server
anything until
performs a
the server has
passive OPEN,
performed a
creating a
passive OPEN
transmission
and is ready to
control block
accept a
CLOSED — CLOSED (TCB) for the LISTEN
connection.
connection and
(Well, it can
readying itself for
try, but
the receipt of a
nothing will be
connection
accomplished
request (SYN)
until the
from a client.
server is
ready.)
CLOSED Step #1 SYN-SENT LISTEN The server waits —
Transmit: for contact from a
The client client.
7
performs an
active OPEN,
creating a
transmission
control block
(TCB) for the
connection
and sending a
SYN message
to the server.
Step #1
Receive, Step
#2 Transmit:
The client The server
waits to receives the SYN
receive an from the client. It
ACK to the sends a single SYN-
SYN-SENT — LISTEN
SYN it has SYN+ACK RECEIVED
sent, as well message back to
as the server's the client that
SYN. contains an ACK
for the client's
SYN, and the
server's own SYN.
Step #2
Receive,
Step #3
Transmit:
The client
receives from
the server the
SYN+ACK
containing the
ACK to the The server waits
client's SYN, SYN- for an ACK to the
SYN-SENT ESTABLISHED —
and the SYN RECEIVED SYN it sent
from the previously.
server. It
sends the
server an ACK
for the
server's SYN.
The client is
now done with
the connection
establishment.
The client is Step #3
waiting for the Receive: The
server to finish server receives
connection SYN- the ACK to its
ESTABLISHED ESTABLISHED
establishment RECEIVED SYN and is now
so they can done with
operate connection
normally. establishment.
The client is
The server is
ready for
ready for normal
ESTABLISHED normal data ESTABLISHED
data transfer
transfer
operations.
operations.

8
Q.5 What is I/O multiplexing?

In communication, Multiplexing is a technique that transmits signals from


several sources over a single communication channel. So in order to minimize
the cost of communication bearer, various techniques of sharing a
communication channel between several users have been devised. These are
known as multiplexing techniques. In this section we will discuss about two
multiplexing techniques viz.
time and frequency division multiplexing .

Frequency Division Multiplexing (FDM)


In FDM the frequency spectrum is divided to form logical channels with each
user having exclusive possession of the assigned channel.

Time Division Multiplexing (TDM)


In TDM, the users take turns (in a round robin), each one is periodically getting
the entire bandwidth for the allotted time.

Television broadcasting provides an example of multiplexing. Each TV channel


operates in a different frequency range, which is a portion of the allocated
spectrum, with the inter-channel separation great enough to prevent
interference. This system is an example of FDM. During the transmission of any
program (Serial/film), there is an advertisement as well. These two alternate in
time on the same frequency. This is an example of TDM

Q.6 What is direct and indirect routing?

Direct routing : When a machine can send an IP packet to another machine


without going through a third machine, the route the packet will travel is said to
be a ``direct route'' and the selection of that route is called ``direct routing''. In
``Example internetwork'', the machine columbia can trace a direct route to any
of the machines on the 10.0.118 network (that is, seine, thames, and volga). The
machine columbia cannot reach london or paris directly.

9
Example internetwork

Indirect routing
When a machine wishing to send an IP packet to a second machine must
send that packet through a third machine, the route the packet will travel
is said to be an ``indirect route'' and the selection of the intermediary
machine is called ``indirect routing''. The intermediary machine, a router,
has connections to more than one network and is said to provide a
gateway between the networks. Therefore, a router may also be called a
``network gateway''. In ``Example internetwork'', the machine volga is a
network gateway between the 10.0.118 network and the 10.0.246
network. If the machine seine needs to send an IP packet to paris, it must
send the packet to volga, which forwards the packet to paris.

Sometimes the source and destination hosts are more than one network
away from each other.

Q.7 Explain routing algorithms?

Many routing algorithms are used in computer networks. Static algorithms


include shortest path routing, flooding, and flow – based routing. Dynamic
algorithms include distance vector routing and link state routing. Most actual
networks use one of these. Other important routing topics are hierarchical
routing, routing for mobile hosts, broadcast routing, and multicast routing.

The function of the network layer is routing packets from the source machine to
the destination machine. In most subnets, packets will require multiple hops to
10
reach the destination. The only notable exception is for broadcast networks, but
even here routing is an issue if the source and destination are not on the same
network. The algorithms that choose the routes and the data structures that
they use are a major area of network layer design.

The routing algorithm is that part of the network layer software responsible for
deciding which output line an incoming packet should be transmitted on.
Regardless of whether routes are chosen independently for each packet or only
when new connection are established, there are certain properties that are
desirable in a routing algorithm: correctness, simplicity, robustness, stability,
fairness and optimality.

Stability is an important goal for the routing algorithm. Routing algorithms can
be grouped into two major classes: non-adaptive and adaptive. Non-adaptive
algorithms do not base their routing decisions on measurements or estimates of
the current traffic and topology. Instead, the choice of the route to use to get
form I to J is computed in advance, off-line, and downloaded to the routers when
the network is booted. This procedure is sometimes called static routing

Adaptive algorithms, in contrast, change their routing decisions to reflect


changes in the topology, and usually the traffic as well. Adaptive algorithms
differ in where they get their information (e. g., every sec, when the load
changes, or when the topology changes), and what metric (measure) is used for
optimisation (e.g., distance, number of hops, or estimated transit time). In the
following sections we will introduce a variety of routing algorithms, both static
and dynamic.

Shortest Path Routing


Let us begin our study of routing algorithms with a technique that is widely used
in many forms because it is simple and easy to understand. The idea is to build a
graph of the subnet, with each node of the graph represent ing a router and
each arc of the representing a communication line. To choose a route between a
given pair of routers, the algorithm just finds the shortest path between them on
the graph. One-way of measuring path length is the number of hops.

Flooding
Another static algorithm is flooding, in which every incoming packet is sent out
on every outgoing line except the one it arrived on. Flooding obviously generates
vast numbers of duplicate packets, in fact an infinite number unless some
measure are taken, but it is one of the simplest routing algorithm. Routers need
to communicate with other routers so they can exchange routing information.
Most network operating systems have associated routing protocols which
support the transfer of routing information. Typical routing protocols and their
associated network protocol stakes are:

• BGP (Border Gateway Protocol) – TCP/IP.


• EGP(Exterior Gateway Protocol)-TCP/IP.
• IS-IS (Immediate System to Intermediate Systems)-DECnet, OSI.
• NLSP (NetWare Link state Protocol) – Net Ware 4.1.
• OSPF (Open Shortest Path First) –TCP/IP.
• RIP (Routing Information Protocols) – XNS, Net Ware, TCP/IP.
• RTMP (Routing Table Maintenance Protocol) – Apple Talk.

11
Q.8 What is the difference b/w OSI Reference Model and TCP/IP
Reference Model?

The open systems interconnection (OSI) reference model describes how


information from a software application in one computer moves through a
network medium to a software application in another computer. The OSI
reference model is a conceptual model composed of seven layers, each
specifying particular network functions.

As in the OSI model, data is passed down the stack when it is being sent to the
network and up the stack when it is being received from the network. The four-
layered structure of TCP/IP is seen in the way data is handled as it passes down
the protocol stack from the application layer to the underlying physical network.
Important differences are:
OSI Reference Model TCP Reference Model

1. Seven layers 1. 4 layers

2. It distinguishes between service, 2. Did not clearly distinguish between


interface, protocol. service, interface and protocol.

3. Firstly description of model and 3. Protocol comes first and description


protocol came next of model later.

4. Both have Network 4. Transport and Application layer.

5. Supports connectionless and 5. TCP/1P has only one mode in


connection oriented communication in
Network layer (connection less) but
network layer and only connection-
oriented communication in transport supports both modes in Transport
layer. layer.

6. Protocol in OSI model are better 6. Protocols in TCP/IP are not hidden
hidden and can be replaced relatively
and thus cannot be replaced easily.
easily (No Transparency).
(Transparency)

Q.9 Draw and explain IP V-4 Packet format?

Internet Protocol version 4 (IPv4) is the fourth revision in the development of


the Internet Protocol (IP) and it is the first version of the protocol to be widely
deployed. Together with IPv6, it is at the core of standards-based
internetworking methods of the Internet. IPv4 is still by far the most widely
deployed Internet Layer protocol, as IPv6 is still in its infancy of deployment.

IPv4 is a connectionless protocol for use on packet-switched Link Layer networks


(e.g., Ethernet). It operates on a best effort delivery model, in that it does not
guarantee delivery, nor does it assure proper sequencing, or avoid duplicate
delivery. These aspects, including data integrity, are addressed by an upper
layer transport protocol (e.g., Transmission Control Protocol).

An IP packet consists of a header section and a data section.

12
Header : The IPv4 packet header consists of 13 fields, of which 12 are required.
The 13th field is optional (red background in table) and aptly named: options. The
fields in the header are packed with the most significant byte first, and for the
diagram and discussion, the most significant bits are considered to come first.
The most significant bit is numbered 0, so the version field is actually found in
the four most significant bits of the first byte, for example.
bit offset 0-3 4-7 8-15 16-18 19-31
0 Version Header length Differentiated Total Length
Services
32 Identification Flags Fragment Offset
64 Time to Live Protocol Header Checksum
96 Source Address
128 Destination Address
160 Options ( if Header Length > 5 )
160 or 192+
Data

Version : The first header field in an IP packet is the four-bit version field. For
IPv4, this has a value of 4 (hence the name IPv4).

Internet Header Length (IHL) :The second field (4 bits) is the Internet Header
Length (IHL) telling the number of 32-bit words in the header. Since an IPv4
header may contain a variable number of options, this field specifies the size of
the header (this also coincides with the offset to the data). The minimum value
for this field is 5 (RFC 791), which is a length of 5×32 = 160 bits. Being a 4-bit
value, the maximum length is 15 words (15×32 bits) or 480 bits.

Differentiated Services (DS) :Originally defined as the TOS field, this field is
now defined by RFC 2474 for Differentiated services (DiffServ) and by RFC 3168
for Explicit Congestion Notification (ECN), matching IPv6. New technologies are
emerging that require real-time data streaming and therefore will make use of
the DS field. An example is Voice over IP (VoIP) that is used for interactive data
voice exchange.

The original intention of the Type of Services (TOS) field was for a sending host
to specify a preference for how the datagram would be handled as it made its
way through an internet. For instance, one host could set its IPv4 datagrams'
TOS field value to prefer low delay, while another might prefer high reliability. In
practice, the TOS field was not widely implemented. However, a great deal of
experimental, research and deployment work has focused on how to make use
of these eight bits, resulting in the current DS field definition.

As defined in RFC 791, the following eight bits were allocated to a Type of
Service (TOS) field:

• bits 0-2: Precedence (111 - Network Control, 110 - Internetwork Control,


101 - CRITIC/ECP, 100 - Flash Override, 011 - Flash, 010 - Immediate, 001 -
Priority, 000 - Routine)
• bit 3: 0 = Normal Delay, 1 = Low Delay
• bit 4: 0 = Normal Throughput, 1 = High Throughput
• bit 5: 0 = Normal Reliability, 1 = High Reliability
• bit 6: 0 = Normal Cost, 1 = Minimize Monetary Cost (defined by RFC 1349)
• bit 7: never defined

13
Total Length : This 16-bit field defines the entire datagram size, including
header and data, in bytes. The minimum-length datagram is 20 bytes (20-byte
header + 0 bytes data) and the maximum is 65,535 — the maximum value of a
16-bit word. The minimum size datagram that any host is required to be able to
handle is 576 bytes, but most modern hosts handle much larger packets.
Sometimes subnetworks impose further restrictions on the size, in which case
datagrams must be fragmented. Fragmentation is handled in either the host or
packet switch in IPv4

Identification : This field is an identification field and is primarily used for


uniquely identifying fragments of an original IP datagram. Some experimental
work has suggested using the ID field for other purposes, such as for adding
packet-tracing information to datagrams in order to help trace back datagrams
with spoofed source addresses.

Flags : A three-bit field follows and is used to control or identify fragments. They
are (in order, from high order to low order):

• Reserved; must be zero. As an April Fools joke, proposed for use in RFC
3514 as the "Evil bit".
• Don't Fragment (DF)
• More Fragments (MF)

If the DF flag is set and fragmentation is required to route the packet then the
packet will be dropped. This can be used when sending packets to a host that
does not have sufficient resources to handle fragmentation.

When a packet is fragmented all fragments have the MF flag set except the last
fragment, which does not have the MF flag set. The MF flag is also not set on
packets that are not fragmented — an unfragmented packet is its own last
fragment.

Fragment Offset : The fragment offset field, measured in units of eight-byte


blocks, is 13 bits long and specifies the offset of a particular fragment relative to
the beginning of the original unfragmented IP datagram. The first fragment has
an offset of zero. This allows a maximum offset of (2 13 - 1) × 8 = 65,528 which
would exceed the maximum IP packet length of 65,535 with the header length
included.

Time To Live (TTL) : An eight-bit time to live (TTL) field helps prevent
datagrams from persisting (e.g. going in circles) on an internet. This field limits a
datagram's lifetime. It is specified in seconds, but time intervals less than 1
second are rounded up to 1. In latencies typical in practice, it has come to be a
hop count field. Each packet switch (or router) that a datagram crosses
decrements the TTL field by one. When the TTL field hits zero, the packet is no
longer forwarded by a packet switch and is discarded. Typically, an ICMP
message (specifically the time exceeded) is sent back to the sender that it has
been discarded. The reception of these ICMP messages is at the heart of how
traceroute works.

Protocol : This field defines the protocol used in the data portion of the IP
datagram. The Internet Assigned Numbers Authority maintains a list of Protocol
numbers which was originally defined in RFC 790. Common protocols and their
decimal values are shown below

14
Header Checksum : The 16-bit checksum field is used for error-checking of the
header. At each hop, the checksum of the header must be compared to the
value of this field. If a header checksum is found to be mismatched, then the
packet is discarded. Note that errors in the data field are up to the encapsulated
protocol to handle — indeed, both UDP and TCP have checksum fields.

Since the TTL field is decremented on each hop and fragmentation is possible at
each hop then at each hop the checksum will have to be recomputed. The
method used to compute the checksum is defined within RFC 1071:

The checksum field is the 16-bit one's complement of the one's complement
sum of all 16-bit words in the header. For purposes of computing the checksum,
the value of the checksum field is zero.

In other words, all 16-bit words are summed together using one's complement
(with the checksum field set to zero). The sum is then one's complemented and
this final value is inserted as the checksum field.

For example, use Hex 45000030442240008006442e8c7c19acae241e2b


(20Bytes IP header) :

4500 + 0030 + 4422 + 4000 + 8006 + 0000 + 8c7c + 19ac + ae24 + 1e2b =
2BBCF 2 + BBCF = BBD1 = 1011101111010001, the 1'S of sum =
0100010000101110 = 442E

To validate a header's checksum the same algorithm may be used - the


checksum of the header with the checksum field filled in should be a word
containing all zeros (value 0).

Source address : An IPv4 address is a group of four octets for a total of 32 bits.
The value for this field is determined by taking the binary value of each octet
and concatenating them together to make a single 32-bit value.

For example, the address 10.9.8.7 would be


00001010000010010000100000000111.

This address is the address of the sender of the packet. Note that this address
may not be the "true" sender of the packet due to network address translation.
Instead, the source address will be translated by the NATing machine to its own
address. Thus, reply packets sent by the receiver are routed to the NATing
machine, which translates the destination address to the original sender's
address.

Destination address : Identical to the source address field but indicates the
receiver of the packet.

Options : Additional header fields may follow the destination address field, but
these are not often used. Note that the value in the IHL field must include
enough extra 32-bit words to hold all the options (plus any padding needed to
ensure that the header contains an integral number of 32-bit words). The list of
options may be terminated with an EOL (End of Options List, 0x00) option; this is
only necessary if the end of the options would not otherwise coincide with the
end of the header. The possible options that can be put in the header are as
follows:

15
Field Size (bits) Description
Copied 1 Set to 1 if the options need to be copied into all
fragments of a fragmented packet.
Option Class 2 A general options category. 0 is for "control"
options, and 2 is for "debugging and
measurement". 1, and 3 are reserved.
Option Number 5 Specifies an option.
Option Length 8 Indicates the size of the entire option (including
this field). This field may not exist for simple
options.
Option Data Variable Option-specific data. This field may not exist for
simple options.

• Note: If the Header Length is greater than 5, i.e. it is between 6-15, it


means that the Options field is present and must be considered.
• Note: the Copied, Option Class, and Option Number are sometimes
referred to as a single eight-bit field - the Option Type.

The use of the LSRR and SSRR options (Loose and Strict Source and Record
Route) is discouraged because they create security concerns; many routers
block packets containing these options

Q.10 Draw and explain TCP segment data format?

16
TCP provides a highly reliable, connection oriented, end-to-end transport service
between processes in end systems connected to the subnet. TCP assumes that
the layer below offers an unreliable datagram service. TCP provides the types of
facility associated with the ISO Class 4 transport service, including error
recovery, sequencing of packets, flow control by the windowing method, and the
support of multiplexed connections from the layer above

Format of TCP Header : The sender’s TCP layer communicates with the
receiver’s TCP layer using the TCP protocol data unit. It defines parameters such
as the source port, destination port, sequence number and so on. It is described
below:

• Source and destination port number – which are 16 bit values to identify the
local port number.
• Sequence number – which identifies the current sequence number of the data
segment. This allows the receiver to keep track of the data segments
received. Any segments that are missing can be easily identified.
• Data offset – which is a 32-bit value and identifies the start of the data.
• Flags the flag field is defined as UAPRSE, where U is the urgent Flag, A the
acknowledgment flag, P the push function, R the reset flag, S the sequence
synchronise flag and F the end – of transmission flag.
• Windows – which is a 16 bit value and gives the number of data blocks that
the receiving host can accept at a time.
• Checksum – which is a 16 bit checksum for the data and header. UrgPtr –
which is the urgent pointer and is used to identify an important area of data.

***

17

You might also like