Exp 5

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

Understand the working of “Connection Establishment” in TCP

AIM: To understand the working of connection establishment in TCP.

APPARATUS:
NetSim Software Version 12.0.18

THEORY:

Introduction to VLAN:

When two processes wish to communicate, their TCP’s must first establish a
connection i.e. initialize the status information on each side. Since connections must
be established between unreliable hosts and over the unreliable internet
communication system, a “three-way handshake” with clock-based sequence
numbers is the procedure used to establish a Connection. This procedure normally is
initiated by one TCP and responded by another TCP. The procedure also works if
two TCPs simultaneously initiate the procedure. When simultaneous attempt occurs,
each TCP receives a “SYN” segment which carries no acknowledgement after it has
sent a “SYN”.

The simplest three-way handshake is shown in the following figure:

Fig: Basic 3-Way Handshake for Connection Synchronization


Explanation:

The above figure should be interpreted in the following way. Each line is numbered
for reference purposes. Right arrows (→) indicates the departure of a TCP Segment
from TCP A to TCP B, or arrival of a segment at B from A. Left arrows ( )
indicates the reverse. TCP states represent the state after the departure or arrival of
the segment (whose contents are shown in the center of each line). Segment contents
are shown in abbreviated form, with sequence number, control flags, and ACK field.
In line 2 of the above figure, TCP A begins by sending a SYN segment indicating
that it will use sequence numbers starting with sequence number 100. In line 3, TCP
B sends a SYN
and acknowledges the SYN it received from TCP A. Note that the acknowledgment
field indicates, TCP B is now expecting to hear sequence 101, acknowledging the
SYN which occupied sequence 100. At line 4, TCP A responds with an empty
segment containing an ACK for TCP B's SYN and in line 5, TCP A sends some data.

Network Setup:
Open NetSim and click Examples > Experiments > Connection-Establishment-in-
TCP >

Sample-1 as shown below:

NetSim UI displays the configuration file corresponding to this experiment as shown


below:

PROCEDURE:
The following set of procedures were done to generate this sample.

Step 1: A network scenario is designed in NetSim GUI comprising of 2 Wired


Nodes and 1 L2 Switch in the “Internetworks” Network Library.
Step 2: In the General Properties of Wired Node 1 i.e. Source, Wireshark Capture is
set to Online.

Note: Accept default properties for L2 Switch as well as the Links.

Step 3: Right click on the Application Flow App1 FTP and select Properties or click
on the Application icon present in the top ribbon/toolbar.
An FTP Application is generated from Wired Node 1 i.e. Source to Wired Node 2 i.e.
Destination with File Size remaining 100000 Bytes and File Inter Arrival Time
remaining 5 Seconds.

Step 4: Packet Trace is enabled in the NetSim GUI and hence we can observe the
TCP Three-Way Handshake that occurs before the data packet transmissions.

Step 5: Click on Display Settings > Device IP check box in the NetSim GUI to view
the network topology along with the IP address.

Step 6: Click on Run simulation. The simulation time is set to 10 seconds. In the
Static ARP Configuration tab, Static ARP is set to disable.

Output:
Once the simulation begins, Wireshark starts to capture the packets.

1. NODE-1 (11.1.1.1 as per this scenario) sends a control packet of type


TCP_SYN requesting a connection with NODE-2 (11.1.1.2 as per this
scenario).

2. NODE-2 responds with the control packet of type TCP_SYN_ACK to


NODE-1. This TCP_SYN_ACK is the ACK packet sent for the TCP_SYN
packet.

3. NODE-1 then sends the TCP_ACK to NODE-2 and internally sets its
CONNECTION_STATE as TCP_ESTABLISHED.

Once the connection is established, data transmission starts and we can see the data
packets (of size 1500 bytes) sent from NODE-1 to NODE-2.
TCP Three-way Handshake can be observed in Wireshark as shown below:

way handshake captured in Wireshark

Similarly, users can also see the TCP 3-Way-Handshake using the Packet Trace. To
view the packet trace file, click on “Open Packet Trace” option present in the left-
hand-side of the Results Dashboard.

way handshake captured in NetSim Packet Trace

From the Packet Trace file, we can observe the following:

1. NODE-1 sends TCP_SYN to NODE-2 via SWITCH-3.

2. NODE-2 responds by sending back TCP_SYNACK to NODE-2 via


SWITCH-3.

3. Then NODE-1 sends TCP_ACK to NODE-2 via SWITCH-3 and then starts
sending the data packets to NODE-2.

RESULT:

You might also like