Third experiment: surf the web layer

table of Contents

  • 0 Personal Information
  • 1 Purpose
  • 2 Experimental content
  • 3. The test report
    • 3.1 Establish a network topology
    • 3.2 Configuration Parameters
    • 3.3 capture, analyze TCP connection establishment
  • 4. Development (not required, but are bonus items)

0 Personal Information

  • Name: Zhou Shengbo
  • Student ID: 201821121117
  • Class: calculated 1814

1 Purpose

  • Using different network router
  • Use the command line router
  • By grabbing HTTP packets, TCP connection establishment process analysis

2 Experimental content

Use Packet Tracer, properly configure the network parameters, by crawling HTTP packets, analyzes the TCP connection establishment procedure.

  • Establish a network topology
  • Configuration parameters
  • Ethereal
  • Analysis of the data packet

3. The test report

3.1 Establish a network topology

Network topology as shown below:

3.2 Configuration Parameters

  • IP address of the client is192.168.1.117,默认网关的地址是192.168.1.118,如下图:

  • IP address of the server is192.168.2.117,默认网关的地址是192.168.2.118,如下图:

Router configuration parameters:

 After the configuration shown three results show ip interface brief contents shown in FIG.

Each command meaning:

• Router> enable # to enter the privileged EXEC mode
• Router # erase startup-config # remove existing configuration on the router
• Router # configure terminal # enter the global configuration mode
• Router (config) #no ip domain-lookup # Disable DNS lookup (aim: to improve the operation response time)
• Router (config) #interface f0 / 0 # selection f0 / 0 interface operation
• Router (config-if) #ip address 192.168.1.118 255.255.255.0 # to modify the interface ip
• Router (config-if) #no shutdown # interface to activate
• Router (config-if) #exit # for back
• Router (config) #interface f0 / 1 # to select f0 / 1 interface operation
• Router (config-if) #ip address 192.168.2.118 255.255.255.0 # to modify the interface ip
• Router (config-if) #no shutdown # interface to activate
• Router (config-if) # router rip # Enable dynamic routing
• Router (config-router) #version 2 # using rip version 2
• Router (config-router) #no auto-summary # turn off the automatic route summarization
• Router(config-router)#network 192.168.1.0
• Router (config-router) #network 192.168.2.0 # Specify Network
• Router (config-router) #end # End
• Router # show ip interface brief # verify the correct IP address and the interface is active

3.3 capture, analyze TCP connection establishment

Gripping the package as follows:

HTTP packets obtained by crawling a TCP packet, the packet caught on FIG contrast, complete the following things:

(1) Draw a schematic view of a TCP connection

As shown below:

(2) Change in number and acknowledgment number

  1. First by Server to create a transmission control module TCB, waiting for a connection request. The PC is first established TCB, while terminal transmits a connection request packet to the Server, this time the header synchronization bit SYN = 1, while selecting an initial sequence number seq = x (0), PC process enters the SYN_SENT state.
  2. Then Server After receiving the request packet segment agreed to set up, then it returns an acknowledgment to the pc. In the acknowledgment segment bit SYN and ACK bits are set to 1, ack = x + 1 (1), seq = y (0), Server process enters SYN_RCVD state.
  3. Then after the PC side sends an acknowledgment to the received acknowledgment Server, ACK = 1, ack value y + 1 (1), seq to x + 1 (1). PC and Server processes are entering ESTABLISHED state.

(3) Q & A: Why we need a third connection establishment handshake

Mainly to prevent failure of the PC and the connection request segment suddenly transferred to the Server, thus producing an error (Server wasted a lot of resources will be the failure of the connection port)

4. Development (not required, but are bonus items)

(1) analyze TCP connection release

TCP connection release diagram:

 

 

1, the data transfer is complete, the client releases the connection with your service sends the message, and stops sending data to close the connection active, active close the TCP connection, the FIN bit set to 1 to terminate the control sequence number seq = u (103) (equal to previously transmitted data sequence number of the last byte plus one), pc end into the FIN-WAIT-1 state.

2, the server sends an acknowledgment after receiving the release request an immediate acknowledgment number ack = u + 1 (104), sequence number seq = v (472) (sequence number equal to the last byte of previously transmitted data plus one). At this time, the client enters the CLOSE-WAIT state. TCP connection into the semi-closed state (the server can continue to send data to the PC, PC does not send).

3, if the server is not transmitting data, the transmitting FIN = 1, seq = w + 1 (472) (sequence number equal to the last byte of previously transmitted data plus one), ack = u + 1 (104) of the message. LAST-ACK state into the server, the PC is in the process FIN-WAIT-2 state.

After 4, PC server receiving the request to release the connection, it sends an acknowledgment, ACK = 1, seq = u + 1 (104), ack = w + 1 (472). Then enter the PC TIME-WAIT state, after 2MSL, really release the connection, enter the CLOSED state.

Figure 1. Why would not the same textbook?

When data is needed because the pc releasable connection server has no data to send, so step 3 and together.

2. Why connection release required handshake?

Because TCP has a semi-closed state. The TCP connection is full-duplex, i.e., data can be simultaneously transmitted in both directions, so that for each direction to be closed off separately. Closing one direction is called a half-close. When one of the data transfer is completed, it sends a FIN to terminate the connection to tell the other direction.

(2) If there are fresh questions can be written by the experiment, and try to solve their own problems

Why establish a connection x = 0?

Usually preceding sequence number equal to the last byte of transmission data plus one, but because there is no previous data transmission before it is empty, it starts from zero.

Guess you like

Origin www.cnblogs.com/xhnhm211117/p/11700725.html