Three-way handshake, waving the four basic network management command

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Three-way handshake

Three-way handshake

 CLOSED state is not initiated before the client request, the server request is not received in the CLOSED state also

  First, the client initiates a connection request to the server packet header time request packet SYN = 1, while selecting an initial sequence number SEQ = 1, then the client process passes FYN-SENT state, TCP SYN predetermined segment can not carry data, but it needs to consume a serial number

  After the second time, the server receives the request message, if you agree connections, is a confirmation message. Acknowledgment packet should ACK = 1, SYN = 1, the acknowledgment number is ack = x + 1, and also initializes a sequence number seq = y for themselves, then the server into the SYN-RCVD state, it can not carry data packets , but the same consumption of a sequence number.

  Third, the client receive a confirmation message, but also want to confirm the server side, there is an acknowledgment packet ACK = 1, ack = y + 1, its own serial number is seq = x + 1, this time, TCP connection established, the client enters eSTABLISHED, TCP provisions, ACK segment can carry data, if the data does not carry the serial number is not consumed

    When the server receives confirmation client also enters ESTABLISHED state, after which the two sides can communicate

 

Four waving

  

 

  The first client sends the last byte sequence number +1 disconnection request packet, when the packet header is FIN = 1, the sequence number of the last received data, then the client enters FIN-WAIT- 1 state, TCP packets a predetermined, FIN packets carry data without a need to consume sequence number

  The second server receives the disconnection request message, a confirmation message is disconnected, ACK = 1, ack = u + 1, and bring its own sequence number seq = u, this time into the server CLOSE -WAIT state, TCP upper layers of the application process, the client has no data to send, but the server wants the client to send data, the client can also accept

    When the client receives the server confirmation request, then the client enters the FIN-WAIT-2 state, waiting for the server to send packets to disconnect

  After the third server transmits the final data is completed, the client sends a disconnection request FIN = 1 ack = u + 1, in which the server into the LSTE-ACK (acknowledgment last) state, the client waits for acknowledgment

  第四次 客户端收到服务器发来的断开报文后,必须确认,ACK=1,ack=w+1,而自己的序列号是seq=u+1,此时客户端进入了TIME-WAIT状态。注意此时TCP连接还没有断开,还要等待一段时间,当客户端撤销相应的TCP后,才进入CLOSED状态

    服务器只要收到了客户端的确认报文后,立即进入CLOSED状态

 

子网划分

  网络地址分为A,B,C,E类

    A类  0-127             

    B类  128-191

    C类  192-223

    D类  224-239

    E类  240-254

  主机数=2^主机ID -2

  网络数=2^可变的网络ID位

ifconfig

  语法格式

    ifconfig  网络设备  参数

  常用选项

    up  启用指定网络设备、网卡

    down   关闭指定网络设备,网卡

ip 

  语法格式

    ip [ OPTIONS ] OBJECT { COMMAND | help }

  示例

    显示网络设备信息

    

    关闭一个网络设备

     ip link set dev eth0 down

    为网络添加地址

     

    删除一个网络地址

     

  

nmcli

    查看网卡信息

     

    显示具体的网络接口信息

    

    显示所有设备状态

    

    删除一个网卡连接

    

    添加一个网卡连接

    

    网络接口停用

    

    网络接口启用

    

 

route

    

netstat

  列出所有端口

    

  列出所有处于监听状态的socket

    

  显示每个协议的统计信息

    

  显示PID和进程名

    

 

Guess you like

Origin www.cnblogs.com/maxuebin/p/10994622.html