【Computer network experiment】TCP and UDP transmission process simulation and analysis

Experimental content

Simulation and analysis of TCP and UDP transmission process

Purpose

  1. Use a router to connect different networks
  2. Operate the router using the command line
  3. Analyze the process of establishing a TCP connection by capturing HTTP packets
  4. Analyze the UDP packet transmission process by grabbing DNS packets

Experimental requirements

Use Packet Tracer to correctly configure network parameters, analyze the TCP connection establishment process by capturing HTTP packets, and analyze the UDP packet transmission process by capturing DNS packets. Including: establishing network topology, configuring parameters, capturing packets, and analyzing data packets.

Specific steps are as follows:

1 Establish network topology

The network topology diagram is shown in Figure 1:

Figure 1 TCP experiment network topology

 A client PC connects to the router, and the router connects to the server

2 configuration parameters

The IP address of the client is 192.168.1.116, the default gateway is 192.168.1.117, and the domain name server is 192.168.2.116.

The IP address of the server is 192.168.2.116, the default gateway is 192.168.2.117, and the domain name server is 192.168.2.116.

Set the domain name system, enter the domain name and IP address, click the Add button, add domain name service content, and open the DNS service.

Router parameter configuration: Enter the privileged mode, clear the existing configuration of the router; name the router, configure and activate the port; set the address of the G0/0/0 port to 192.168.1.117, and set the address of the G0/0/1 port to 192.168.2.117.

Configure the routing algorithm: connect the two networks 192.168.1.0 and 192.168.2.0.

3 Enter the IP address you created before in the WEB Browser of PC0.

3 Capture TCP packets: Access through PC0 port to view captured TCP packets.

4 Analyze TCP datagrams: analyze the TCP message format and the expressed protocol content.

5 Enter the domain name you created before in the WEB Browser of PC0.

6 Observe the UDP datagrams captured in the Enevt List.

7. Analyze UDP datagram: analyze the UDP message format and the expressed protocol content.

please answer the following question:

(1) Draw a schematic diagram of TCP connection establishment.

(2) Analyze changes in serial number and confirmation number.

Experimental process description

1. 建立网络拓扑结构

2. 配置参数客户端、服务器端IP地址和默认网关、域名服务器,

3.设置域名系统、输入域名和IP地址、添加域名服务内容、打开DNS服务。

4.配置路由器参数、进入特权模式,清楚路由器现有的配置,然后给路由器命名 ,配置并且激活端口。

5.设置G0/0/0和G0/0/1d的端口地址。

6.配置路由算法。

7.抓包并分析UDP传输过程。

8.观察EnevtList捕捉到的UDP数据包。

实验结果

验证配置结果:

 抓包:

查看抓到的报文:

抓包:

Enevt List中捕捉到的UDP数据报:

TCP连接建立示意图:

分析序号和确认号的变化:

1.TCP建立连接:

客户端向服务器发送一个同步数据包请求建立连接,该数据包中,

随机产生一个初始序列号和一个为0的确认号。服务器收到这个同步请求数据包后,会对客户端进行一个同步确认。这个数据包中,序列号(ISN)由服务器随机产生,确认号是客户端的初始序列号+1;

客户端收到这个同步确认数据包后,再对服务器进行一个确认。该数据包中,序列号是上一个同步请求数据包中的确认号值,确认号是服务器的初始序列号+1。

2.TCP传输数据:

 发送数据 :服务器向客户端发送一个带有数据的数据包,该数据包中的序列号和确认号与建立连接第三步的数据包中的序列号和确认号相同;

  确认收到 :客户端收到该数据包,向服务器发送一个确认数据包,该数据包中,序列号是为上一个数据包中的确认号值,而确认号为服务器发送的上一个数据包中的序列号+所该数据包中所带数据的大小。

3.TCP关闭连接:

服务器完成它的数据发送任务后,会主动向客户端发送一个终止数据包,以关闭在这个方向上的TCP连接。该数据包中,序列号为客户端发送的上一个数据包中的确认号值,而确认号为服务器发送的上一个数据包中的序列号+该数据包所带的数据的大小;

客户端收到服务器发送的终止数据包后,将对服务器发送确认信息,以关闭该方向上的TCP连接。这时的数据包中,序列号为第1步中的确认号值,而确认号为第1步的数据包中的序列号+1;

同理,客户端完成它的数据发送任务后,就也会向服务器发送一个终止数据包,以关闭在这个方向上的TCP连接,该数据包中,序列号为服务器发送的上一个数据包中的确认号值,而确认号为客户端发送的上一个数据包中的序列号+该数据包所带数据的大小;

服务器收到客户端发送的终止数据包后,将对客户端发送确认信息,以关闭该方向上的TCP连接。这时在数据包中,序列号为第3步中的确认号值,而确认号为第3步数据包中的序列号+1;

实验内容

TCP和UDP传输过程仿真与分析

实验目的

  1. 使用路由器连接不同的网络
  2. 使用命令行操作路由器
  3. 通过抓取HTTP报文,分析TCP连接建立的过程
  4. 通过抓取DNS报文,分析UDP数据包传输过程

实验要求

使用Packet Tracer,正确配置网络参数,通过抓取HTTP数据包,分析TCP连接建立过程,通过抓取DNS数据包,分析UDP数据包传输过程。包括:建立网络拓扑结构、配置参数、抓包、分析数据包。

具体步骤如下:

1 建立网络拓扑结构

网络拓扑图如图1所示:

图1 TCP实验网络拓扑图

 一台客户端PC连接路由器,路由器再连接服务器server

2 配置参数

客户端的IP地址为192.168.1.116,默认网关为192.168.1.117,域名服务器为192.168.2.116。

服务端的IP地址为192.168.2.116,默认网关为192.168.2.117,域名服务器为192.168.2.116。

设置域名系统,输入域名和IP地址,点击Add按钮,添加域名服务内容,打开DNS服务。

路由器参数配置: 进入特权模式,清除路由器的现有配置;给路由器命名,配置并激活端口;把G0/0/0端口的地址设置为192.168.1.117,把G0/0/1端口的地址设置为192.168.2.117。

配置路由算法:连接192.168.1.0和192.168.2.0两个网络。

3 在PC0的WEB Browser中输入自己之前创建的IP地址。

3 抓TCP包:通过PC0端口访问,查看抓到的TCP报文。

4 分析TCP数据报:分析TCP报文格式以及所表达的协议内容。

5 在PC0的WEB Browser中输入自己之前创建的域名。

6 观察Enevt List中捕捉到的UDP数据报。

7 分析UDP数据报:分析UDP报文格式以及所表达的协议内容。

请回答下列问题:

(1)画出TCP连接建立示意图。

(2)分析序号和确认号的变化。

实验过程描述

1. 建立网络拓扑结构

2. 配置参数客户端、服务器端IP地址和默认网关、域名服务器,

3.设置域名系统、输入域名和IP地址、添加域名服务内容、打开DNS服务。

4.配置路由器参数、进入特权模式,清楚路由器现有的配置,然后给路由器命名 ,配置并且激活端口。

5.设置G0/0/0和G0/0/1d的端口地址。

6.配置路由算法。

7.抓包并分析UDP传输过程。

8.观察EnevtList捕捉到的UDP数据包。

实验结果

验证配置结果:

 抓包:

查看抓到的报文:

抓包:

Enevt List中捕捉到的UDP数据报:

TCP连接建立示意图:

分析序号和确认号的变化:

1.TCP建立连接:

客户端向服务器发送一个同步数据包请求建立连接,该数据包中,

随机产生一个初始序列号和一个为0的确认号。服务器收到这个同步请求数据包后,会对客户端进行一个同步确认。这个数据包中,序列号(ISN)由服务器随机产生,确认号是客户端的初始序列号+1;

客户端收到这个同步确认数据包后,再对服务器进行一个确认。该数据包中,序列号是上一个同步请求数据包中的确认号值,确认号是服务器的初始序列号+1。

2.TCP传输数据:

 发送数据 :服务器向客户端发送一个带有数据的数据包,该数据包中的序列号和确认号与建立连接第三步的数据包中的序列号和确认号相同;

  确认收到 :客户端收到该数据包,向服务器发送一个确认数据包,该数据包中,序列号是为上一个数据包中的确认号值,而确认号为服务器发送的上一个数据包中的序列号+所该数据包中所带数据的大小。

3.TCP关闭连接:

服务器完成它的数据发送任务后,会主动向客户端发送一个终止数据包,以关闭在这个方向上的TCP连接。该数据包中,序列号为客户端发送的上一个数据包中的确认号值,而确认号为服务器发送的上一个数据包中的序列号+该数据包所带的数据的大小;

客户端收到服务器发送的终止数据包后,将对服务器发送确认信息,以关闭该方向上的TCP连接。这时的数据包中,序列号为第1步中的确认号值,而确认号为第1步的数据包中的序列号+1;

同理,客户端完成它的数据发送任务后,就也会向服务器发送一个终止数据包,以关闭在这个方向上的TCP连接,该数据包中,序列号为服务器发送的上一个数据包中的确认号值,而确认号为客户端发送的上一个数据包中的序列号+该数据包所带数据的大小;

服务器收到客户端发送的终止数据包后,将对客户端发送确认信息,以关闭该方向上的TCP连接。这时在数据包中,序列号为第3步中的确认号值,而确认号为第3步数据包中的序列号+1;

Guess you like

Origin blog.csdn.net/m0_67463447/article/details/127852920