3rd Job: practice and analyze TCP connection establishment and release

Summary:

This article describes how to use Packet Tracer tool properly configured network parameters, by grabbing HTTP packets to analyze TCP connection establishment and release process.

1. Personal Information

  • Name: Huang Xun
  • Student ID: 201821121104
  • Class: calculated 1814

2. The establishment of the network topology

 FIG network topology as shown above, the network topology is composed of a total of the PC (the PC0), a router and a server (Server0), and three of them are connected.

3. Configuration Parameters

  • IP address of the client is192.168.1.104
  • IP address of the server is192.168.1.105
  • Router configuration parameters:

    • Router>enable             

    • Router#config t     

  • Configuring Fa0 / 0 interface:

    • R(config)#interface f0/0

    • R(config-if)#ip address 192.168.1.105 255.255.255.0

    • R(config-if)#no shutdown 

  • Configuration Fa0 / 1 Interface;

     • R(config)#interface f0/1

    • R(config-if)#ip address 192.168.2.105 255.255.255.0

    • R(config-if)#no shutdown  

  After completing the input router configuration show ip interface brief check the settings are correct, as shown below:

  

 

 

 

4. capture, analyze TCP connection establishment

Open end desktop pc under Web Browser, enter the server's ip address: 192.168.2.104 begin capture. As shown below:

Crawl to the message as follows:

 

TCP packets: 

 

 

 

 

 HTTP messages:

 

By TCP packet header format given in Figure lesson: we can establish the TCP connection analysis.

(1) Draw a schematic view of a TCP connection

As shown below:

 

 (2) Change in number and acknowledgment number

Analysis of two, three figure number corresponding to the three book exchange TCP segment i.e. three-way handshake packets:

  1. 首先由PC端创建传输控制模块TCB。然后向Server发送连接请求报文端,这时候首部中的SYN同步位=1,同时该报文段不能携带数据,故seq=0(x),ack=0(x),TCP客户进程进入SYN_SENT状态。
  2. 然后Server接受到请求报文段后,进行回复确认。在确认报文段中把SYN位和ACK位置为1,并把ack值+1(x+1)变为1。
  3. 然后PC端再次确认,ACK=1,ack值不变为1(x+1),seq值+1变为1(x+1)。(SYN=1时,表明这是一个请求连接或接受连接报文)

 (3)解答:为什么连接建立需要第三次握手

主要是为了防止以及PC失效的连接请求报文段突然又传送到了Server,因而产生错误(Server的许多资源会被失效的连接端口所浪费)

5.分析TCP连接释放

TCP连接释放抓取到的报文如下:

 

 三部分报文分别如下:

 

 同上诉分析TCP连接建立,我们先画出分析图:

 

从TCP报文段中我们可以看到只有三次交换过程:

  1. PC端发出连接释放请求,置ACK,FIN均为1,此时seq=103(即u=103)
  2. Server端收到连接释放请求后,置ACK,FIN为1,将seq=472(即v=472),ack=u+1=103+1=104
  3. PC端在收到Server发出的来连接释放报文后,对此发出确认。在确认报文段中置ACK为1,ack=w+1(不得而知),seq=u+1=103+1=104。

 6.通过该实验产生的新的疑问

实际上,完成了整个实验,实现了TCP连接建立与释放之后,能够发现TCP的连接建立过程与课本中描述的完全相同。但是在完成实验的拓展——TCP连接释放的时候,像上文所述,它的报文交换只有3次,与课本的四报文握手并不一致,其中的一些数据也是不尽相同的。在完成的时候我做出假设是——Server端将第二次和第三次的报文握手过程整合到一个步骤了,这也就是上图中为何一个报文端有两个序号的原因(仅仅是我的大胆假设)。这样似乎能在一定程度上解释与课本不符的原因,但是还遗留了一个问题,在PC端的确认报文中ack=w+1,ack的值是无从得知的(因为并不知道w是之前哪个报文的值),从数据分析是得出了ack=v,也与课文不太一致。总之做完拓展后,我针对TCP连接的释放这方面的理论与实际产生了一定的困惑,希望老师看到能否解释一下?

 

 

                                                                                                            2019-10-19     20:45:20

 

Guess you like

Origin www.cnblogs.com/ylwhxht/p/11704926.html