You are on page 1of 34

CN PROF DEVANSHI DAVE

Unit - 3
1. Describe rdt 2.0, rdt2.1, rdt2.2 and rdt3.0.

Reliable Data Transfer (RDT) 2.0 protocol works on a Reliable Data Transfer over a bit error channel. It is a more realistic
model for checking bit errors that are present in a channel while transferring it may be the bits in the packet are
corrupted. Such bit errors occurs in the physical components of a network when a packet is transmitted, propagated, or
buffered. In this, we will be assuming that all transmitted packets that are received in the order in which they were sent
(whether they are corrupted).

In this condition we ask the user to send ACK (acknowledgement, i.e., the packet that received is correct and it is not
corrupted) or NAK (negative acknowledgement i.e. the packet received is corrupted). In this protocol we detect the error
by using Checksum Field, checksum is a value that represents the number of bits in a transmission message. To check the
checksum value calculated by the end user is even slightly different from the original checksum value, this means that the
packet is corrupted, the mechanism that is needed to allow the receiver to detect bit errors in a packet using checksum is
called Error Detection.

This techniques allow the receiver to detect, and possibly correct packet bit errors. In this we only need to know that this
technique require that extra bits (beyond the bits of original data to be transferred) be sent from the sender to receiver;
these bits will be gathered into the packet checksum field of the RDT 2.0 data packet.

Another technique is Receiver Feedback since the sender and receiver are executing on different end systems, the only
way for the sender to learn of the receiver’s scenario i.e., whether or not a packet was received correctly, it is that the
receiver should provide explicit feedback to the sender. The positive (ACK) and negative acknowledgement (NAK) replies
CN PROF DEVANSHI DAVE

in the message dictation scenario are an example of such feedback. A zero value indicate a NAK and a value of 1 indicate
an ACK.
CN PROF DEVANSHI DAVE
CN PROF DEVANSHI DAVE

Sending Side:

The send side of RDT 2.0 has two states. In one state, the send-side protocol is waiting for data to be passed down from
the upper layer to lower layer . In the other state, the sender protocol is waiting for an ACK or a NAK packet from the
receiver( a feedback). If an ACK packet is received i.e rdt_rcv(rcvpkt) && is ACK(rcvpkt), the sender knows that the most
recently transmitted packet has been received correctly and thus the protocol returns to the state of waiting for data from
the upper layer.

If a NAK is received, the protocol re-transmits the last packet and waits for an ACK or NAK to be returned by the receiver in
response to the re-transmitted data packet. It is important to note that when the receiver is in the wait-for-ACK-or-NAK
state, it can not get more data from the upper layer, that will only happen after the sender receives an ACK and leaves this
state. Thus, the sender will not send a new piece of data until it is sure that the receiver has correctly received the current
packet, due to this behavior of protocol this protocol is also known as Stop and Wait Protocol.
CN PROF DEVANSHI DAVE

Receiving Side:
CN PROF DEVANSHI DAVE

The receiver-site has a single state, as soon as the packet arrives, the receiver replies with either an ACK or a NAK,
depending on whether or not the received packet is corrupted i.e. by using rdt_rcv(rcvpkt) && corrupt(rcvpkt) where a
packet is received and is found to be in error or rdt_rcv(rcvpkt) && not corrupt(rcvpkt) where a packet received is correct.

RDT 2.0 may look as if it works but it has some has some flaws. It is difficult to understand whether the bits to ACK/NAK
packets are actually corrupted or not, if the packet is corrupted how protocol will recover from this errors in ACK or NAK
packets. The difficulty here is that if an ACK or NAK is corrupted, the sender has no way of knowing whether or not the
receiver has correctly received the last piece of transmitted data or not

2. Discuss Stop and wait protocol, GBN Protocol, SR Protocol.

Reliable data transfers are one of the primary concerns in computer networking. This service department lies in the hands
of TCP. Their major flow control protocols – Stop and Wait, Go Back N, and Selective Repeat.

1. Stop and Wait –


The sender sends the packet and waits for the ACK (acknowledgement) of the packet. Once the ACK reaches the
sender, it transmits the next packet in a row. If the ACK is not received, it re-transmits the previous packet again.

2. Go Back N –
The sender sends N packets which are equal to the window size. Once the entire window is sent, the sender then
waits for a cumulative ACK to send more packets. On the receiver end, it receives only in-order packets and discards
out-of-order packets. As in case of packet loss, the entire window would be re-transmitted.
CN PROF DEVANSHI DAVE

3. Selective Repeat –
The sender sends packets of window size N and the receiver acknowledges all packets whether they were received
in order or not. In this case, the receiver maintains a buffer to contain out-of-order packets and sorts them. The
sender selectively re-transmits the lost packet and moves the window forward.

Differences:

Stop and
Properties Wait Go Back N Selective Repeat

Sender window size 1 N N

Receiver Window size 1 1 N

Minimum Sequence number 2 N+1 2N

Efficiency 1/(1+2*a) N/(1+2*a) N/(1+2*a)

Type of Acknowledgement Individual Cumulative Individual


CN PROF DEVANSHI DAVE

Stop and
Properties Wait Go Back N Selective Repeat

In-order delivery Out-of-order delivery as


Supported order at the Receiving end – only well

Number of retransmissions in case of packet


drop 1 N 1

Transmission Type Half duplex Full duplex Full duplex

Implementation difficulty Low Moderate Complex

Where,

 a = Ratio of Propagation delay and Transmission delay,

 At N=1, Go Back N is effectively reduced to Stop and Wait,

 As Go Back N acknowledges the packed cumulatively, it rejects out-of-order packets,


CN PROF DEVANSHI DAVE

 As Selective Repeat supports receiving out-of-order packets (it sorts the window after receiving the packets), it uses
Independent Acknowledgement to acknowledge the packets

3. Discover TCP Connection Management.


Prerequisite – TCP 3-Way Handshake Process
TCP is a connection-oriented protocol and every connection-oriented protocol needs to establish a connection in order to
reserve resources at both the communicating ends.

Connection Establishment –

1. Sender starts the process with the following:

 Sequence number (Seq=521): contains the random initial sequence number generated at the sender side.

 Syn flag (Syn=1): request the receiver to synchronize its sequence number with the above-provided sequence
number.

 Maximum segment size (MSS=1460 B): sender tells its maximum segment size, so that receiver sends datagram
which won’t require any fragmentation. MSS field is present inside Option field in TCP header.

 Window size (window=14600 B): sender tells about his buffer capacity in which he has to store messages from the
receiver.

2. TCP is a full-duplex protocol so both sender and receiver require a window for receiving messages from one another.

 Sequence number (Seq=2000): contains the random initial sequence number generated at the receiver side.
CN PROF DEVANSHI DAVE

 Syn flag (Syn=1): request the sender to synchronize its sequence number with the above-provided sequence
number.

 Maximum segment size (MSS=500 B): sender tells its maximum segment size, so that receiver sends datagram
which won’t require any fragmentation. MSS field is present inside Option field in TCP header.
Since MSSreceiver < MSSsender, both parties agree for minimum MSS i.e., 500 B to avoid fragmentation of packets at
both ends.

Therefore, receiver can send maximum of 14600/500 = 29 packets.

This is the receiver's sending window size.

 Window size (window=10000 B): receiver tells about his buffer capacity in which he has to store messages from the
sender.

Therefore, sender can send a maximum of 10000/500 = 20 packets.

This is the sender's sending window size.

 Acknowledgement Number (Ack no.=522): Since sequence number 521 is received by the receiver so, it makes a
request for the next sequence number with Ack no.=522 which is the next packet expected by the receiver since Syn
flag consumes 1 sequence no.

 ACK flag (ACk=1): tells that the acknowledgement number field contains the next sequence expected by the
receiver.

3. Sender makes the final reply for connection establishment in the following way:
CN PROF DEVANSHI DAVE

 Sequence number (Seq=522): since sequence number = 521 in 1st step and SYN flag consumes one sequence
number hence, the next sequence number will be 522.

 Acknowledgement Number (Ack no.=2001): since the sender is acknowledging SYN=1 packet from the receiver with
sequence number 2000 so, the next sequence number expected is 2001.

 ACK flag (ACK=1): tells that the acknowledgement number field contains the next sequence expected by the sender.
CN PROF DEVANSHI DAVE

Since the connection establishment phase of TCP makes use of 3 packets, it is also known as 3-way Handshaking (SYN, SYN
+ ACK, ACK)

4. Explain TCP Congestion control techniques.


CN PROF DEVANSHI DAVE

TCP uses a congestion window and a congestion policy that avoid congestion. Previously, we assumed that only the
receiver can dictate the sender’s window size. We ignored another entity here, the network. If the network cannot deliver
the data as fast as it is created by the sender, it must tell the sender to slow down. In other words, in addition to the
receiver, the network is a second entity that determines the size of the sender’s window.

Congestion policy in TCP –

1. Slow Start Phase: starts slowly increment is exponential to threshold

2. Congestion Avoidance Phase: After reaching the threshold increment is by 1

3. Congestion Detection Phase: Sender goes back to Slow start phase or Congestion avoidance phase.

Slow Start Phase : exponential increment – In this phase after every RTT the congestion window size increments
exponentially.

Initially cwnd = 1

After 1 RTT, cwnd = 2^(1) = 2

2 RTT, cwnd = 2^(2) = 4

3 RTT, cwnd = 2^(3) = 8

Congestion Avoidance Phase : additive increment – This phase starts after the threshold value also denoted as ssthresh.
The size of cwnd(congestion window) increases additive. After each RTT cwnd = cwnd + 1.

Initially cwnd = i
CN PROF DEVANSHI DAVE

After 1 RTT, cwnd = i+1

2 RTT, cwnd = i+2

3 RTT, cwnd = i+3

Congestion Detection Phase : multiplicative decrement – If congestion occurs, the congestion window size is decreased.
The only way a sender can guess that congestion has occurred is the need to retransmit a segment. Retransmission is
needed to recover a missing packet that is assumed to have been dropped by a router due to congestion. Retransmission
can occur in one of two cases: when the RTO timer times out or when three duplicate ACKs are received.

 Case 1 : Retransmission due to Timeout – In this case congestion possibility is high.

(a) ssthresh is reduced to half of the current window size.


(b) set cwnd = 1
(c) start with slow start phase again.

 Case 2 : Retransmission due to 3 Acknowledgement Duplicates – In this case congestion possibility is less.

(a) ssthresh value reduces to half of the current window size.


(b) set cwnd= ssthresh
(c) start with congestion avoidance phase

Example – Assume a TCP protocol experiencing the behavior of slow start. At 5th transmission round with a threshold
(ssthresh) value of 32 goes into congestion avoidance phase and continues till 10th transmission. At 10th transmission
round, 3 duplicate ACKs are received by the receiver and enter into additive increase mode. Timeout occurs at 16th
transmission round. Plot the transmission round (time) vs congestion window size of TCP segments.
CN PROF DEVANSHI DAVE
CN PROF DEVANSHI DAVE

5. Draw and explain Router architecture in detail.

Router architecture is designed in a way that the routers are equipped to perform two main functions. These functions are
as follows:

 Process routable protocols.

 Use routing protocols to determine the best path.

Let us try to understand the router with the help of architecture:

Architecture of Router

Given below is a diagram which explains the architecture of router:


CN PROF DEVANSHI DAVE

The different factors which help in successful functioning of router are explained below:

Input Port

The input port performs many functions. The physical layer functionality of terminating an incoming physical link to a
router it can perform.
CN PROF DEVANSHI DAVE

It performs the data link layer functionality needed to interoperate with the data link layer functionality on the other side
of the incoming link.

It also performs a lookup and forwarding function so that a datagram forwarded into the switching fabric of the router
emerges at the appropriate output port.

The diagram given below depicts the functioning of an input port in a router:

Output Port

It stores packets received from the switching fabric and transmits those packets on the outgoing link by performing the
link-layer and physical-layer functions. Therefore, the output port performs the reverse data link and physical layer
functionality as the input port.

The diagram given below depicts the functioning of an output port in a router:
CN PROF DEVANSHI DAVE

Switching Fabric

It is the combination of hardware and software which moves data coming in to a network node out by the correct port to
the next node in the network.

Routing Processor

Routing processor executes routing protocols. It maintains routing information and forwarding tables. It also performs
network management functions within the router.

Components of Router

Let us see the internal and external components of routers.

Internal components

The internal components in a router are as follows:


CN PROF DEVANSHI DAVE

 Read-only memory (ROM) − It is used to store the routers bootstrap details,

 Flash memory − It holds the operating systems pictures.

 Random-access memory (RAM) − It is used to store the Routing table and buffered data.

 Nonvolatile random-access memory (NVRAM) − It stores the router’s start-up configuration files. Here the stored
data is non-volatile.

 Network interfaces − It is used to connect routers to networks.

External components

The external components in a router are as follows:

 Virtual terminals − For accessing routers.

 Network management stations.

The Router’s input ports, output ports, and switching fabric all together implement hardware and the forwarding
functions.

The Router's control functions operate at the millisecond or second timescale. These control plane functions are
implemented in software and execute on the routing processor.

6. Explain Virtual Circuit Network and Datagram Network.


CN PROF DEVANSHI DAVE

Virtual circuit and datagram networks are computer networks that provide connection oriented and connectionless
services respectively. Let’s try to understand what they mean.

A transport layer can offer applications connectionless service or connection-oriented service between two processes. For
example, the internet’s transport layer provides each application a choice between two services : UDP, a connectionless
service; or TCP, a connection-oriented service between two hosts. Network-layer connection and connectionless service in
many ways parallel transport layer connection-oriented and connectionless services.

For example, a network layer connection service begins with handshaking between the source and destination host; and a
network layer connectionless service does not have any handshaking preliminaries.

Although the network layer connection and connectionless services have some parallel with transport-layer connection-
oriented and connectionless services, there are crucial differences:

 In the network layer, these services are host-to-host services provided by the network layer for the transport layer.
In the transport layer these services are process-to-process services provided by the transport layer for the
application layer.

 In all major computer network architectures to date (Internet, ATM, frame relay and so on), the network layer
provides either host-to-host connectionless service or host-to-host connection service, but not both. Computer
networks that provide only a connection service at the network layer are called virtual circuit (VC) networks ;
computer networks that provide only a connectionless service at the network layer are called datagram networks .

 The implementations of connection oriented service in the transport layer and the connection service in the
network layer are fundamentally different. We already know that the transport-layer connection-oriented service is
CN PROF DEVANSHI DAVE

implemented at the edge of the network in the end systems; we’ll see shortly that the network-layer connection
service is implemented in the routers in the network core as well as in the end systems.

Virtual circuit and datagram networks are two fundamental classes of computer networks. They use very different
information in making their forwarding decision. Let’s now take a closer look at their implementations.

Virtual Circuit Networks

While the internet is a datagram network, many alternative network architectures – including those of ATM
(Asynchronous Transfer Mode) and frame relay – are virtual circuit networks and, therefore, use connections at the
network layer. These network layer connections are called virtual circuits (VCs). Let’s now consider how a VC service can
be implemented in a computer network.

A VC consists of :

1. a path (that is , a series of links and routers) between the source and destination hosts,

2. VC numbers, one number for each link along the path, and

3. entries in the forwarding table n each router along the path.

A packet belonging to a virtual circuit will carry a VC number in its header. Because a virtual circuit may have a different VC
number on each link, each intervening router must replace the VC number of each traversing packet with a new VC
number. The new VC number is obtained from the forwarding table.

To illustrate the concept, consider the network shown in the figure below:
CN PROF DEVANSHI DAVE

The numbers next to links of R1 in the above figure are the link interface numbers. Suppose now that Host A requests that
the network establish a VC between itself and Host B. Suppose also that the network chooses the path A-R1-R2-B and
assigns VC numbers 12, 22, and 32 to the three links in this path for this virtual circuit. In this case, when a packet in this
VC leaves Host A, the value in the VC number filed in the packet header is 12; when it leaves R1, the value is 22; and when
it leaves R2, the value is 32.

How does the router determine the replacement VC number for a packet traversing the router? For a VC network, each
router’s forwarding table includes VC number translation; for example the forwarding table in R1 might look something
like the table below:
CN PROF DEVANSHI DAVE

Whenever a new VC is established across a router, an entry is added to the forwarding table. Similarly, whenever a VC
terminates, the appropriate entries in each table along its path are removed.

You might be wondering why a packet doesn’t just keep the same VC number on each of the links along its route. The
answer is twofold. First, replacing the number from the link reduces the length of the VC field in the packet header.
Second, and more importantly, VC setup is considerably simplified by permitting a different VC number at each link along
the path of the VC. Specifically, with multiple VC numbers, each link in the path can choose a VC number independently of
the VC numbers chosen at other links along the path. If a common VC number were required for all links along the path,
the routers would have to exchange and process a substantial number of messages to agree on a common VC number
(e.g. one that is not being used by any other existing VC at these routers) to be used for a connection.

In a VC network, the network’s routers must maintain connection state information for the ongoing connections.
Specifically, each time a new connection is established across a router, a new connection entry must be added to the
router’s forwarding table; and each time a connection is released an entry must be removed from the table. Note that
even if there is no VC number translation, it is still necessary to maintain connection state information that associates VC
numbers with output interface numbers. The issue of whether or not a router maintains connection state information for
each ongoing connection is a crucial one.

There are three identifiable phases in a virtual circuit:

 VC Setup : During this setup phase, the sending transport layer contacts the network layer, specifies the receiver’s
address, and waits for the network to set up the VC. The network layer determines the path between sender and
receiver, that is, the series of links and routers through which all packets of the VC will travel. The network layer also
determines the VC number for each link along the path. Finally, the network layer adds an entry in the forwarding
CN PROF DEVANSHI DAVE

table in each router along the path. During VC setup, the network layer may also reserve resources (for example,
bandwidth) along the path of the VC.

 Data Transfer : As shown in the figure below, once the VC has been established, packets can begin to flow along the
VC.

 VC Teardown : This is initiated when the sender (or receiver) informs the network layer of its desire to terminate
the VC. The network layer will then typically inform the end system on the other side of the network of the call
termination and update the forwarding table sin each of the packet routers on the path to indicate that the VC no
longer exists.

There is subtle but important distinction between VC setup at the network layer and connection setup at the transport
layer (for example, the TCP three-way handshake). Connection setup at the transport layer involves only the two end
systems. During transport-layer connection setup, the two end systems alone determine the parameters (for example,
CN PROF DEVANSHI DAVE

initial sequence number and flow-control window size) of their transport-layer connection. Although the two end systems
are aware of the transport-layer connection, the routers within the network are completely oblivious to it. On the other
hand, with a VC network layer, routers along the path between the two end systems are involved in VC setup, and each
router is fully aware of all the VCs passing through it.

The message that the end systems send into the network to initiate or terminate a VC, and the message passed between
the routers to set up the VC (that is, to modify connection state in router tables ) are known as signalling messages, and
the protocols used to exchange these message are often referred to as signalling protocols. VC setup is shown in the
figure above.

Datagram Networks

In a datagram network, each time an end system wants to send a packet, it stamps the packet with the address of the
destination end system and then pops the packet into the network. As shown in the figure below , there is no VC setup
and routers do not maintain any VC state information (because there are no VCs).
CN PROF DEVANSHI DAVE

As a packet is transmitted from source to destination, it passes through a series of routers. Each of these routers uses the
packet’s destination address to forward the packet. Specifically, each router has a forwarding table that maps destination
address to link interfaces; when a packet arrives at the router, the router uses the packet’s destination address to look up
the appropriate output link interface in the forwarding table. The router then intentionally forwards the packet to that
output link interface.

To get some further insight into the lookup operation, let’s look at a specific example. Suppose that all destination
addresses are 32 bits (which just happens to be the length of the destination address in an IP datagram). A brute-force
implementation of the forwarding table would have one entry for every possible destination address. Since there are
more than 4 billion possible addresses, this option is totally out of the question.

Now, let’s further suppose that our router has four links, numbered 0 through 3, and the packets are to be forwarded to
the link interfaces as follows :
CN PROF DEVANSHI DAVE

With this style of forwarding table, the router matches a prefix of the packet’s destination address with the entries in the
table; if there’s a match, the router forwards the packet to a link associated with the match.
CN PROF DEVANSHI DAVE

For example , suppose the packet’s destination address is 11001000 00010110 10100001; because the 21-bit prefix of this
address matches the first entry in the table, the router forwards the packet to link interface 0. If a prefix doesn’t match
any of the first three entries, then the router forwards the packet to interface 3.

Although this sounds simple enough, there’s an important subtlety here. You may have noticed that it is possible for a
destination address to match more than one entry. For example, the first 24 bits of the address 11001000 00010111
00011000 10101010 match the second entry in the table, and the first 21 bits of the address match the third entry in the
table. When there are multiple matches, the router uses the longest prefix matching rule; that is, it finds the longest
matching entry in the table and forwards the packet to the link interface associated with the longest prefix match.

Although routers in datagram networks maintain no connection state information, they nevertheless maintain forwarding
state information in their forwarding tables. However, the time scale at which this forwarding information changes is
relatively slow. Indeed, in a datagram network the forwarding tables are modified by routing algorithms, which typically
update a forwarding table every one-to-five minutes or so. In a VC network, a forwarding table in a router is modified
whenever a new connection is set up through the router or whenever an existing connection through the router is torn
down. This could easily happen at microsecond timescale in a backbone, tier-1 router.

Because forwarding tables in datagram networks can be modified at any time, a series of packets sent from one end
system to another may follow different paths through the network and may arrive out of order.

7. Draw and Explain TCP Header.

Every TCP segment consists of a 20 byte fixed format header. Header options may follow the fixed header. With a header
so that it can tag up to 65535 data bytes.

The TCP header format is shown in the figure below −


CN PROF DEVANSHI DAVE

Source Port

It is a 16-bit source port number used by the receiver to reply.

Destination Port
CN PROF DEVANSHI DAVE

It is a 16-bit destination port number.

Sequence Number

The sequence number of the first data byte in this segment. During the SYN Control bit is set, and the sequence number is
n, and the first data byte is n + 1.

Acknowledgement Number

If the ACK control bit is set, this field contains the next number that the receiver expects to receive.

Data Offset

The several 32-bit words in the TCP header shows from where the user data begins.

Reserved (6 bit)

It is reserved for future use.

URG

It indicates an urgent pointer field that data type is urgent or not.

ACK

It indicates that the acknowledgement field in a segment is significant, as discussed early.

PUSH
CN PROF DEVANSHI DAVE

The PUSH flag is set or reset according to a data type that is sent immediately or not.

RST It Resets the connection.

SYN

It synchronizes the sequence number.

FIN

This indicates no more data from the sender.

Window

It is used in Acknowledgement segment. It specifies the number of data bytes, beginning with the one indicated in the
acknowledgement number field that the receiver is ready to accept.

Checksum

It is used for error detection.

Options

The IP datagram options provide additional punctuality. It can use several optional parameters between a TCP sender and
receiver. It depends on the options used. The length of the field may vary in size, but it can't be larger than 40 bytes due to
the header field's size, which is 4 bit.
CN PROF DEVANSHI DAVE

The most typical option is the maximum segment size MASS option. A TCP receiver communicates to the TCP sender the
total length of the segment it can accept with this option. The other various options are used for flow control and
congestion control, each explained in the table shown in the table.

Table of Options

The table of options in TCP segment header is as follows −

Kind Length Meaning

0 - End of option list

1 - No operation

2 4 Maximum segment size

3 3 Window Scale

4 2 Sack-permitted

5 X Sack
CN PROF DEVANSHI DAVE

Kind Length Meaning

8 10 Time Stamps

Padding

Options in each may vary in size, and it may be necessary to "pad" the TCP header with zeros so that the segment ends on
a 32-bit word boundary as per the standard.

Data

Although in some cases like acknowledgement segments with no data in the reverse direction, the variable-length field
carries the application data from sender to receiver. This field, connected with the TCP header fields, constitute a TCP
segment.

You might also like