Sunteți pe pagina 1din 85

QB on IT for TY BSc.

(IT)

Question Bank
on
Internet Technology

Specially designed for


Sixth Semester B.Sc. (IT) Students

These notes are prepared for student’s personal use.


Any commercial use of this material is strictly prohibited.

© vinod vaze
QB on IT for TY BSc. (IT)

Guide to solution code


Sr. No. Chapter
Starting
with:

001 TCP / IP (Transmission Control / Internet protocol)

101 ARP (Address Resolution Protocol)

201 RARP (Reverse Address Resolution Protocol)

301 RIP (Routing Information Protocol)

401 OSPF (Open Shortest Path First) Protocol

501 BGP (Border Gateway Protocol)

601 Socket Programming (using TCP and UDP socket)

701 RMI (Remote Method Invocation)

801 CORBA

901 Wireless LAN

© vinod vaze
QB on IT for TY BSc. (IT)

TCP / IP (Transmission Control /


Internet protocol)

001 What is fragmentation? Why is it required to fragment an IP 8


datagram?
Explain the functions of the following fields related to fragmentation
in an IP Datagram:
i) Identification
ii) Flags
iii) Fragmentation Offset.
Explain fragmentation offset with an example. (May 2006)

Answer :
A datagram can travel through different networks. Each router de-
capsulates the IP datagram from the frame it receives, processes it and
then encapsulates it in another frame. The format and size of the received
frame depends on the protocol used by the physical network though
which the frame has just traveled.

In order to make the IP protocol independent of the physical network, the


packagers decided to make the maximum length of the IP datagram equal
to the largest maximum transfer unit (MTU) i.e 65535 bytes. This makes
transmission more efficient if we use a protocol with an MTU of this size.
However, for other physical networks, we must divide the datagram to
make it possible to pass through these networks. This is called
fragmentation.

A datagram can be fragmented by the source host or any router in the


path. The reassembly of the datagram, however, is done only by the
destination host because each fragment becomes an independent
datagram. Whereas the fragmented datagram can travel through different
routes, but all fragments belonging to the same datagram should finally
arrive at the destination host.

When a datagram is fragmented, following fields are updated :


a) Required parts of the header must be copied by all
fragments.
b) The option field may or may not be copied.
c) The host or router that fragments the datagram must change
the values of total length, Flags & Fragmentation Offset.
d) Value of checksum must be recalculated.

© vinod vaze
QB on IT for TY BSc. (IT)

e) Rest of the fields must be copied.

Identification :
a) 16-bit field that identifies a datagram originating from the
source host .
b) The combination of the identification and the source IP must
uniquely define a datagram as it leaves the source host. To
guarantee uniqueness, the IP protocol uses a counter to
label the datagrams.
c) When the IP protocol sends a datagram, it copies the
current value of the counter to the identification field and
increments the counter by one.
d) As long as the counter remains in the memory, uniqueness
is guaranteed. When a datagram is fragmented, the value in
the identification field is copied into all fragments.
e) The identification number helps in reassembling the
datagram since all fragments with the same identification
number should be assembled into one datagram.

Flags :
It is a 3 bit field. Following are the bits :
a) The first is a reserved bit.
b) The second bit is called the ‘Do not fragment’ bit. If the value
is 1, the machine must not fragment the datagram. If it
cannot pass the datagram through any available physical
network, it discards the datagram and sends an ICMP error
message to the source. If the value is 0, the datagram can
be fragmented.
c) The third bit is called the ‘More fragment’ bit. It its value is 1,
then the datagram is not the last fragment, there are more
fragments after this one. But if the value is 0, it means that
this is the last or only fragment.

Fragmentation Offset :
This is a 13-bit field. It shows the relative position of this fragment with
respect to the whole datagram. If each fragment follows a different path
and arrives out of order, the final destination host can reassemble the
original datagram from the fragments received using the following strategy

a) The first fragment has an offset field value of zero.


b) Divide the length of the first fragment by 8. The second
fragment has an offset value equal to that result.
c) Divide the total length of the first and second fragment by 8.
The third fragment has an offset value equal to that result.
d) Continue the process. The last fragment has a ‘more bit’

© vinod vaze
QB on IT for TY BSc. (IT)

value of 0.

Example :
A datagram of 4000 bytes fragmented into 3 fragments. The bytes in the
original datagram are numbered from 0 to 3999. The first fragment carries
bytes 0 to 1399. The offset for this datagram is 0/8=0. The second
fragment carries bytes 1400 to 2799 . The offset value is 1400/8 =175.
The third fragment carries bytes 2800 to 3999.
The offset value for this fragment is 2800/8=350.
The value of the offset is measured in units of 8 bytes.

002 How does transmission control protocol avoid congestion? Explain


in detail. (October 2005)

An internet is a combination of networks and connecting devices (e.g.,


routers). A Packet started at sender may pass through several routers
before reaching its final destination. A router has a buffer that stores the
incoming packets, processes them and Forwards them.

If a router receives packets faster than it can process, congestion might


occur and some packets could be dropped.

To avoid congestion, the sender TCP uses 2 strategies.

a) Slow Start and Addictive Increase


b) Multiplicative decrease

Slow Start
1. At the beginning of a connection, TCP sets the congestion window
size to the maximum segment size.
2. For each segment that is acknowledged, TCP increases the size of
the congestion window by one maximum segment size, until it
reaches a threshold of half the allowable window size. This is
called slow start.
3. Here the size of the congestion window increases exponentially.

Addictive Increase
a) To avoid congestion before it happens, one must slow down
this exponential growth.
b) After the size reaches the threshold, the size is increased one
segment for each acknowledgement even if an
acknowledgement is for several segments.
4. This additive increase strategy continues as long as the
acknowledgements arrive before their corresponding time-outs or
the congestion window size reaches the receiver window value.

© vinod vaze
QB on IT for TY BSc. (IT)

Multiplicative Decrease
a) If congestion occurs, the congestion window size must be
decreased. A Lost segment indicates that congestion has
occurred. If the sender does not receive an acknowledgement
for a segment before its retransmission timer has matured, it
assumes that there is congestion.
b) This strategy says that, if a time-out occurs, the threshold

c) must be set to half of the last congestion window size, and the
congestion window size should start from one again. Thus the
sender returns to the slow start phase.
c) The size of threshold is reduced to half each time a time-out
occurs. Thus the size of the threshold is reduced exponentially
(multiplicative decrease).

Explanation :

In the above Figure, we assume that the maximum window size is 32


segments. The threshold is set to 16 segments (half of the window size).
In the slow start procedure, the window size starts from 1 and grows
exponentially until it reaches the threshold with the condition that there is
no timeout. After reaching the threshold, the additive increase procedure
allows the window size to increase linearly until a timeout occurs or the
maximum window size is reached.

In the above drawn figure, the timeout occurs what the segment 8 is sent.
At this moment, the multiplicative decrease procedure takes over and
reduces the threshold to half of the previous window size. The previous
window size was when the timeout happened so the new threshold is now
10.

003 Draw the TCP state transition diagram. Explain the states, which the
TCP client can attain.

Ans:

State Description
CLOSED There is no connection
LISTEN Passive open received; waiting for SYN
SYN-SENT SYN sent; waiting for ACK
SYN-RCVD SYN+ACK sent; waiting for ACK
EATABLISHED Connection established; data transfer in progress
FIN-WAIT-1 First FIN sent; waiting for ACK
FIN-WAIT-2 ACK to first FIN received; waiting for second FIN

© vinod vaze
QB on IT for TY BSc. (IT)

CLOSE-WAIT First FIN received, ACK sent; waiting for application to


close
TIME-WAIT Second FIN received, ACK sent; waiting for 2MSL
time-out
LAST-ACK Second FIN sent; waiting for ACK
CLOSING Both sides have decided to close simultaneously

004 Distinguish between Transmission Control Protocols and User


Datagram Protocol User Datagram Protocol.

Ans:

Parameter TCP UDP


1 Common in both UDP and TCP are transport-layer protocols
that create a process-to-process
communication
2 Reliability Reliable UDP is an unreliable
protocol
3 Expand the Transmission User Datagram Protocol
acronym Control Protocol
4 Orientation Byte oriented Message oriented
5 Connection Connection Connectionless
orientation oriented
6 Overheads Considerable Little
7 Speed Slower Faster
8 Protocol Data The TCP packet The UDP packet is called
unit is called a a user datagram.
segment.
9 Flow control TCP uses a UDP has no flow control
mechanism sliding window mechanism at all.
mechanism for
flow control.
10 Error control TCP provides UDP has no Error control
error control. Byte mechanism at all.
oriented. [only checks the UDP
header by checksum]
11 Error Detection Error detection is • No
and correction handled in TCP Acknowledgement,
Mechanism by the checksum, • No guaranteed
CRC delivery
acknowledgment, • No sequence
and time-out. guarantee
Congestion • No congestion control
control
12 Timers TCP uses four Nothing of this sort.

© vinod vaze
QB on IT for TY BSc. (IT)

timers—
retransmission,
persistence,
keep-alive, and
time-waited — in
its operation.
13 Preference & TCP is preferred • UDP is preferred &
Use & used for: Used for one-shot,
reliable, byte- client-server type
stream delivery request-reply queries,
between Example: DNS
processes. • Where prompt
delivery is more
important than
accurate delivery,
such as: Transmitting
speech or video
• Transmission of Real
time data
• Can be used by a
system having its own
error correction and
flow correction
mechanism such as
TFTP, RIP & SNMP
14 Headers & The TCP header The UDP header is much
Overheads: is much larger smaller than the TCP
than the UDP header
header
15 Example of TELNET DNS
application
16 Connection Required to have No prior connection at
explicit all: It is connectionless
connection
between the
hosts.
Three Way
Handshake
17 Latest trends Use SCTP [ Stream Control Transmission
Protocol] which combines the good features
of both TCP and UDP

© vinod vaze
QB on IT for TY BSc. (IT)

005 Define Internet Protocol Datagram in detail

Ans:

Packets in the IP layer are called datagram’s. A datagram is variable –


length packet consisting of two parts: header and data. The header is 20
to 60 bytes in length and contains information essential to routing and
delivery. It is customary in TCP/IP to show the header in 4 bytes sections.
A brief description of ach field is in order.

Version (VER): These 4 bits defines the version of IP protocol. Currently


the version is 4. However, version 6 may totally replace version 4 in the
future. This field tells the IP software running in the processing machine
that the datagram has the format of version 4. All fields may be
interpreted as specified in the 4th version of the protocol. If the machine is
using some other version of IP datagram is discarded rather than
interpreted incorrectly.

Header length (HLEN): This 4 bit field defines the total length of the
datagram of header in 4 byte word. This field is needed because the
length of the header is variable. When there are no options, the header
length is 20 bytes, and the value of the field is 5. When the option is field
at its maximum size, the value of this field is 15.

Differentiated services (DS): IETF has changed the interpretation and


name of this bit field. This field, previously called service type, is now
called differentiated services.
Total length: This is 16 bit field that defines the total length of IP datagram
in bytes. To find the length of data coming from the upper layer, subtract
the header length from the total length. The header length can be founded
by multiplying the value in the HLEN field by 4.

The total length field defines the total length of the datagram including the
header.

© vinod vaze
QB on IT for TY BSc. (IT)

006 An IP packet has arrived with the first 8 bits as shown:


<---------------01000010
The receiver discards the packer? Why?

Ans:

There is an error in this packet.


The 4 left most bits (0100) show the version, which is correct.
The next 4 bits 0010) show the wrong header length (2*4=8). The
minimum number of bytes in the header must be 20.
The packet has been corrupted in transmission.

007 Ans:

TCP TIMERS

Timers

Retransmission Persistence Keepalive TIME-WAIT

Retransmission Timer:
To retransmit a lost segment, TCP employs a retransmission timer that
handles the retransmission time-out (RTO), the waiting time for an
acknowledgement of a segment. When TCP sends a segment, it creates
a retransmission timer for that particular segment. Two situations may
occur:

1. If an acknowledgement is received for this particular segment


before the timer goes off, the timer is destroyed.
2. If the timer goes off before the acknowledgement arrives, the
segment is retransmitted and the timer is reset.

Round trip time (RTT):


To calculate the retransmission time-out (RTO), we first need to calculate
the round-trip time (RTT). However, calculating RTT in TCP is an involved
process that we explain step by step with some examples.

Measured RTT we need to find how long it takes to send a segment and
receive an acknowledgement for it. This is the measured RTT. We need
to remember that the segment and their acknowledgements do not have a
one-to-one relationship; several segments mat be acknowledged
together. The measured round trip time for a segment is the time required
for the segment to reach the destination and be acknowledged, although

© vinod vaze
QB on IT for TY BSc. (IT)

the acknowledgement may include other segments. Note that in TCP,


only one RTT measurement can be in progress at any time.

This means that if any RTT measurement is started, no other


measurement starts until the value of this RTT is finalized. We use the
notation RTTM to stand for measured RTT.

008 What is the services offered by the Transmission Control Protocol to


the processes an Application layer? Explain any two devices.

Ans:

The services offered by the Transmission Control Protocol to the


processes an Application layer are as follows:
1. Process- To-Process communication
2. Stream delivery Service
3. Connection-Oriented Service
4. Full-Duplex Communication
5. Reliable Service
6. Process-To-Process Communication

Like UDP, TCP provides process-to-process communication using port


numbers

Port Protocol Description


7 Echo Echoes a received datagram back to the sender
9 Discard Discards any datagram that is received
11 Users Active users
13 Daytime Returns the date and time
17 Quote Returns the quote of the day
19 Chargen Returns a string of characters
20 FTP, Data File Transfer Protocol (data connection)
21 FTP, Control File Transfer Protocol (control connection)
23 TELNET Terminal Network
25 SMTP Simple Mail Transfer Protocol
53 DNS Domain Name server
67 BOOTP Bootstrap Protocol
79 Finger Finger
80 HTTP Hypertext Transfer Protocol
111 RPC Remote Procedure Call

Connection-Oriented Service:
TCP, unlike UDP, is a Connection-Oriented protocol. when a process at
site A wants to send and receive data from another process at site B, the
following occurs:

© vinod vaze
QB on IT for TY BSc. (IT)

a) The two TCPs establish a connection between them.


b) Data are exchanged in both directions.
c) The connection is terminated.

Note that this is a virtual connection, not a physical connection. The TCP
segment is encapsulated in an IP datagram and can be send out of order,
or lost, or corrupted, and then resent. Each may use a different path to
reach the destination. There is no physical connection. TCP creates a
stream-oriented environment in which it accepts the responsibility of
delivering the bytes in order to the other site. The situation is similar to
creating a bridge that spans multiple islands and passing all of the bytes
from one island to another in one single connection.

Transmission Control Protocol is a Connection-Oriented Protocol.


009
Ans:

Any of the two parties involved in exchanging data (client or server) can
close the connection, although it is usually initiated by the client. Most
implementation today allows two options for connection termination:
three-way handshake and four-way handshake with a half-close option.

Three-Way Handshaking:

Most implementation today allow three-way handshaking for connection


termination

a) In a normal situation, the client TCP, after receiving a close


command from the client process, sends the first segment, a
FIN segment in which the FIN flag is set. Note that a FIN
segment can include the last chunk of the data sent by the
client or it can be just a control segment. If it is only a control
segment, it consumes only one sequence number.

b) The server TCP after receiving the FIN segment informs its
process of the situation and sends the second segment, a
FIN+ACK segment, to confirm the receipt of the FIN segment
from the client and at the same time to announce the closing
of the connection in the other direction. This segment can also
contain the last chunk of data from the server. If it does not
carry data, it consumes only one sequence number.

c) The client TCP sends the last segment, an ACK to confirm the
receipt of the FIN segment from the TCP server. This
segment contains the acknowledgement number, which is one
plus the sequence number received in the FIN segment from

© vinod vaze
QB on IT for TY BSc. (IT)

the server. This segment cannot carry data and consumes no


sequence numbers.

Half-Close:
In TCP, one end can stop sending data while still receiving data. This is
called a half-close. Although either end can issue a half-close, it is
normally initiated by the client. It can occur when the server needs all the
data before processing can begin. A good example is sorting. When the
client sends all the data to the server to be sorted, the server needs to
receive all the data before sorting can start. This means the client, after
sending all data, can close the connection in the outbound direction.
However, the inbound direction must remain open to receive the sorted
data. The server, after receiving the data still needs time for sorting; its
outbound direction must remain open.

The client half-closes the connection by sending a FIN segment. The


server accepts the half-close by sending the ACK segment. The data
transfer from the client to the server stops. The server, however, can still
send data. When the server has sent all of the process data, it sends a
FIN segment, which is acknowledged by an ACK from the client.

After half closing the connection, data can travel from the server to the
client and acknowledgements can travel from the client to the server. The
client cannot send more data to the server. Note the sequence numbers
we have used. The second segment (ACK) consumes no sequence
numbers. Although the client has received sequence number Y-1 and is
expecting Y, the server sequence number is still Y-1. When the
connection finally closes, the sequence number of the last ACK segment
is still X, because no sequence numbers are consumed during data
transfer in that direction.

010 Transmission control protocol is a connection oriented protocol.


How does it establish the connection? Explain in details the process
of connection establishment?

Ans:

TCP is a connection-oriented. A connection-oriented transport protocol


establishes a virtual path between the source and destination. All of the
segments belonging to message are then send over this virtual path.
Using a single pathway for the entire message facilities the
acknowledgement process as well as retransmission of damaged or lost
frames. You may wonder how TCP, which uses the services of IP to
deliver individual segments to the receiver, but it, controls the connection

© vinod vaze
QB on IT for TY BSc. (IT)

itself. The point is that the TCP connection is virtual, not physical. TCP
operates at higher level. TCP uses the services of IP to deliver individual
segments to the receiver, but it controls the connection itself. If a segment
is lost or corrupted, it is retransmitted. Unlike TCP, IP is unaware of this
retransmission. If a segment arrives out of order, TCP holds it until the
missing segment arrives; IP is unaware of this reordering.

In TCP, connection-oriented transmission requires three phases:


connection establishment, data transfer and connection termination.
Connection Establishment:
TCP transmits data in full-duplex mode. When two TCPs in two machines
are connected, they are able to send segments to each other
simultaneously. This implies that each party must initialize communication
and get approval from the other party before any data is transferred.
Three-Way Handshake:
The connection establishment in TCP is called three-way handshake. In
our example application program, called the client, wants to make a
connection with another application program, called the server, using TCP
as the transport layer protocol.
The process starts with the server. The server program tells its TCP that it
is ready to accept the connection. This is called a request for a passive
open. Although the server TCP is ready to accept any connection from
any machine in the world it cannot make the connection itself.
The client program issues a request for an active open. A client that
wishes to connect to an open server tells its TCP that it needs to be
connected to a particular server. TCP can now start a three-way
handshake process. Each segment has values for all its header fields and
perhaps for some of its option fields too. However we show only the few
fields necessary to understand each phase. We show the sequence
number, the acknowledgement number, the control flags and the window
size is not empty.
Simultaneous open:
A rare situation may occur when both processes issue an active open. In
this case, both TCPs transmit a SYN+ACK segment to each other and
one single connection is established between them.

SYN Flooding Attack:


The connection establishment procedure in TCP is susceptible to serious
security problem called SYN flooding attack. This happens when a
malicious attacker sends a large number of SYN segments to a server
pretending that each of them is coming from a different client faking the
source IP address in the datagram’s. The server assumes that the clients
are issuing an active open, allocates the necessary resources, such as
creating TCB tables and setting timers. The TCP server then sends the
SYN+ACK segments to the fake clients, which are lost. During this time,

© vinod vaze
QB on IT for TY BSc. (IT)

however, a lot of resources are occupied without being used. If, during
this short period of time, the number of SYN segments is large, the server
eventually runs out of resources and may crash.

Data transfer:
After connection is established, bidirectional data transfer can take place.
The client and server can send data and acknowledgements in both
directions. The client sends 2000 bytes of data in two segments. The
server then sends 2000 byes in one segment. The client sends one more
segment. The first three segments carry both data and acknowledgments,
but last segment carries only an acknowledgment because there is no
more data to be sent. Note the values of segments and acknowledgment
numbers. The data segments sent by the clients have the PSH flag set so
that the TCP knows to deliver data to the server as soon as they are
received. Most TCP implementations have the option to set or not set this
flag.

Pushing data:
There are occasions in which application program has no need for
flexibility. Consider an application program that communicates
interactively with another application program on the other end. The
application program on one site wants to send a keystroke to the
application at the other site and receive an immediate response. Delayed
transmission and delayed delivery of other data may not be acceptable by
the application program.

TCP can handle such a situation. The application program at the sending
site can request a push operation. This means that the sending TCP must
not wait for the windows to be filled. It must create a segment and send it
immediately. The sending TCP must also send the push bit to let the
receiving TCP know that the segment includes data that must be
delivered to the receiving application program as soon as possible and
not to wait for more data to come.

Connection Termination:
Any of the two parties involved in exchanging data (client or server) can
close the connection, although it is usually initiated by the client. Most
implementation today allows two options for connection termination:
three-way handshake and four-way handshake with a half-close option.

Three-Way Handshaking:
Most implementation today allow three-way handshaking for connection
termination
4. In a normal situation, the client TCP, after receiving a close
command from the client process, sends the first segment, a FIN segment
in which the FIN flag is set. Note that a FIN segment can include the last

© vinod vaze
QB on IT for TY BSc. (IT)

chunk of the data sent by the client or it can be just a control segment. If it
is only a control segment, it consumes only one sequence number.
5. The server TCP after receiving the FIN segment informs its
process of the situation and sends the second segment, a FIN+ACK
segment, to confirm the receipt of the FIN segment from the client and at
the same time to announce the closing of the connection in the other
direction. This segment can also contain the last chunk of data from the
server. If it does not carry data, it consumes only one sequence number.
6. The client TCP sends the last segment, an ACK to confirm the
receipt of the FIN segment from the TCP server. This segment contains
the acknowledgement number, which is one plus the sequence number
received in the FIN segment from the server. This segment cannot carry
data and consumes no sequence numbers.

Half-Close:
In TCP, one end can stop sending data while still receiving data. This is
called a half-close. Although either end can issue a half-close, it is
normally initiated by the client. It can occur when the server needs all the
data before processing can begin. A good example is sorting. When the
client sends all the data to the server to be sorted, the server needs to
receive all the data before sorting can start. This means the client, after
sending all data, can close the connection in the outbound direction.
However, the inbound direction must remain open to receive the sorted
data. The server, after receiving the data still needs time for sorting; its
outbound direction must remain open.

The client half-closes the connection by sending a FIN segment. The


server accepts the half-close by sending the ACK segment. The data
transfer from the client to the server stops. The server, however, can still
send data. When the server has sent all of the process data, it sends a
FIN segment, which is acknowledged by an ACK from the client.
After half closing the connection, data can travel from the server to the
client and acknowledgements can travel from the client to the server. The
client cannot send more data to the server. Note the sequence numbers
we have used. The second segment (ACK) consumes no sequence
numbers. Although the client has received sequence number Y-1 and is
expecting Y, the server sequence number is still Y-1. When the
connection finally closes, the sequence number of the last ACK segment
is still X, because no sequence numbers are consumed during data
transfer in that direction.

© vinod vaze
QB on IT for TY BSc. (IT)

011 Draw the IP packet format and explain each of its fields.
Which fields of the IP header change from router to router?

Ans:

Packets in the IP layer are called datagrams. A datagram is variable –


length packet consisting of two parts: header and data. The header is 20
to 60 bytes in length and contains information essential to routing and
delivery. It is customary in TCP/IP to show the header in 4 bytes sections.
A brief description of ach field is in order.

Version (VER): These 4 bits defines the version of IP protocol. Currently


the version is 4. However, version 6 may totally replace version 4 in the
future. This field tells the IP software running in the processing machine
that the datagram has the format of version 4. All fields may be
interpreted as specified in the 4th version of the protocol. If the machine is
using some other version of IP datagram is discarded rather than
interpreted incorrectly.

Header length (HLEN): This 4 bit field defines the total length of the
datagram of header in 4 byte word. This field is needed because the
length of the header is variable. When there are no options, the header
length is 20 bytes, and the value of the field is 5. When the option is field
at its maximum size, the value of this field is 15.

Differentiated services (DS): IETF has changed the interpretation and


name of this bit field. This field, previously called service type, is now
called differentiated services.

Total length: This is 16 bit field that defines the total length of IP datagram
in bytes. To find the length of data coming from the upper layer, subtract
the header length from the total length. The header length can be founded
by multiplying the value in the HLEN field by 4. The total length field
defines the total length of the datagram including the header.

012 The server TCP after receiving the FIN segment informs its process of the
situation and sends the second segment, a FIN+ACK segment, to confirm
the receipt of the FIN segment from the client and at the same time to
announce the closing of the connection in the other direction. This
segment can also contain the last chunk of data from the server. If it does
not carry data, it consumes only one sequence number.

The client TCP sends the last segment, an ACK to confirm the receipt of
the FIN segment from the TCP server. This segment contains the

© vinod vaze
QB on IT for TY BSc. (IT)

acknowledgement number, which is one plus the sequence number


received in the FIN segment from the server. This segment cannot carry
data and consumes no sequence numbers.

013 What do you understand by 4-way handshaking in TCP? Explain

Ans:

Half-Close:
In TCP, one end can stop sending data while still receiving data. This is
called a half-close. Although either end can issue a half-close, it is
normally initiated by the client. It can occur when the server needs all the
data before processing can begin. A good example is sorting. When the
client sends all the data to the server to be sorted, the server needs to
receive all the data before sorting can start. This means the client, after
sending all data, can close the connection in the outbound direction.
However, the inbound direction must remain open to receive the sorted
data. The server, after receiving the data still needs time for sorting; its
outbound direction must remain open.

The client half-closes the connection by sending a FIN segment. The


server accepts the half-close by sending the ACK segment. The data
transfer from the client to the server stops. The server, however, can still
send data. When the server has sent all of the process data, it sends a
FIN segment, which is acknowledged by an ACK from the client.

After half closing the connection, data can travel from the server to the
client and acknowledgements can travel from the client to the server. The
client cannot send more data to the server. Note the sequence numbers
we have used. The second segment (ACK) consumes no sequence
numbers. Although the client has received sequence number Y-1 and is
expecting Y, the server sequence number is still Y-1. When the
connection finally closes, the sequence number of the last ACK segment
is still X, because no sequence numbers are consumed during data
transfer in that direction.

Version (VER): These 4 bits defines the version of IP protocol. Currently


014 the version is 4. However, version 6 may totally replace version 4 in the
future. This field tells the IP software running in the processing machine
that the datagram has the format of version 4. All fields may be
interpreted as specified in the 4th version of the protocol. If the machine is
using some other version of IP datagram is discarded rather than
interpreted incorrectly.

Header length (HLEN): This 4 bit field defines the total length of the
datagram of header in 4 byte word. This field is needed because the

© vinod vaze
QB on IT for TY BSc. (IT)

length of the header is variable. When there are no options, the header
length is 20 bytes, and the value of the field is 5. When the option is field
at its maximum size, the value of this field is 15.

Differentiated services (DS): IETF has changed the interpretation and


name of this bit field. This field, previously called service type, is now
called differentiated services.

Total length: This is 16 bit field that defines the total length of IP datagram
in bytes. To find the length of data coming from the upper layer, subtract
the header length from the total length. The header length can be founded
by multiplying the value in the HLEN field by 4. The total length field
defines the total length of the datagram including the header.

015 How does transmission control protocol avoid transmission? Explain in


detail.

Ans:

If we start with the slow start algorithm, the size of congestion window
increases exponentially. To avoid congestion before it happens, one must
slow down this exponential growth. TCP defines another algorithm called
congestion avoidance, which increases additively instead of exponentially.
When the size of the congestion window reaches the slow start threshold,
the whole window of segments is acknowledged, the size of the
congestion window is increased by one. To show the idea, we apply this
algorithm, to the same scenario as slow start although as we will see that
the congestion avoidance usually starts when the size of the window is
much greater than one. After the sender has received acknowledgements
for a complete window size of segments, the size of the window is
increased by one segment.

016 Explain in detail the Internal Protocol datagram. A datagram is


carrying 1024 bytes of data. If there is no option information, what is
the value of the header length field and the total length field?
(October 2005)
Answer:

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

Header

The header consists of 13 fields, of which only 12 are required. The 13 th


field is optional (red background in table) and aptly named: options. The

© vinod vaze
QB on IT for TY BSc. (IT)

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 4 most significant bits of the first byte, for example.

Version
The first header field in an IP packet is the 4-bit version field. For
IPv4, this has a value of 4 (hence the name IPv4).
Internet Header Length (IHL)
The second field is a 4-bit 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 (rfc791), which is a length of 5×32
= 160 bits. Being a 4-bit field the maximum length is 15 words or
480 bits.
Type of Service (TOS)
In RFC 791, the following 8 bits were allocated to a Type of Service
(TOS) field:

• bits 0-2: precedence


• bit 3: 0 = Normal Delay, 1 = Low Delay
• bit 4: 0 = Normal Throughput, 1 = High Throughput
• bit 5: 0 = Normal Reliability, 1 = High Reliability
• bits 6-7: Reserved for future use

This field is now used for DiffServ and ECN. The original intention
was for a sending host to specify a preference for how the
datagram would be handled as it made its way through an
internetwork. 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 has not been widely
implemented. However, a great deal of experimental, research and
deployment work has focused on how to make use of these eight
bits. These bits have been redefined, most recently through
DiffServ working group in the IETF and the Explicit Congestion
Notification codepoints. New technologies are emerging that
require real-time data streaming and therefore will make use of the
TOS field. An example is Voice over IP (VoIP) that is used for
interactive data voice exchange.
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
bytes header + 0 bytes data) and the maximum is 65,535 — the
maximum value of a 16-bit word. The minimum size datagram that

© vinod vaze
QB on IT for TY BSc. (IT)

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 (see Fragmentation and
reassembly).
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 3-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 —
clearly an unfragmented packet can be considered the last
fragment.
Fragment Offset
The fragment offset field, measured in units of 8-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 0. This allows a maximum offset of
65,528 ( ) which would exceed the maximum IP
packet length of 65,535 with the header length included.
Time To Live (TTL)
An 8-bit time to live (TTL) field helps prevent datagrams from
persisting (e.g. going in circles) on an internetwork. Historically the
TTL field limited a datagram's lifetime in seconds, but 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

© vinod vaze
QB on IT for TY BSc. (IT)

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 and were originally defined in RFC 790.
Common protocols and their decimal values are shown below.
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 791:
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.
Source address
An IP address is a group of 4 8-bit 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 (00001010. 00001001.


00001000. 00000111 in binary) 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

© vinod vaze
QB on IT for TY BSc. (IT)

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) 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:

Field Size Description


(bits)
Copied 1 Set to 1 if the options need to be copied into all fragments of a fragm
packet.
Option 2 A general options category. 0 is for "control" options, and 2 is for "
Class and measurement". 1, and 3 are reserved.

The header of the IP datagram is made up of 2 parts. : A fixed part (20


bytes long) and a variable part that comprises the options that can be a
maximum of 40 bytes.
Total Length field = Header Length + data
Since there is no option information, the size of the header= 20 bytes.
Therefore value of the total length field
= 20 + 1024 bytes
= 1044 bytes

© vinod vaze
QB on IT for TY BSc. (IT)

017 The following is dump of a TCP header in hexadecimal format.


05320017 00000001 0000 0000 500207FF 00000000 (20 bytes)
i) What is the source port number?
ii) What is the destination port number?
iii) What is the sequence number?
iv) What is the acknowledgement number?
v) What is the length of the header?
vi) What is the type of the segment?
vii) What is the window size?

Ans:
i) The source port number is: 1330
ii) The destination port number is: 23
iii) The sequence number is: 1
iv) The acknowledgement number is: 0
v) The length of the header is: 5 x 4 = 20 bytes
vi) The type of segment is: The synchronize bit is set. Hence it is
synchronize segment.
vii) The size of window is: 511

018 An IP datagram has arrived with the following information in


the header (in hexadecimal)

4500 00 54 00 03 00 00 20 06 00 00 7C 4E 03 02 B4 0E 0F 02

Ans.

© vinod vaze
QB on IT for TY BSc. (IT)

Field Number Given Value Value in bits


of bits
Version 4 4 0100
Header 4 5 0101
Length
Differentiated 8 00 00000000
Service
Total length 16 0054 00000000 01010100
Identification 16 0003 00000000 00000000

Flags 3 0 000
Fragmentatio 13 00 00000000
n Offset
Time to Live 8 20 0010 0000
Protocol 8 06 0000 0110
Header 16 0000 00000000 00000000
Checksum

S. No Question Answer
1. Classify the above header Version IPv4

© vinod vaze
QB on IT for TY BSc. (IT)

2. Are there any options? No

3. Is the packet fragmented? Yes : “R00” Last


fragment

4 What is the size of the In 4-byte word


data? = (54)16 – (5)16
= (4F)16
= 79
and in bytes
=79 * 4 =316 bytes
5 Is a checksum used? No

6 How many more routers (20)16


can a packet travel to? = (32)10
= 32
7 What is the identification 3
number of the packet?
8 What is the type of the Protocol is 06
service? = TCP

019 Transmission control protocol is a connection-oriented


protocol. How does it establish the connection? Explain in
detail the process of connection establishment. (November
2004)

Ans.

TCP is a connection-oriented protocol. It establishes a virtual path


between the source and destination. All the segments belonging to a
message are then sent over this virtual path. Using a single virtual
pathway for the entire message facilitates the acknowledgment process
as well as retransmission of damaged or lost frames. In TCP, connection-
oriented transmission requires two procedures:

1) Connection Establishment and


2) Connection Termination.

Connection Establishment
TCP transmits data in full-duplex mode. When two TCPs in two machines
are connected, they are able to send segments to each other

© vinod vaze
QB on IT for TY BSc. (IT)

simultaneously. This implies that each party must initialize communication


and get approval from the other party before any data transfer.
Four steps are needed to establish the connection, as discussed before.
However, the second and third steps can be combined to create a three-
step connection, called a three-way handshake, as shown in Figure.

The steps of the process are as follows:

1. The client sends the first segment, a SYN segment. The segment
includes the source and destination port numbers. The destination
port number clearly defines the server to which the client wants to
be connected. The segment also contains the client initialization
sequence number (ISN) used for numbering the bytes of data sent
from the client to the server.

2. The server sends the second segment; a SYN and an ACK


segment. This segment has a dual purpose. First, it acknowledges
the receipt of the first segment, using the ACK flag and
acknowledgment number field. Note that the acknowledgment
number is the client initialization sequence number plus 1 because
no user data have been sent in segment 1. The server must also
define the client window size. Second, the segment is used as the
initialization segment for the server. It contains the initialization

© vinod vaze
QB on IT for TY BSc. (IT)

sequence number used to number the bytes sent from the server
to the client.

3. The client sends the third segment. This is just an ACK segment. It
acknowledges the receipt of the second segment, using the ACK
flag and acknowledgment number field. Note that the
acknowledgment number is the server initialization sequence
number plus 1 because no user data have been sent in segment 2.
The client must also define the server window size. Data can be
sent with the third packet.

© vinod vaze
QB on IT for TY BSc. (IT)

020 How TCP provides reliability using error control?


What is the Maximum size of TCP header?
What is the minimum size of TCP header? (May 2005)

Ans.

TCP is a reliable transport layer protocol. This means that an application


program that delivers a stream of data to TCP relies on TCP to deliver the
entire stream to the application program on the other end in order, without
error and without any part lost or duplicated.

TCP provides reliability using error control. Error control includes


mechanisms for detecting corrupted segments lost segments, out-of-order
segments and duplicated segments. Error control also includes a
mechanism for correcting errors after they are detected.

Error Detection and Error Correction:

Error Detection in TCP is achieved through the use of three simple tools:
checksum, acknowledgment and time-out. Each segment includes the
checksum field, which is used to check for a corrupted segment. If the
segment is not acknowledged before the timeout, it is considered to be
either corrupted or lost.

The error correction mechanism used by TCP is also very simple. The
source TCP starts one time-out counter for each segment sent. Each
counter is checked periodically. When a counter matures, the
corresponding segment is considered to be either corrupted or lost and
the segment will be retransmitted.

The segment consists of a 20-byte to 60-byte header, followed by data


from the application program. The header is 20-byte if there are no
options and up to 60-bytes if it contains options.

021 Draw the IP packet format and explain each of its field.
Which fields of the IP header change from router to router?
(May 2005)

Ans :

Figure: The IP header layout

© vinod vaze
QB on IT for TY BSc. (IT)

Version Number
This is a 4 bit field that contains the IP version number the protocol
software is using. The version number is required so that receiving IP
software knows how to decode the rest of the header, which changes with
each new release of the IP standards. The most widely used version is 4,
although several systems are now testing version 6 (called IPng). The
Internet and most LANs do not support IP version 6 at present. Part of the
protocol definition stipulates that the receiving software must first check
the version number of incoming datagram before proceeding to analyze
the rest of the header and encapsulated data. If the software cannot
handle the version used to build the datagram, the receiving machine's IP
layer rejects the datagram and ignores the contents completely.

Header Length
This 4bit field reflects the total length of the IP header built by the sending
machine; it is specified in 32bit words. The shortest header is five words
(20 bytes), but the use of optional fields can increase the header size to
its maximum of six words (24 bytes). To properly decode the header, IP
must know when the header ends and the data begins, which is why this
field is included. (There is no start of data marker to show where the data
in the datagram begins. Instead, the header length is used to compute an
offset from the start of the IP header to give the start of the data block.)

Type of Service

The 8bit (1 byte) Service Type field instructs IP how to process the
datagram properly. The field's 8 bits are read and assigned as shown in

© vinod vaze
QB on IT for TY BSc. (IT)

Figure 3.2, which shows the layout of the Service Type field inside the
larger IP header shown in Figure 3.1. The first 3 bits indicate the
datagram's precedence, with a value from 0 (normal) through 7 (network
control). The higher the number, the more important the datagram and, in
theory at least, the faster the datagram should be routed to its destination.
In practice, though, most implementations of TCP/IP and practically all
hardware that uses TCP/IP ignores this field, treating all datagram with
the same priority.

Figure: The 8bit Service Type field layout

The next three bits are 1bit flags that control the delay, throughput, and
reliability of the datagram. If the bit is set to 0, the setting is normal. A bit
set to 1 implies low delay, high throughput, and high reliability for the
respective flags. The last two bits of the field are not used. Most of these
bits are ignored by current IP implementations, and all datagram are
treated with the same delay, throughput, and reliability settings. For most
purposes, the values of all the bits in the Service Type field are set to 0
because differences in precedence, delay, throughput, and reliability
between machines are virtually nonexistent unless a special network has
been established. Although these

Flags would be useful in establishing the best routing method for a


datagram, no currently available UNIX based IP system bothers to
evaluate the bits in these fields. ( Although it is conceivable that the code
could be modified for high security or high reliability networks.)

Datagram Length (or Packet Length)


This field gives the total length of the datagram, including the header, in
bytes. The length of the data area itself can be computed by subtracting
the header length from this value. The size of the total datagram length
field is 16 bits, hence the 65,535 bytes maximum length of a datagram
(including the header). This field is used to determine the length value to
be passed to the transport protocol to set the total frame length.

Identification
This field holds a number that is a unique identifier created by the sending
node.
This number is required when reassembling fragmented messages,
ensuring that the fragments of one message are not intermixed with
others. Each chunk of data received by the IP layer from a higher protocol

© vinod vaze
QB on IT for TY BSc. (IT)

layer is assigned one of these identification numbers when the data


arrives. If a datagram is fragmented, each fragment has the same
identification number.

Flags
The Flags field is a 3bit field, the first bit of which is left unused (it is
ignored by the protocol and usually has no value written to it). The
remaining two bits are dedicated to flags called DF (Don't Fragment) and
MF (More Fragments), which control the handling of the datagram when
fragmentation is desirable. If the DF flag is set to 1, the datagram cannot
be fragmented under any circumstances. If the current IP layer software
cannot send the datagram on to another machine without fragmenting it,
and this bit is set to 1, the datagram is discarded and an error message is
sent back to the sending device. If the MF flag is set to 1, the current
datagram is followed by more packets (sometimes called sub packets),
which must be reassembled to recreate the full message. The last
fragment that is sent as part of a larger message has its MF flag set to 0
(off) so that the receiving device knows when to stop waiting for
datagram. Because the order of the fragments' arrival might not
correspond to the order in which they were sent, the MF flag is used in
conjunction with the Fragment Offset field (the next field in the IP header)
to indicate to the receiving machine the full extent of the message.

Fragment Offset
If the MF (More Fragments) flag bit is set to 1 (indicating fragmentation of
a larger datagram), the fragment offset contains the position in the
complete message of the sub message contained within the current
datagram. This enables IP to reassemble fragmented packets in the
proper order. Offsets are always given relative to the beginning of the
message. This is a 13bit field, so offsets are calculated in units of 8 bytes,
corresponding to the maximum packet length of 65,535 bytes. Using the
identification number to indicate which message a receiving datagram
belongs to, the IP layer on a receiving machine can then use the fragment
offset to reassemble the entire message.

Time to Live (TTL)


This field gives the amount of time in seconds that a datagram can remain
on the
Network before it is discarded. This is set by the sending node when the
datagram is assembled. Usually the TTL field is set to 15 or 30 seconds.
The TCP/IP standards stipulate that the TTL field must be decreased by
at least one second for each node that processes the packet, even if the
processing time is less than one second. Also, when a datagram is
received by a gateway, the arrival time is tagged so that if the datagram
must wait to be processed, that time counts against its TTL. Hence, if a
gateway is particularly overloaded and can't get to the datagram in short

© vinod vaze
QB on IT for TY BSc. (IT)

order, the TTL timer can expire while waiting processing, and the
datagram is abandoned. If the TTL field reaches 0, the datagram must be
discarded by the current node, but a message is sent back to the sending
machine when the packet is dropped. The sending machine can then
resend the datagram. The rules governing the TTL field are designed to
prevent IP packets from endlessly circulating through networks.

Transport Protocol
This field holds the identification number of the transport protocol to which
the packet has been handed. The numbers are defined by the Network
Information Center (NIC), which governs the Internet. There are currently
about 50 protocols defined and assigned a transport protocol number.
The two most important protocols are ICMP (detailed in the section titled
"Internet Control Message Protocol (ICMP)" later today), which is number
1, and TCP, which is number 6. The full list of numbers is not necessary
here because most of the protocols are never encountered by users. (If
you really want this information, it’s in several RFCs mentioned in the
appendixes.)

Header Checksum
The number in this field of the IP header is a checksum for the protocol
header
Field (but not the data fields) to enable faster processing. Because the
Time to Live (TTL) field is decremented at each node, the checksum also
changes with every machine the datagram passes through. The
checksum algorithm takes the ones complement of the 16bit sum of all
16bit words. This is a fast, efficient algorithm, but it misses some unusual
corruption circumstances such as the loss of an entire 16bit word that
contains only 0s. However, because the data checksums used by both
TCP and UDP cover the entire packet, these types of errors usually can
be caught as the frame is assembled for the network transport.

Sending Address and Destination Address


These fields contain the 32bitIP addresses of the sending and destination
devices. These fields are established when the datagram is created and
are not altered during the routing.

Options
The Options field is optional, composed of several codes of variable
length. If more than one option is used in the datagram, the options
appear consecutively in the IP header. All the options are controlled by a
byte that is usually divided into three fields: a 1bit copy flag, a 2bit option
class, and a 5bit option number. The copy flag is used to stipulate how the
option is handled when fragmentation is necessary in a gateway. When
the bit is set to 0, the option should be copied to the first datagram but not
subsequent ones. If the bit is set to 1, the option is copied to all the

© vinod vaze
QB on IT for TY BSc. (IT)

datagram. The option class and option number indicate the type of option
and its particular value. At present, there are only two option classes set.
(With only 2 bits to work with in the field, a maximum of four options could
be set.) When the value is 0, the option applies to datagram or network
control. A value of 2 means the option is for debugging or administration
purposes. Values of 1 and 3 are unused. Currently supported values for
the option class and number are given in Table 3.1. Of most interest to
you are options that enable the routing and timestamps to be recorded.
These are used to provide a record of a datagram's passage across the
internet work, which can be useful for diagnostic purposes. Both these
options add information to a list contained within the datagram. (The
timestamp has an interesting format: it is expressed in milliseconds since
midnight, Universal Time. Unfortunately, because most systems have
widely differing time settings—even when corrected to Universal Time—
the timestamps should be treated with more than a little suspicion.) There
are two kinds of routing indicated within the Options field: loose and strict.
Loose routing provides a series of IP addresses that the machine must
pass through, but it enables any route to be used to get to each of these
addresses (usually gateways). Strict routing enables no deviations from
the specified route. If the route can't be followed, the datagram is
abandoned. Strict routing is frequently used for testing routes but rarely
for transmission of user datagram because of the higher chances of the
datagram being lost or abandoned.

Padding
The content of the padding area depends on the options selected. The
padding is
usually used to ensure that the datagram header is a round number of
bytes.

A Datagram's Life
To understand how IP and other TCP/IP layers work to package and send
a datagram from one machine to another, I take a simplified look at a
typical datagram's passage. When an application must send a datagram
out on the network, it performs a few simple steps. First, it constructs the
IP datagram within the legal lengths stipulated by the local IP
implementation. The checksum is calculated for the data, and then the IP
header is constructed. Next, the first hop (machine) of the route to the
destination must be determined to route the datagram to the destination
machine directly over the local network or to a gateway if the internet work
is used. If routing is important, this information is added to the header
using an option. Finally, the datagram is passed to the network for its
manipulation of the datagram. As a datagram passes along the
internetwork, each gateway performs a series of tests. After the network
layer has stripped off its own header, the gateway IP layer calculates the
checksum and verifies the integrity of the datagram. If the checksums

© vinod vaze
QB on IT for TY BSc. (IT)

don't match, the datagram is discarded and an error message is returned


to the sending device.

Next, the TTL field is decremented and checked. If the datagram has
expired, it is discarded and an error message is sent back to the sending
machine. After determining the next hop of the route, either by analysis of
the target address or from a specified routing instruction within the
Options field of the IP header, the datagram is rebuilt with the new TTL
value and new checksum.

If fragmentation is necessary because of an increase in the datagram's


length or a limitation in the software, the datagram is divided and new
datagram with the correct Header information is assembled. If a routing or
timestamp is required, it is added as well. Finally, the datagram is passed
back to the network layer. When the datagram is finally received at the
destination device, the system performs a checksum calculation and—
assuming the two sums match—checks to see if there are other
fragments.

If more datagram are required to reassemble the entire message, the


system waits, meanwhile running a timer to ensure that the datagram
arrive within a reasonable time. If all the parts of the larger message have
arrived but the device can't reassemble them before the timer reaches 0,
the datagram is discarded and an error message is returned to the
sender.

Finally, the IP header is stripped off, the original message is reconstructed


if it was fragmented, and the message is passed up the layers to the
upper layer application. If a reply was required, it is then generated and
sent back to the sending device. When extra information is added to the
datagram for routing or timestamp recording, the length of the datagram
can increase. Handling all these conditions is part of IP's forte, for which
practically every problem has a resolution system.

Following fields of the IP header may change from router


to router.
• Total length
• Flags
• Fragmentation offset
• Time to live
• Header checksum

© vinod vaze
QB on IT for TY BSc. (IT)

022 Explain the three way hand shake method for TCP 8
connection
Establishment?

Ans :

Three-way handshaking:
The connection establishment is called as three way handshaking. In this
procedure, an application program called the client, wants to make a
connection with another application program, called the server, using TCP
as the transport layer protocol the three way handshaking procedure
starts with the server. The server program tells its TCP that it is ready to
accept a connection. This is called a request for a passive open. Although
the server TCP is ready to accept any connection from any machine in the
world it can not make connection it self. The client program makes a
request for an active open. A client wishes to connect to a server tells its
TCP that it needs to be connected to a particular server

The steps of the processes as follows:

1. The client sends the first segment, a SYN segment. The segment
included the source and destination port numbers. The destination port
number clearly defines the server to which the clients want to be
connected. The segment also contains the client initialization sequence
number (ISN) used for numbering the bytes of data sent from the client to
the server. If the client wants to define the MSS that it can receive from
the server, it can add the corresponding option here. Also, if the client
needs a large window, it defines the window scale factor here using the
appropriate option. This segment defines the wish of the client to make a
connection with certain parameters.

2. The server sends the second segment, a SYN and AC segment. This
segment has
a dual purpose. First, it acknowledges the receipt of the first segment
using the ACK flag and acknowledgement number field. The
acknowledgement number is the client initialization sequence number
plus one.

The server must also define the client window size second, the segment
is used to number the bytes sent from the server to client. It also contains
the window scale factor option (if needed) to be used by the server and
the MSS defined by the server.

3. The client sends the third segment. This is just an ACK segment. It
acknowledges
The receipts of the second segment sign the ACK flag and

© vinod vaze
QB on IT for TY BSc. (IT)

acknowledgement number field. The acknowledgement number is the


server initialization sequence number plus one. The client must also
define the server window size. A rare situation may occur when both
processes issue an active open. In this case, both TCP’s transmit a
SYN+ACK segment to each other and one single connection is
established between them.

Figure : Three Way handshake

023 Normally a positive close. 8

• The four steps are:

o The client TCP sends the first segment, a FIN segment.

o The server TCP sends the second segment, an ACK segment


to confirm the Receipt of the FIN segment from the client. In this
segment, it uses the Acknowledgement number, which is one

© vinod vaze
QB on IT for TY BSc. (IT)

plus the sequence number received in the FIN segment.

o The server TCP can continue sending data in the server client
direction. When it does not have any more data to send, it
sends the third segment. This segment is a FIN segment.

o The client TCP sends the fourth segment, an ACK segment, to


confirm the receipt of the FIN segment contains the
acknowledgement number, which is one plus the sequence
number is received in the FIN segment from the server.

• Figure : Four Way Handshake


024 Draw the TCP state transition diagram. Explain the states, which the 8
TCP client can attain?

Ans :

A connection progresses through a series of states during its lifetime


(listed below). CLOSED is fictional because it represents the state when
there is no TCB, and therefore, no connection. Briefly the meanings of the
states are:

© vinod vaze
QB on IT for TY BSc. (IT)


• ·
• LISTEN represents waiting for a connection request from any remote
TCP and Port.
• · SYNSENT represents waiting for a matching connection request after
having sent a connection request. ·
• SYNRECEIVED represents waiting for a confirming connection
request
• Acknowledgment after having both received and sent a connection
request .
• · ESTABLISHED represents an open connection, data received can
be delivered
• To the user. The normal state for the data transfer phase of the

© vinod vaze
QB on IT for TY BSc. (IT)

connection .
• · FINWAIT1 represents waiting for a connection termination request
from the Remote TCP or an acknowledgment of the connection
termination request Previously sent .
• FINWAIT2 represents waiting for a connection termination request
from the Remote TCP.
• CLOSEWAIT represents waiting for a connection termination request
from the Local user .
• CLOSING represents waiting for a connection termination request
Acknowledgment from the remote TCP .
• LASTACK represents waiting for an acknowledgment of the
connection Termination request previously sent to the remote TCP
(which includes an Acknowledgment of its connection termination
request) .
• TIMEWAIT represents waiting for enough time to pass to be sure the
remote TCP received the acknowledgment of its connection
termination request.
• CLOSED represents no connection state at all.
• A TCP connection progresses from one state to another in response to
events. The events are the user calls, OPEN, SEND, RECEIVE,
CLOSE, ABORT, and STATUS; The incoming segments, particularly
those containing the SYN, ACK, RST and FIN flags; And timeouts .

025 What is Kern’s Algorithm?

Ans:

Karn’s Algorithm:

Suppose that a segment is not acknowledged during the retransmission


period and it is therefore retransmitted. When the sending TCP receives
an acknowledgment for this segment, it does not know if the
acknowledgment is for the original segment or for the retransmitted one.

The value of the new RTT therefore must be calculated based on the
departure of the segment. However, if the original segment was lost and
the acknowledgment is for the retransmitted one, the value of the current
RTT must be calculated from the time the segment was retransmitted.

This is a dilemma that was solved by Karn. Karn’s solution is very simple.

Do not consider the RTT of a retransmitted segment in the


calculation of the new RTT. Do not update the value of RTT until you
send a segment and receive an acknowledgment without the need
for retransmission.

© vinod vaze
QB on IT for TY BSc. (IT)

026 What are the syndromes created by TCP sender and receiver? How 4
can these be prevented?

Ans : Syndrome Created by the Sender:

The sending TCP may create a silly window syndrome if it is serving an


application program that creates data slowly, for example, 1byte at a time.
The application program writes 1 byte at a time into the buffer of the
sending TCP. If the sending TCP does not have any specific instructions,
it may create segments containing 1 byte of data. The result is a lot of 41-
byte segments’ that are traveling through an internet.

The solution is to prevent sending TCP from sending this data byte
by byte. The sending TCP must be forced to wait as it collects data to
send in a larger block. How long should the sending TCP wait? If it waits
too long, it may delay the process. If it does not wait long enough, it may
end up sending small segments. Nagle found an elegant solution.

Nagle’s Algorithm:
Nagle Algorithm is very simple, but it solves the problem. This algorithm is
for the sending TCP:

1. The sending TCP sends the first piece of data it receives from the
sending application program even if it is only 1 byte.

2. After sending the first segment, the sending TCP accumulates data
in the output buffer and waits until either the receiving TCP sends
an acknowledgment or until enough data has accumulated to fill a
maximum-size segment. At this time, the sending TCP can send
the segment.

3. Step 2 is repeated for the rest of transmission. Segment 3 must be


sent if an acknowledgment is received for segment 2 or enough
data is accumulated to fill a maximum-size segment.

Syndrome Created by the Receiver:


The receiving TCP may create a silly window syndrome if it is serving an
application program that consumes data slowly, for example, 1 byte at a
time. Suppose that the program consumes data 1 byte at a time. Also
suppose that the input buffer of the receiving TCP is 4K. The sender
sends the first 4 Kbytes of data. The receiver stores it in its buffer. Now its
buffer is full. It advertises a window size, which means the sender should
stop sending data. The receiving application reads the first byte of data
from the input buffer of the receiving TCP. Now there is 1 byte of space in
the incoming buffer. The receiving TCP announces a window size of 1-
byte which means that the sending TCP, which is eagerly waiting to send

© vinod vaze
QB on IT for TY BSc. (IT)

data, takes this advertisement as good news sends a segment carrying


only 1-byte of data. The procedure will continue. One byte of data is
consumed and a segment carrying 1 byte of data is sent. Again we have
efficiency problem and a silly-window syndrome.

Two Solutions have been proposed to prevent the silly window


syndrome created by an application program that consumes data slower
than they arrive.

Clark’s Solution:
Clark’s solution is to send an acknowledgment as soon as the data
arrives, but to announce a window size of zero until either there is enough
space to accommodate a segment of maximum size or until half of the
buffer is empty.
027 What happens when a router receives packets faster than
it processes them? How can such a situation be avoided?

Ans:

1. When a router receives packets than it processes them


then the packets will be discarded. Because the data that
is received is typically buffered in memory, as the
processor cannot deal with it immediately. If there is too
much data arriving to be processed, the data buffer can
often overflow, and all newly arriving data will be
discarded.

2. Thus, there is a need for a mechanism, which can tell hosts


to stop sending data segments, and to wait until the data
has been properly processed. The transport layer copes
with these problems by issuing a Not Ready indicator,
which tells a transmitter not to send any more data, until
the hosts sends a Ready indicator. After this the
transmitter can send data.

028 Transmission control protocol using error control?


What is max size of TCP header? What is the minimum size of TCP
header?

Ans:-

Error Control – Error control refers to the set of procedures that are used
to ensure error free transmission of data over the network. It thus involves
an error detection mechanism and retransmission of messages in which
error were detected.

© vinod vaze
QB on IT for TY BSc. (IT)

Retransmission Timer - To control a lost or discarded segment, TCP


employs a retransmission timer that handles the retransmission time, the
waiting time for an acknowledgement of a segment. When TCP sends a
segment, it creates a retransmission timer for that particular segment.

Two situations may occur :

1) If an acknowledgement is received for this particular segment before


the timer goes off, the timer is destroyed.

2) If the timer goes off before the acknowledgement arrives, the segment
is retransmitted and the timer is reset.

The minimum size of TCP header is 5 words i.e. 20 bytes.

The maximum size of TCP header is 15 words i.e. 60 bytes.

029
What is the state of the connection after each event? What is action
after each event?

Ans:-

States for TCP

• LISTEN
• SYN-SENT
• SYN-RECEIVED
• ESTABLISHED
• FIN-WAIT-1
• FIN-WAIT-2
• CLOSE-WAIT
• CLOSING
• LAST-ACK
• TIME-WAIT
• CLOSED

A TCP connection is in the FIN-WAIT-1 state. In which TCP is


waiting for a connection termination request or an acknowledgment of a
connection termination from the remote TCP.

1. TCP has received the ACK segment for connection termination.

2. A FIN segment is received which indicates that the sender has no

© vinod vaze
QB on IT for TY BSc. (IT)

more data to send. This is the equivalent of an end-of-transmission


marker.
OR

1) Application sends close message

Action : Application will send FIN request to the remote machine.


and then waits for remote machine to send ACK or
acknowledgment. And goes into FIN-WAIT-1 state
State : FIN-WAIT- 1 (Means that application is waiting for ACK to
be received)

2) ACK segment is received

Action : ACK is received from remote machine. As soon as ACK is


received this machine waits for remote machine to send
FIN or connection termination request. And goes into FIN-
WAIT-2 state
State : FIN-WAIT-2 (Sender is waiting for remote machine to get
FIN request)

3) FIN segment is received

Action : as soon as FIN is received from server , client sends ACK


to the server
State : FIN-WAIT-2

4) Application Sends close message

Action : Practically after sending ACK to the server Client waits for
period of time = double the maximum Segment Size to
make sure that Server has received ACK sent before
State : TIME-WAIT

And once the timers expires after double the MSL time connection is
closed.

© vinod vaze
QB on IT for TY BSc. (IT)

States of TCP :

ESTABLISHED, FIN – WAIT – 1, FIN – WAIT – 2, TIME – WAIT,


CLOSED.

i) An ACK segment is received

State of Connection: FIN – WAIT – 2

Action after event: Wait for server to finish

ii) A FIN segment is received

© vinod vaze
QB on IT for TY BSc. (IT)

State of Connection: TIME – WAIT

Action after event: Send ACK, Wait for double Maximum


Segment Life(MSL) Time. And the connection is closed.

030
031

100
ARP (Address Resolution Protocol)
101
102
103
104
105

200
RARP
(reverse Addess Resolution Protocol)

© vinod vaze
QB on IT for TY BSc. (IT)

201 With the help of a neat diagram explain the fields in Reverse Address
Resolution Protocol packet. (October 2005)

RARP packet:

Hardware type Protocol type


Hardware
Protocol address length Opcode
address length
Source hardware address :::
Source protocol address :::
Destination hardware address :::
Destination protocol address :::

Hardware type. 16 bits.

Type Description
1 Ethernet.
2 Experimental Ethernet.
3 Amateur Radio AX.25.
4 Proteon ProNET Token Ring.
5 Chaos.
6 IEEE 802.
7 ARCNET.
8 Hyperchannel.
9 Lanstar.
10 Autonet Short Address.
11 LocalTalk.
12 LocalNet (IBM PCNet or SYTEK LocalNET).
13 Ultra link.
14 SMDS.
15 Frame Relay.
16 ATM, Asynchronous Transmission Mode.
17 HDLC.
18 Fibre Channel.
19 ATM, Asynchronous Transmission Mode.
20 Serial Line.
21 ATM, Asynchronous Transmission Mode.

© vinod vaze
QB on IT for TY BSc. (IT)

22 MIL-STD-188-220.
23 Metricom.
24 IEEE 1394.1995.
25 MAPOS.
26 Twinaxial.
27 EUI-64.
28 HIPARP.

Protocol type. 16 bits.

Protocol Description
0x800 IP.

Hardware address length. 8 bits.


Length of the hardware address in bytes.

Protocol address length. 8 bits.


Length of the protocol address in bytes.

Opcode. 8 bits.

Opcode Description References


Request
3 RFC 903
Reverse.
Reply
4 RFC 903
Reverse.

Source hardware address. Variable length.

Source protocol address. Variable length.

Destination hardware address. Variable length.

Destination protocol address. Variable length.


202 Write a shot note on RARP (November 2004) 4

Ans :-

RARP - It is used by a host to discover its IP address

 The machine can get the physical address by reading the NIC,

© vinod vaze
QB on IT for TY BSc. (IT)

using the RARP protocol.

 A RARP request is created and broadcast on the local network.

 Another machine on the local network that knows all the IP


addresses will respond with RARP reply.

 The requesting machine must be running a RARP client program,


the responding machine must be running a RARP server program

 Packet Format – Same as ARP Packet format


0 8 16 24 31

Hardware Address Type Protocol Address Type

Header Len Paddr Len Operation

Sender address (first 4 octals)

Sender H adder(last 2 octals) Sender Paddr(first 2


octals)

Sender Paddr(last 2 octals) Target Haddr (first 2


octals)

Target Haddr (last 4 octals)

Target Paddr (all 4 octals)

203 The RARP request packets are broadcast; RARP reply packets are 4
unicast, Explain. (May 2005)

Ans :-

© vinod vaze
QB on IT for TY BSc. (IT)

A machine that has its physical address and needs to find its IP address ,
sends a RARP request to all systems on the network.

This packet is received by every host/router on a physical network, but


only the RARP server on the right will answer it.

The server sends back the RARP reply packet that includes the IP
address of the requestor.

204
205
206
207
208
209
210

300
RIP (Routing Information Protocol)
302
Why does the network using routing information protocol become
301 RIP prevents routing loops from continuing indefinitely by 8
implementing a limit on the number of hops allowed in a path from the
source to a destination. The maximum number of hops in a path is 15. If a
router receives a routing update that contains a new or changed entry,
and if increasing the metric value by 1 causes the metric to be infinity (that
is, 16), the network destination is considered unreachable. The downside
of this stability feature is that it limits the maximum diameter of a RIP
network to less than 16 hops.

RIP includes a number of other stability features that are common to


many routing protocols. These features are designed to provide stability
despite potentially rapid changes in a network's topology. For example,
RIP implements the split horizon and holddown mechanisms to prevent
incorrect routing information from being propagated.

Preventing instability

The algorithm as presented up to this point will always allow a host or


gateway to calculate a correct routing table. However, that is still not
quite enough to make it useful in practice. The proofs referred to above
only show that the routing tables will converge to the correct values in

© vinod vaze
QB on IT for TY BSc. (IT)

finite time. They do not guarantee that this time will be small enough to
be useful, nor do they say what will happen to the metrics for networks
that become inaccessible.

We choose a large metric value to represent "infinity". This value must


be large enough that no real metric would ever get that large. For the
purposes of this example, we will use the value 16. Suppose a network
becomes inaccessible. All of the immediately neighboring gateways time
out and set the metric for that network to 16. For purposes of analysis,
we can assume that all the neighboring gateways have gotten a new
piece of hardware that connects them directly to the vanished network,
with a cost of 16. Since that is the only connection to the vanished
network, all the other gateways in the system will converge to new routes
that go through one of those gateways. It is easy to see that once
convergence has happened, all the gateways will have metrics of at least
16 for the vanished network. Gateways one hop away from the original
neighbors would end up with metrics of at least 17; gateways two hops
away would end up with at least 18, etc. As these metrics are larger than
the maximum metric value, they are all set to 16. It is obvious that the
system will now converge to a metric of 16 for the vanished network at
all gateways.

We are trying to show why certain features are needed. Note that the
letters correspond to gateways, and the lines to networks.

A-----B
\ /\
\/ |
C / all networks have cost 1, except
| / for the direct link from C to D, which
|/ has cost 10
D
|<=== target network

Each gateway will have a table showing a route to each network.


However, for purposes of this illustration, we show only the routes from
each gateway to the network marked at the bottom of the diagram.
D: directly connected, metric 1
B: route via D, metric 2
C: route via B, metric 3
A: route via B, metric 3

Now suppose that the link from B to D fails. The routes should now
adjust to use the link from C to D. The routing changes start when B
notices that the route to D is no longer usable. For simplicity, the chart
below assumes that all gateways send updates at the same time. The

© vinod vaze
QB on IT for TY BSc. (IT)

chart shows the metric for the target network, as it appears in the routing
table at each gateway.

time ------>

D: dir, 1 dir, 1 dir, 1 dir, 1 ... dir, 1 dir, 1


B: unreach C, 4 C, 5 C, 6 C, 11 C, 12
C: B, 3 A, 4 A, 5 A, 6 A, 11 D, 11
A: B, 3 C, 4 C, 5 C, 6 C, 11 C, 12

dir = directly connected


unreach = unreachable

Here's the problem: B is able to get rid of its failed route using a timeout
mechanism. But vestiges of that route persist in the system for a long
time. Initially, A and C still think they can get to D via B. So, they keep
sending updates listing metrics of 3. In the next iteration, B will then claim
that it can get to D via either A or C. Of course, it can't. The routes being
claimed by A and C are now gone, but they have no way of knowing that
yet. And even when they discover that their routes via B have gone away,
they each think there is a route available via the other The worst case is
when a network becomes completely inaccessible from some part of the
system. In that case, the metrics may increase slowly in a pattern like the
one above until they finally reach infinity. For this reason, the problem is
called "counting to infinity".

You should now see why "infinity" is chosen to be as small as possible. If


a network becomes completely inaccessible, we want counting to infinity
to be stopped as soon as possible. Infinity must be large enough that no
real route is that big. But it shouldn't be any bigger than required. Thus
the choice of infinity is a tradeoff between network size and speed of
convergence in case counting to infinity happens. The designers of RIP
believed that the protocol was unlikely to be practical for networks with a
diameter larger than 15.

There are several things that can be done to prevent problems like this.
The ones used by RIP are called "split horizon with poisoned reverse",
and "triggered updates".

303
304
305
306
307
308

© vinod vaze
QB on IT for TY BSc. (IT)

309
310

400
OSPF [Open Shortest Path First]

401 Show the autonomous system with the following specifications:


(i) There are eight networks (N1 to N8)
(ii) There are eight routers (R1 to R8)
(iii) N1, N2, N3, N4, AND N5 are Ethernet networks
(iv) N6 is a Token Ring
(v) N7 and N8 are point-to-point networks
(vi) R1 connects N1 and N2
(vii) R2 connects N1 and N7
(viii) R3 connects N2 and N3
(ix) R4 connects N7 and N5
(x) R5 connects N6 and N3
(xi) R6 connects N6 and N4
(xii) R7 connects N6 and N5
(xiii) R8 connects N8 and N5
Draw the graphical representation of the above autonomous
system as seen by OSPF. (May 2004)

© vinod vaze
QB on IT for TY BSc. (IT)

500
BGP [Border Gateway Protocol]
Explain the Path Vector Routing. Compare it with Distance Vector
501 Routing message packet used by Border Gateway and Link State
Ans:

Distance vector and link state routing are both intra-domain routing
protocols. They are used inside an autonomous system, but not between
autonomous systems. Both of these routing protocols become intractable
in large networks and cannot be used in Inter-domain routing. Distance
vector routing is subject to instability if there are more than few hops in
the domain. Link state routing needs huge amount of resources to
calculate routing tables. It also creates heavy traffic because of flooding.

Path vector routing is used for inter-domain routing. It is similar to


Distance vector routing. In path vector routing we assume there is one
node (there can be many) in each autonomous system which acts on
behalf of the entire autonomous system. This node is called the speaker
node. The speaker node creates a routing table and advertises it to
neighboring speaker nodes in neighboring autonomous systems. The idea
is the same as Distance vector routing except that only speaker nodes in
each autonomous system can communicate with each other. The speaker
node advertises the path, not the metric of the nodes, in its autonomous
system or other autonomous systems. Path vector routing is discussed in
RFC 1322; the path vector routing algorithm is somewhat similar to the
distance vector algorithm in the sense that each border router advertises
the destinations it can reach to its neighboring router. However, instead of
advertising networks in terms of a destination and the distance to that
destination, networks are advertised as destination addresses and path

© vinod vaze
QB on IT for TY BSc. (IT)

descriptions to reach those destinations. A route is defined as a pairing


between a destination and the attributes of the path to that destination,
thus the name, path vector routing, where the routers receive a vector that
contains paths to a set of destinations. The path, expressed in terms of
the domains (or confederations) traversed so far, is carried in a special
path attribute that records the sequence of routing domains through which
the reachability information has passed. The path represented by the
smallest number of domains becomes the preferred path to reach the
destination.

BGP Update Message Fields


BGP packets in which the type field in the header identifies the packet to
be a BGP update message packet include the following fields. Upon
receiving an update message packet, routers will be able to add or delete
specific entries from their routing tables to ensure accuracy. Update
messages consist of the following packets:
Unfeasible Routes Length---Indicates the total length of the withdrawn
routes field or that the field is not present.
• Withdrawn Routes---Contains a list of IP address prefixes for
routes being withdrawn from service.
• Total Path Attribute Length---Indicates the
total length of the path attributes field or that the
field is not present.
• Path Attributes---Describes the characteristics of the advertised
path. The following are possible attributes for a path:
• Origin: Mandatory attribute that defines the origin of the path
information
• AS Path: Mandatory attribute composed of a sequence of
autonomous system path segments
• Next Hop: Mandatory attribute that defines the IP address of the
border router that should be used as the next hop to destinations
listed in the network layer reachability information field
• Mult Exit Disc: Optional attribute used to discriminate between
multiple exit points to a neighboring autonomous system
• Local Pref: Discretionary attribute used to specify the degree of
preference for an advertised route
• Atomic Aggregate: Discretionary attribute used to disclose
information about route selections
• Aggregator: Optional attribute that contains information about
aggregate routes
• Network Layer Reachability Information---Contains a list of IP
address prefixes for the advertised routes

© vinod vaze
QB on IT for TY BSc. (IT)

502 What different types of message BGP uses? Explain use of each
Message Type? (May 2005)

Ans:

BGP Message Types


Four BGP message types are specified in RFC 1771, A Border Gateway
Protocol 4 (BGP-4): open message, update message, notification
message, and keep-alive message.
The open message opens a BGP communications session between peers
and is the first message sent by each side after a transport-protocol
connection is established. Open messages are confirmed using a keep-
alive message sent by the peer device and must be confirmed before
updates, notifications, and keep-alive can be exchanged.
An update message is used to provide routing updates to other BGP
systems, allowing routers to construct a consistent view of the network
topology. Updates are sent using the Transmission-Control Protocol
(TCP) to ensure reliable delivery. Update messages can withdraw one or
more unfeasible routes from the routing table and simultaneously can
advertise a route while withdrawing others.
The notification message is sent when an error condition is detected.
Notifications are used to close an active session and to inform any
connected routers of why the session is being closed.
The keep-alive message notifies BGP peers that a device is active. Keep-
alive are sent often enough to keep the sessions from expiring.

In case of OSPF protocol, explain the following terminology


503 i area
ii. Metric
iii. Link
What different types of link exist? What is the purpose of each link
type? (May 2005)

Ans:

An OSPF network can be divided into sub-domains called areas. An area


is a logical collection of OSPF networks, routers, and links that have the
same area identification.. A router within an area must maintain a
topological database for the area to which it belongs. The router doesn't
have detailed information about network topology outside of its area,
thereby reducing the size of its database.

Areas limit the scope of route information distribution. It is not possible to


do route update filtering within an area. The link-state database (LSDB) of
routers within the same area must be synchronized and be exactly the
same; however, route summarization and filtering is possible between

© vinod vaze
QB on IT for TY BSc. (IT)

different areas. The main benefit of creating areas is a reduction in the


number of routes to propagate—by the filtering and the summarization of
routes.
Each OSPF network that is divided into different areas must follow these
rules:
• A backbone area—which combines a set of independent areas into
a single domain—must exist.
• Each non-backbone area must be directly connected to the
backbone area (though this connection might be a simple logical
connection through a virtual link, ).
• The backbone area must not be partitioned—divided into smaller
pieces—under any failure conditions, such as link or router down
events.

Metric
The OSPF allows the administrator to assign a cost, called the metric, to
each route.
The metric can be based on a type of sevice.
As a matter of fact, a router can hav multiple routing tables, each based
on different type of service

Links:
A point-to-point link is a dedicated link that connects exactly two
communication facilities (e.g., two nodes of a network, an intercom station
at an entryway with a single internal intercom station, a radio path
between two points, etc.).
Transience means passing with time. Something which has the property
of transience is said to be transient, or often simply a transient or transient
state.
Example include:
A transient astronomical event is a phenomenon that is relatively short-
lived by astronomical standards. Examples include supernovae, comets,
and meteors.

Virtual link
When the link between two routers is broken , the administration may
create a virtual link between them using a longer path that probably goes
through a several routers.

504

505 What are the different types of message used by Border Gateway 8
Protocol? Explain the Border Gateway Protocol Header; explain the
fields of Open message packet. (October 2005)

© vinod vaze
QB on IT for TY BSc. (IT)

Ans:

All BGP message types use the basic packet header. Open, update, and
notification messages have additional fields, but keep-alive messages use
only the basic packet header. Figure 35-3 illustrates the fields used in the
BGP header. The section that follows summarizes the function of each
field.

BGP Packet-Header Fields


Each BGP packet contains a header whose primary purpose is to identify
the function of the packet in question. The following descriptions
summarize the function of each field in the BGP header illustrated in
Figure 35-3.

· Marker---Contains an authentication value that the message


receiver can predict
· Length---Indicates the total length of the message in bytes.
· Type---Type --- Specifies the message type as one of the following:
· Open
· Update
· Notification
· Keep-alive
· Data---Contains upper-layer information in this optional field.

BGP Open Message Fields


BGP packets in which the type field in the header identifies the packet to
be a BGP open message packet include the following fields. These fields
provide the exchange criteria for two BGP routers to establish a peer
relationship.

• Version---Provides the BGP version number so that the recipient


can determine whether it is running the same version as the
sender.
• Autonomous System---Provides the autonomous system number of
the sender
• Hold-Time---Indicates the maximum number of seconds that can
elapse without receipt of a message before the transmitter is
assumed to be nonfunctional.
• BGP Identifier---Provides the BGP identifier of the sender (an IP
address), which is determined at startup and is identical for all local
interfaces and all BGP peers.
• Optional Parameters Length---Indicates the length of the optional
parameters field (if present).
• Optional Parameters---Contains a list of optional parameters (if
any). Only one optional parameter type is currently defined:

© vinod vaze
QB on IT for TY BSc. (IT)

authentication information.

506 8
State the Dijkstra algorithm and explain with the help of an example
507 (May 2006)

Explain the Path Vector Routing. Compare it with Distance Vector


Routing message packet used by Border Gateway and Link State
Routing. Explain the field of Update Protocol. (May 2006)

Ans:
Distance vector and link state routing are both intra-domain routing
protocols. They are used inside an autonomous system, but not between
autonomous systems. Both of these routing protocols become intractable
in large networks and cannot be used in Inter-domain routing. Distance
vector routing is subject to instability if there are more than few hops in
the domain. Link state routing needs huge amount of resources to
calculate routing tables. It also creates heavy traffic because of flooding.

Path vector routing is used for inter-domain routing. It is similar to


Distance vector routing. In path vector routing we assume there is one
node (there can be many) in each autonomous system which acts on
behalf of the entire autonomous system. This node is called the speaker
node. The speaker node creates a routing table and advertises it to
neighboring speaker nodes in neighboring autonomous systems. The idea
is the same as Distance vector routing except that only speaker nodes in
each autonomous system can communicate with each other. The speaker
node advertises the path, not the metric of the nodes, in its autonomous
system or other autonomous systems. Path vector routing is discussed in
RFC 1322; the path vector routing algorithm is somewhat similar to the
distance vector algorithm in the sense that each border router advertises
the destinations it can reach to its neighboring router. However, instead of
advertising networks in terms of a destination and the distance to that
destination, networks are advertised as destination addresses and path
descriptions to reach those destinations. A route is defined as a pairing
between a destination and the attributes of the path to that destination,
thus the name, path vector routing, where the routers receive a vector that
contains paths to a set of destinations. The path, expressed in terms of
the domains (or confederations) traversed so far, is carried in a special
path attribute that records the sequence of routing domains through which
the reachability information has passed. The path represented by the
smallest number of domains becomes the preferred path to reach the
destination.

BGP Update Message Fields


BGP packets in which the type field in the header identifies the packet to

© vinod vaze
QB on IT for TY BSc. (IT)

be a BGP update message packet include the following fields. Upon


receiving an update message packet, routers will be able to add or delete
specific entries from their routing tables to ensure accuracy. Update
messages consist of the following packets:
Unfeasible Routes Length---Indicates the total length of the withdrawn
routes field or that the field is not present.
• Withdrawn Routes---Contains a list of IP address prefixes for
routes being withdrawn from service.
• Total Path Attribute Length---Indicates the total length of the path
attributes field or that the field is not present.
• Path Attributes---Describes the characteristics of the advertised
path. The following are possible attributes for a path:
• Origin: Mandatory attribute that defines the origin of the path
information
• AS Path: Mandatory attribute composed of a sequence of
autonomous system path segments
• Next Hop: Mandatory attribute that defines the IP address of the
border router that should be used as the next hop to destinations
listed in the network layer reachability information field
• Mult Exit Disc: Optional attribute used to discriminate between
multiple exit points to a neighboring autonomous system
• Local Pref: Discretionary attribute used to specify the degree of
preference for an advertised route
• Atomic Aggregate: Discretionary attribute used to disclose
information about route selections
• Aggregator: Optional attribute that contains information about
aggregate routes
• Network Layer Reachability Information---Contains a list of IP
address prefixes for the advertised routes

508 What different types of message BGP uses? Explain use of each
Message Type? (May 2005)

Ans:

BGP Message Types


Four BGP message types are specified in RFC 1771, A Border Gateway
Protocol 4 (BGP-4): open message, update message, notification
message, and keep-alive message.
The open message opens a BGP communications session between peers
and is the first message sent by each side after a transport-protocol
connection is established. Open messages are confirmed using a keep-

© vinod vaze
QB on IT for TY BSc. (IT)

alive message sent by the peer device and must be confirmed before
updates, notifications, and keep-alive can be exchanged.
An update message is used to provide routing updates to other BGP
systems, allowing routers to construct a consistent view of the network
topology. Updates are sent using the Transmission-Control Protocol
(TCP) to ensure reliable delivery. Update messages can withdraw one or
more unfeasible routes from the routing table and simultaneously can
advertise a route while withdrawing others.
The notification message is sent when an error condition is detected.
Notifications are used to close an active session and to inform any
connected routers of why the session is being closed.
The keep-alive message notifies BGP peers that a device is active. Keep-
alive are sent often enough to keep the sessions from expiring.

509 What are the different types of message used by Border Gateway
Protocol? Explain the Border Gateway Protocol Header; explain the
fields of Open message packet. (October 2005)

Ans:

All BGP message types use the basic packet header. Open, update, and
notification messages have additional fields, but keep-alive messages use
only the basic packet header. Figure 35-3 illustrates the fields used in the
BGP header. The section that follows summarizes the function of each
field.

BGP Packet-Header Fields


Each BGP packet contains a header whose primary purpose is to identify
the function of the packet in question. The following descriptions
summarize the function of each field in the BGP header illustrated in
Figure 35-3.

· Marker---Contains an authentication value that the message


receiver can predict
· Length---Indicates the total length of the message in bytes.
· Type---Type --- Specifies the message type as one of the following:
· Open
· Update
· Notification
· Keep-alive
· Data---Contains upper-layer information in this optional field.

BGP Open Message Fields


BGP packets in which the type field in the header identifies the packet to
be a BGP open message packet include the following fields. These fields

© vinod vaze
QB on IT for TY BSc. (IT)

provide the exchange criteria for two BGP routers to establish a peer
relationship.

• Version---Provides the BGP version number so that the recipient


can determine whether it is running the same version as the
sender.
• Autonomous System---Provides the autonomous system number of
the sender
• Hold-Time---Indicates the maximum number of seconds that can
elapse without receipt of a message before the transmitter is
assumed to be nonfunctional.
• BGP Identifier---Provides the BGP identifier of the sender (an IP
address), which is determined at startup and is identical for all local
interfaces and all BGP peers.
• Optional Parameters Length---Indicates the length of the optional
parameters field (if present).
Optional Parameters---Contains a list of optional parameters (if any). Only
one optional parameter type is currently defined: authentication
information.

510 Ans :-
The LSA types defined in OSPF are as follows:

• Type 1 - Router LSA - the router lists the links to other routers or
networks in the same area, together with the metric. Type 1 LSAs
are flooded across their own area only. The link-state ID of the type
1 LSA is the originating router ID.

• Type 2 - Network LSA - the designated router on a broadcast


segment (e.g. Ethernet) lists which routers are joined together by
the segment. Type 2 LSAs are flooded across their own area only.
The link-state ID of the type 2 LSA is the IP interface address of
the DR.

• Type 3 - Summary LSA - an Area Border Router (ABR) takes


information it has learned on one of its attached areas and it can
summarizes it (but not by default) before sending it out on other
areas it is connected to. This summarization helps provide
scalability by removing detailed topology information for other
areas, because their routing information is summarized into just an
address prefix and metric. The summarization process can also be
configured to remove a lot of detailed address prefixes and replace
them with a single summary prefix, also helping scalability. The

© vinod vaze
QB on IT for TY BSc. (IT)

link-state ID is the destination network number for type 3 LSAs.

• Type 4 - ASBR-Summary LSA - this is needed because Type 5


External LSAs are flooded to all areas and the detailed next-hop
information may not be available in those other areas. This is
solved by an Area Border Router flooding the information for the
router (i.e. the Autonomous System Border Router) where the type
5 originated. The link-state ID is the router ID of the described
ASBR for type 4 LSAs.

• Type 5 - External LSA - these LSAs contain information imported


into OSPF from other routing processes. They are flooded to all
areas (except stub areas). For "External Type 1" LSAs routing
decisions are made by adding the OSPF metric to get to the ASBR
and the external metric from there on, while for "External Type 2"
LSAs only the external metric is used. The link-state ID of the type
5 LSA is the external network number.

511

512

513

514

515

601 Socket Programming

602 Socket Programming

603 Socket Programming

© vinod vaze
QB on IT for TY BSc. (IT)

604 Socket Programming

605 Socket Programming

606 Socket Programming

607 Socket Programming

608
Socket Programming

609 Socket Programming

610 Socket Programming

700
RMI Remote Method Invocation
RMI
701 Write a short note on Marshalling and Un-marshalling. (November
2004)

Ans:-

Marshaling and Un-marshaling


In normal circumstances a program will transmit data using following
steps:
1. Get the Internet address of the remote host.
2. Open a Socket connection to the server
3. Convert the data to be transmitted into an ASCII value or a
byte stream.
4. Read the server response and convert the ASCII value into

© vinod vaze
QB on IT for TY BSc. (IT)

the required type.

The task of converting the argument type to the ASCII is called


Marshaling the value.

The Task of converting the return value to the client data type is called un-
marshaling the value.

In RMI marshaling and un-marshaling are done automatically for objects


as well as primitive data types. To do this, it uses java serialization facility.
It serializes the argument and return values transfers them over the
network and de-serialises them for use. Therefore any object that
implements the interface java.io. serializeable can be sent or received as
a argument or return value.

RMI
702 Write a short note on distributing and installing RMI software (May
2004)

Ans:-

Distributing and Installing RMI Software

RMI adds support for a Distributed Class model to the Java platform and
extends Java technology's reach to multiple JVMs. It should not be a
surprise that installing an RMI system is more involved than setting up a
Java runtime on a single computer. In this section, you will learn about the
issues related to installing and distributing an RMI based system.

For the purposes of this section, it is assumed that the overall process of
designing a DC system has led you to the point where you must consider
the allocation of processing to nodes. And you are trying to determine
how to install the system onto each node.

703 Ans:-

RMI Architecture Layers

With an understanding of the high-level RMI architecture, take a look


under the covers to see its implementation.

The RMI implementation is essentially built from three abstraction layers.


The first is the Stub and Skeleton layer, which lies just beneath the view
of the developer. This layer intercepts method calls made by the client to

© vinod vaze
QB on IT for TY BSc. (IT)

the interface reference variable and redirects these calls to a remote RMI
service.

The next layer is the Remote Reference Layer. This layer understands
how to interpret and manage references made from clients to the remote
service objects. In JDK 1.1, this layer connects clients to remote service
objects that are running and exported on a server. The connection is a
one-to-one (unicast) link. In the Java 2 SDK, this layer was enhanced to
support the activation of dormant remote service objects via Remote
Object Activation.

The transport layer is based on TCP/IP connections between machines in


a network. It provides basic connectivity, as well as some firewall
penetration strategies.

By using a layered architecture each of the layers could be enhanced or


replaced without affecting the rest of the system. For example, the
transport layer could be replaced by a UDP/IP layer without affecting the
upper layers.

Stub and Skeleton Layer

The stub and skeleton layer of RMI lie just beneath the view of the Java
developer. In this layer, RMI uses the Proxy design pattern as described
in the book, Design Patterns by Gamma, Helm, Johnson and Vlissides. In
the Proxy pattern, an object in one context is represented by another (the
proxy) in a separate context. The proxy knows how to forward method
calls between the participating objects. The following class diagram
illustrates the Proxy pattern.

© vinod vaze
QB on IT for TY BSc. (IT)

In RMI's use of the Proxy pattern, the stub class plays the role of the
proxy, and the remote service implementation class plays the role of the
RealSubject.

A skeleton is a helper class that is generated for RMI to use. The skeleton
understands how to communicate with the stub across the RMI link. The
skeleton carries on a conversation with the stub; it reads the parameters
for the method call from the link, makes the call to the remote service
implementation object, accepts the return value, and then writes the
return value back to the stub.

In the Java 2 SDK implementation of RMI, the new wire protocol has
made skeleton classes obsolete. RMI uses reflection to make the
connection to the remote service object. You only have to worry about
skeleton classes and objects in JDK 1.1 and JDK 1.1 compatible system
implementations.

Remote Reference Layer

The Remote Reference Layers defines and supports the invocation


semantics of the RMI connection. This layer provides a RemoteRef object
that represents the link to the remote service implementation object.

The stub objects use the invoke() method in RemoteRef to forward the
method call. The RemoteRef object understands the invocation semantics
for remote services.

The JDK 1.1 implementation of RMI provides only one way for clients to
connect to remote service implementations: a unicast, point-to-point
connection. Before a client can use a remote service, the remote service
must be instantiated on the server and exported to the RMI system. (If it is
the primary service, it must also be named and registered in the RMI

© vinod vaze
QB on IT for TY BSc. (IT)

Registry).

The Java 2 SDK implementation of RMI adds a new semantic for the
client-server connection. In this version, RMI supports activatable remote
objects. When a method call is made to the proxy for an activatable
object, RMI determines if the remote service implementation object is
dormant. If it is dormant, RMI will instantiate the object and restore its
state from a disk file. Once an activatable object is in memory, it behaves
just like JDK 1.1 remote service implementation objects.

Other types of connection semantics are possible. For example, with


multicast, a single proxy could send a method request to multiple
implementations simultaneously and accept the first reply (this improves
response time and possibly improves availability). In the future, Sun may
add additional invocation semantics to RMI.

Transport Layer

The Transport Layer makes the connection between JVMs. All


connections are stream-based network connections that use TCP/IP.

Even if two JVMs are running on the same physical computer, they
connect through their host computer's TCP/IP network protocol stack.
(This is why you must have an operational TCP/IP configuration on your
computer to run the Exercises in this course). The following diagram
shows the unfettered use of TCP/IP connections between JVMs.

As you know, TCP/IP provides a persistent, stream-based connection


between two machines based on an IP address and port number at each
end. Usually a DNS name is used instead of an IP address; this means
you could talk about a TCP/IP connection between
flicka.magelang.com:3452 and rosa.jguru.com:4432. In the current
release of RMI, TCP/IP connections are used as the foundation for all

© vinod vaze
QB on IT for TY BSc. (IT)

machine-to-machine connections.

On top of TCP/IP, RMI uses a wire level protocol called Java Remote
Method Protocol (JRMP). JRMP is a proprietary, stream-based protocol
that is only partially specified is now in two versions. The first version was
released with the JDK 1.1 version of RMI and required the use of
Skeleton classes on the server. The second version was released with the
Java 2 SDK. It has been optimized for performance and does not require
skeleton classes. (Note that some alternate implementations, such as
BEA Weblogic and NinjaRMI do not use JRMP, but instead use their own
wire level protocol. ObjectSpace's Voyager does recognize JRMP and will
interoperate with RMI at the wire level.) Some other changes with the
Java 2 SDK are that RMI service interfaces are not required to extend
from java.rmi.Remote and their service methods do not necessarily throw
RemoteException.

4
704 RMI
How does RMI overcome the issues arising due to firewalls? Explain
in detail. (November 2004)

Ans:-

Firewall Issues

Firewalls are inevitably encountered by any networked enterprise


application that has to operate beyond the sheltering confines of an
Intranet. Typically, firewalls block all network traffic, with the exception of
those intended for certain "well-known" ports.

Since the RMI transport layer opens dynamic socket connections between
the client and the server to facilitate communication, the JRMP traffic is
typically blocked by most firewall implementations. But luckily, the RMI
designers had anticipated this problem, and a solution is provided by the
RMI transport layer itself. To get across firewalls, RMI makes use of HTTP
tunneling by encapsulating the RMI calls within an HTTP POST request.

Now, examine how HTTP tunneling of RMI traffic works by taking a closer
look at the possible scenarios: the RMI client, the server, or both can be
operating from behind a firewall. The following diagram shows the
scenario where an RMI client located behind a firewall communicates with
an external server.

© vinod vaze
QB on IT for TY BSc. (IT)

In the above scenario, when the transport layer tries to establish a


connection with the server, it is blocked by the firewall. When this
happens, the RMI transport layer automatically retries by encapsulating
the JRMP call data within an HTTP POST request. The HTTP POST
header for the call is in the form:

http://hostname:port

If a client is behind a firewall, it is important that you also set the system
property http.proxyHost appropriately. Since almost all firewalls recognize
the HTTP protocol, the specified proxy server should be able to forward
the call directly to the port on which the remote server is listening on the
outside. Once the HTTP-encapsulated JRMP data is received at the
server, it is automatically decoded and dispatched by the RMI transport
layer. The reply is then sent back to client as HTTP-encapsulated data.

The following diagram shows the scenario when both the RMI client and
server are behind firewalls, or when the client proxy server can forward
data only to the well-known HTTP port 80 at the server.

© vinod vaze
QB on IT for TY BSc. (IT)

In this case, the RMI transport layer uses one additional level of
indirection! This is because the client can no longer send the HTTP-
encapsulated JRMP calls to arbitrary ports as the server is also behind a
firewall. Instead, the RMI transport layer places JRMP call inside the
HTTP packets and send those packets to port 80 of the server. The HTTP
POST header is now in the form

http://hostname:80/cgi-bin/java-rmi?forward=<port>

This causes the execution of the CGI script, java-rmi.cgi, which in turn
invokes a local JVM, unbundles the HTTP packet, and forwards the call to
the server process on the designated port. RMI JRMP-based replies from
the server are sent back as HTTP REPLY packets to the originating client
port where RMI again unbundles the information and sends it to the
appropriate RMI stub.

Of course, for this to work, the java-rmi.cgi script, which is included within
the standard JDK 1.1 or Java 2 platform distribution, must be
preconfigured with the path of the Java interpreter and located within the
web server's cgi-bin directory. It is also equally important for the RMI
server to specify the host's fully-qualified domain name via a system
property upon startup to avoid any DNS resolution problems, as:

java.rmi.server.hostname=host.domain.com

Note: Rather than making use of CGI script for the call forwarding, it is
more efficient to use a servlet implementation of the same. You should be
able to obtain the servlet's source code from Sun's RMI FAQ.

© vinod vaze
QB on IT for TY BSc. (IT)

It should be noted that notwithstanding the built-in mechanism for


overcoming firewalls, RMI suffers a significant performance degradation
imposed by HTTP tunneling. There are other disadvantages to using
HTTP tunneling too. For instance, your RMI application will no longer be
able to multiplex JRMP calls on a single connection, since it would now
follow a discrete request/response protocol. Additionally, using the java-
rmi.cgi script exposes a fairly large security loophole on your server
machine, as now, the script can redirect any incoming request to any port,
completely bypassing your firewalling mechanism. Developers should
also note that using HTTP tunneling precludes RMI applications from
using callbacks, which in itself could be a major design constraint.
Consequently, if a client detects a firewall, it can always disable the
default HTTP tunneling feature by setting the property:

RMI 8
705 Write the programs for the following using RMI:
i To invoke a remote method to find length of a string.
ii. To invoke a remote method to for changing the case of letters in a
given string. (May 2005)

Ans:-

1] To invoke a remote method to find length of a string :-

Import java.io.*;
Import java.net.*;
Class echo Client
{
Public static viod main(String args[])
{
Int port=9999;
Socket s;
String msg=””;

Try
{
Buffer reader br=new buffered reader(new input Stream
Reader(System.in));
InetAddress
Addr=InetAddress.getByName(nul);
S=new Socket(add,port);

Output streamWriter osw=new Output


streamWriter( s.getOutputStream());

© vinod vaze
QB on IT for TY BSc. (IT)

PrintWrite pw=new PrintWriter(osw);


Buffer reader br 1=new Buffer reader (new input Stream
Reader( s.getinputStream());
String str=br.readline();
Pw.println(str);
Pe.flush();
Msg=br1.readline();
System.out.printline(“Answer from Server”+msg);
}
}
Catch(Exception e)
{}
}
}

2] To invoke a remote method to for changing the case of letters in a


given string. (May 2005) : -

Import java.io.*;
Import java.net.*;
Class case Client
{
Public static viod main(String args[])
{
Int port=9999;
Socket s;
String msg=””;

Try
{
Buffer reader br=new buffered reader(new input Stream
Reader(System.in));
InetAddress
Addr=InetAddress.getByName(nul);
S=new Socket(add,port);

Output streamWriter osw=new Output


streamWriter( s.getOutputStream());
PrintWrite pw=new PrintWriter(osw);
Buffer reader br 1=new Buffer reader (new input Stream
Reader( s.getinputStream());
String str=br.readline();
Pw.println(str);

© vinod vaze
QB on IT for TY BSc. (IT)

Pe.flush();
Msg=br1.readline();
System.out.printline(“Answer from Server”+msg);
}
}
Catch(Exception e)
{}
}
}

706 RMI
What are the different types of parameters in RMI? How are they
passed between java virtual machines? (October 2005), (May 2006)

Ans:-

Parameters in RMI

Primitive parameters - When a primitive data type is passed as a


parameter to a remote method, the RMI system passes it by value. RMI
will make a copy of a primitive data type and send it to the remote
method. If a method returns a primitive data type, it is also returned to the
calling JVM by value.
4
Object Parameters - When an object is passed to a remote method, the
semantics change from the case of the single JVM. RMI sends the object
itself, not the reference of object. It is the object that is passed by value,
nor the reference to the object. Similarly when a remote method returns
an object, a copy of the whole object is returned to the calling program.
RMI uses a technology called Object Serialization to transform an object
into a linear format that can then be sent over the network wire.

Remote Object Parameters - A client program can obtain a reference to


a remote object through the RMI registry program. Another way a client
can obtain a remote reference

RMI
707 Explain in detail the steps involved in building a RMI system.
(October 2005)

Ans:-

Assuming that the RMI system is already designed, you take the following
steps to build a system:

© vinod vaze
QB on IT for TY BSc. (IT)

1. Write and compile Java code for interfaces


2. Write and compile Java code for implementation classes
3. Generate Stub and Skeleton class files from the implementation
classes
4. Write Java code for a remote service host program
5. Develop Java code for RMI client program
6. Install and run RMI system

rmiIntf.java : -

import java.rmi.*;
interface rmiIntf extends Remote
{
int add(int a, int b ) throws RemoteException;
}

rmiServerImpl.java : -

import java.rmi.*;
import java.rmi.server.*;
public class rmiServerImpl extends Unicast RemoteObject implements
rmiServerIntf
{
rmiServerImpl()throws RemoteException
{
}
Public int add(int a, int b ) throws RemoteException
{
Return a+b;
}
}

rmiServer.java : -

import java.rmi.*;
import java.net.*;
public class rmiServer
{
Public static viod main(String args[])
{
Try
{
rmiServerImpl adsi=new rmiServerImpl();

© vinod vaze
QB on IT for TY BSc. (IT)

Naming.rebind(“Server”,adsi);
}
Catch(Exception e)
{}
}
}

rmiClient.java : -

import java.rmi.*;
public class rmiClient extends Applet
{
Public static viod main(String args[])
{
rmiIntf=(rmiIntf)Naming.lookup(“Server”);
System.out printline(“Addition:”+rif.add(5,4));
}
}

RMI 8
708 What are the components required to build a working RMI system?
(May 2006)

Ans:-

It is now time to build a working RMI system and get hands-on


experience. In this section, you will build a simple remote calculator
service and use it from a client program.

A working RMI system is composed of several parts.

• Interface definitions for the remote services


• Implementations of the remote services
• Stub and Skeleton files
• A server to host the remote services
• An RMI Naming service that allows clients to find the remote
services
• A class file provider (an HTTP or FTP server)
• A client program that needs the remote services
In the next sections, you will build a simple RMI system in a step-by-step
fashion. You are encouraged to create a fresh subdirectory on your
computer and create these files as you read the text.

To simplify things, you will use a single directory for the client and server
code. By running the client and the server out of the same directory, you

© vinod vaze
QB on IT for TY BSc. (IT)

will not have to set up an HTTP or FTP server to provide the class files.
(Details about how to use HTTP and FTP servers as class file providers
will be covered in the section on Distributing and Installing RMI Software)

Assuming that the RMI system is already designed, you take the following
steps to build a system:

7. Write and compile Java code for interfaces


8. Write and compile Java code for implementation classes
9. Generate Stub and Skeleton class files from the implementation
classes
10. Write Java code for a remote service host program
11. Develop Java code for RMI client program
12. Install and run RMI system

709 8

800
CORBA
What is an Object Adapter as defined in CORBA specification? 8
801 Explain the different types of object adapters. (October 2005)
Ans:-

Object Adapters
The CORBA specification defines the concept of an object adapter. An
object adapter is a framework for implementing CORBA objects. It
provides an API that object implementations use for various low level
services. According to the CORBA specification, an object adapter is
responsible for the following functions:
· Generation and interpretation of object references
· Method invocation
· Security of interactions
· Object and implementation activation and deactivation
· Mapping object references to the corresponding object
implementations
· Registration of implementations
The architecture supports the definition of many kinds of object adapters.
The specification includes the definition of the basic object adapter (BOA).
In the previous section, you saw some server code that uses the services
of VisiBroker's implementation of the BOA. The BOA has been
implemented in various CORBA products. Unfortunately, since the

© vinod vaze
QB on IT for TY BSc. (IT)

specification of the BOA was not complete, the various BOA


implementations differ in some significant ways. This has compromised
server portability.
To address this shortcoming, an entirely new object adapter was added,
the portable object adapter (POA). Unfortunately, the POA is not yet
supported in many products. In any event, the BOA and the POA are
described here.
Activation on Demand by the Basic Object Adapter (BOA)
One of the main tasks of the BOA is to support on-demand object
activation. When a client issues a request, the BOA determines if the
object is currently running and if so, it delivers the request to the object. If
the object is not running, the BOA activates the object and then delivers
the request.

The BOA defines four different models for object activation:


Shared server Multiple active objects share the same server. The
server services requests from multiple clients. The server remains active
until it is deactivated or exits.
Unshared server Only one object is active in the server. The server
exits when the client that caused its activation exits.
Server-per-method Each request results in the creation of a server. The
server exits when the method completes.
Persistent server The server is started by an entity other than the BOA
(you, operating services, etc.). Multiple active objects share the server.
Portable Object Adapter (POA)
According to the specification, "The intent of the POA, as its name
suggests, is to provide an object adapter that can be used with multiple
ORB implementations with a minimum of rewriting needed to deal with
different vendors' implementations." However, most CORBA products do
not yet support the POA.
The POA is also intended to allow persistent objects -- at least, from the
client's perspective. That is, as far as the client is concerned, these
objects are always alive, and maintain data values stored in them, even
though physically, the server may have been restarted many times, or the
implementation may be provided by many different object
implementations.
The POA allows the object implementor a lot more control. Previously, the
implementation of the object was responsible only for the code that is
executed in response to method requests. Now, additionally, the
implementor has more control over the object's identity, state, storage,
and lifecycle.
The POA has support for many other features, including the following:
· Transparent object activation
· Multiple simultaneous object identities
· Transient objects
· Object ID namespaces

© vinod vaze
QB on IT for TY BSc. (IT)

· Policies including multithreading, security, and object management


· Multiple distinct POAs in a single server with different policies and
namespaces
For more detail on the POA, please see the specification.
A word on multithreading. Each POA has a threading policy that
determines how that particular POA instance will deal with multiple
simultaneous requests. In the single thread model, all requests are
processed one at a time. The underlying object implementations can
therefore be lazy and thread-unsafe. Of course, this can lead to
performance problems. In the alternate ORB-controlled model, the ORB is
responsible for creating and allocating threads and sending requests in to
the object implementations efficiently. The programmer doesn't need to
worry about thread management issues; however, the programmer
definitely has to make sure the objects are all thread-safe.

802 CORBA
Explain the CORBA architecture. Discuss the advantages of the
applications built using Common Object Request BrokerArchitecture
(October 2005)

Ans:-

CORBA Architecture

CORBA defines an architecture for distributed objects. The basic CORBA


paradigm is that of a request for services of a distributed object.
Everything else defined by the OMG is in terms of this basic paradigm.
The services that an object provides are given by its interface. Interfaces
are defined in OMG's Interface Definition Language (IDL). Distributed
objects are identified by object references, which are typed by IDL 8
interfaces.
The figure below graphically depicts a request. A client holds an object
reference to a distributed object. The object reference is typed by an
interface. In the figure below the object reference is typed by the Rabbit
interface. The Object Request Broker, or ORB, delivers the request to the
object and returns any results to the client. In the figure, a jump request
returns an object reference typed by the AnotherObject interface.

Object Request BrokerArchitecture:-


The Object Request Broker (ORB) is the CORBA software product that is
used when constructing distributed application components. The ORB’s
primary responsibility is to facilitate the creation and transmission of
request and reply messages that occur between clients and object.

803 8

© vinod vaze
QB on IT for TY BSc. (IT)

CORBA
Enumerate the benefits of distributed applications built using
CORBA Architecture (May 2004)

Ans:-

Distributed Applications

CORBA products provide a framework for the development and execution


of distributed applications. But why would one want to develop a
distributed application in the first place? As you will see later, distribution
introduces a whole new set of difficult issues. However, sometimes there
is no choice; some applications by their very nature are distributed across
multiple computers because of one or more of the following reasons:
· The data used by the application are distributed
· The computation is distributed
· The users of the application are distributed

Data are Distributed


Some applications must execute on multiple computers because the data
that the application must access exist on multiple computers for
administrative and ownership reasons. The owner may permit the data to
be accessed remotely but not stored locally. Or perhaps the data cannot
be co-located and must exist on multiple heterogeneous systems for
historical reasons.

Computation is Distributed
Some applications execute on multiple computers in order to take
advantage of multiple processors computing in parallel to solve some
problem. Other applications may execute on multiple computers in order
to take advantage of some unique feature of a particular system.
Distributed applications can take advantage of the scalability and
heterogeneity of the distributed system.

Users are Distributed


Some applications execute on multiple computers because users of the
application communicate and interact with each other via the application.
Each user executes a piece of the distributed application on his or her
computer, and shared objects, typically execute on one or more servers.
A typical architecture for this kind of application is illustrated below.

Prior to designing a distributed application, it is essential to understand


some of the fundamental realities of the distributed system on which it will
execute.

804

© vinod vaze
QB on IT for TY BSc. (IT)

CORBA

805 CORBA

806 CORBA

900
Wireless LAN

901 What are the Restrictions and potential problems with WLAN?

Ans:

Radio signal interference


Radio signal interference in WLAN systems can go two ways: The WLAN
can cause interference to other devices operating in or near it’s frequency
band. Or conversely, other devices can interfere with WLAN operation,
provided their signal is stronger. The result is a scrambled signal, which of
course prevents the nodes from exchanging information between each
other or access points. WLANs using infrared technology generally
experience line-of-sight problems. An object blocking this line between the
two WLAN units is very likely to interrupt the transmission of data.

Connection problem
TCP/IP provides reliable connection over wired LANs, but in WLAN it is
susceptible to losing connections, especially when the terminal is
operating within the marginal WLAN coverage. Another connection
related issue is IP addressing. The wireless terminals can roam between
access points in the same IP subnet but connections are lost if the
terminal moves from one IP subnet to another.

Network security
This is an important aspect in WLAN. It is difficult to restrict access to a
WLAN physically, because radio signals can propagate outside the
intended coverage of a specific WLAN, for example an office building.
Some security measures against the problem are using encryption,
access control lists on the access points and network identifier codes. The
technical operation of WLANs also works against the intruder: Frequency
hopping and direct sequence operation makes eavesdropping impossible
for everyone else than the most sophisticated.

© vinod vaze
QB on IT for TY BSc. (IT)

902 Explain data transfer in WLAN using Infrared technology

Ans.:

DEFINITON:-Wireless LAN stands for Wireless Local Area Network. It is a


flexible data communications system implemented to extend or substitute
for, a wired LAN. Radio frequency (RF) technology is used by a wireless
LAN to transmit and receive data over the air, minimizing the need for
wired connections. A WLAN enables data connectivity and user mobility.

WORKING OF WLAN

1. WLANs use radio, infrared and microwave transmission to transmit


data from one point to another without cables.
2. Therefore WLAN offers way to build a Local Area Network without
cables. This WLAN can then be attached to an already existing
larger network, EX:INTERNET
3. A wireless LAN consists of nodes and access points. A node is a
computer or a peripheral (such as a printer) that has a network
adapter, in WLANs case with an antenna. Access points function
as transmitters and receivers between the nodes themselves or
between the nodes and another network.

WLAN data transfer in itself is implemented by one of the following


technologies:
1. Frequency Hopping Spread Spectrum (FHSS)
2. Direct Sequence Spread Spectrum (DSSS)
4. Infrared (IR)

DATA TRANSFER IN WLAN USING INFRARED:-

1. Infrared (IR) systems use very high frequencies, just below visible
light in the electromagnetic spectrum, to carry data.
2. Like light, IR cannot penetrate opaque objects; it is either directed
(line-of-sight) or diffuse technology.
3. Inexpensive directed systems provide very limited range (3 ft) and
are occasionally used in specific WLAN applications.
4. High performance directed IR is impractical for mobile users and is
therefore used only to implement fixed subnetworks.
Diffuse (or reflective) IR WLAN systems do not require line-of-sight, but
cells are limited to individual rooms.

903 Enumerate the benefits of Wireless LAN


(November 2004) & (May 2005)

© vinod vaze
QB on IT for TY BSc. (IT)

The popularity of wireless LANs is a testament primarily to their


convenience, cost efficiency, and ease of integration with other networks
and network components. The majority of computers sold to consumers
today come pre-equipped with all necessary wireless LAN technology.

The benefits of wireless LANs include:

1. Convenience: The wireless nature of such networks allows users to


access network resources from nearly any convenient location within
their primary networking environment (home or office). With the
increasing saturation of laptop-style computers, this is particularly
relevant.

2. Mobility: With the emergence of public wireless networks, users


can access the internet even outside their normal work environment.
Most chain coffee shops, for example, offer their customers a wireless
connection to the internet at little or no cost.

3. Productivity: Users connected to a wireless network can maintain


a nearly constant affiliation with their desired network as they move
from place to place. For a business, this implies that an employee can
potentially be more productive as his or her work can be accomplished
from any convenient location.

4. Deployment: Initial setup of an infrastructure-based wireless


network requires little more than a single access point. Wired
networks, on the other hand, have the additional cost and complexity
of actual physical cables being run to numerous locations (which can
even be impossible for hard-to-reach locations within a building).

5. Expandability: Wireless networks can serve a suddenly-increased


number of clients with the existing equipment. In a wired network,
additional clients would require additional wiring.
6.

7. 6. Cost: Wireless networking hardware is at worst a modest


increase from wired counterparts. This potentially increased cost is
almost always more than outweighed by the savings in cost and
labor associated to running physical cables.

© vinod vaze
QB on IT for TY BSc. (IT)

+ Bits 0– 4–7 8–15 16– 19–31


3 18
0 Version Header Type of Service Total Length
length (now DiffServ
and ECN)
32 Identification Flag Fragment Offset
s
64 Time to Live Protocol Header Checksum
96 Source Address
128 Destination Address
160 Options
160
or Data
192+

© vinod vaze
QB on IT for TY BSc. (IT)

26 --
Congestion Window Size (in
24 --
segments)
22 --
20 -- Time-out
18 --

Multiplicative
16 --Threshold=
14 --16

Decrease
12 -- Threshold=
10 -- 10
08 --
06 --
04 --
02 -- 1 2 3 4 5 6 7 8 9 10 11
12 13 14
Number of transmitted segments 

© vinod vaze

S-ar putea să vă placă și