zoukankan      html  css  js  c++  java
  • TCP 3次握手

    node2:/etc/xinetd.d#telnet node2 discard
    
    
    node2:/root#tcpdump -S   -i lo 
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
    
    
    17:09:15.101779 IP node2.48138 > node2.discard: Flags [S], seq 1270350901, win 32792, options [mss 16396,sackOK,TS val 514214654 ecr 0,nop,wscale 7], length 0
    17:09:15.101797 IP node2.discard > node2.48138: Flags [S.], seq 2405243113, ack 1270350902, win 32768, options [mss 16396,sackOK,TS val 514214654 ecr 514214654,nop,wscale 7], length 0
    17:09:15.101807 IP node2.48138 > node2.discard: Flags [.], ack 2405243114, win 257, options [nop,nop,TS val 514214654 ecr 514214654], length 0
    
    17:09:17.077948 IP6 localhost.36239 > localhost.6150: Flags [S], seq 2666384741, win 32752, options [mss 16376,sackOK,TS val 514216630 ecr 0,nop,wscale 7], length 0
    17:09:17.077967 IP6 localhost.6150 > localhost.36239: Flags [R.], seq 0, ack 2666384742, win 0, length 0
    17:09:17.078058 IP localhost.47507 > localhost.6150: Flags [S], seq 1480871900, win 32792, options [mss 16396,sackOK,TS val 514216630 ecr 0,nop,wscale 7], length 0
    
    17:09:17.078066 IP localhost.6150 > localhost.47507: Flags [R.], seq 0, ack 1480871901, win 0, length 0
    17:09:17.438993 IP node2.48138 > node2.discard: Flags [F.], seq 1270350902, ack 2405243114, win 257, options [nop,nop,TS val 514216991 ecr 514214654], length 0
    17:09:17.439415 IP node2.discard > node2.48138: Flags [F.], seq 2405243114, ack 1270350903, win 256, options [nop,nop,TS val 514216992 ecr 514216991], length 0
    17:09:17.439428 IP node2.48138 > node2.discard: Flags [.], ack 2405243115, win 257, options [nop,nop,TS val 514216992 ecr 514216992], length 0
    ^C
    
    这7个T C P报文段仅包含T C P首部。没有任何数据。
    
    源 > 目的: 标志
    
    
    在第1行中,字段1270350901表示分组的序号是1270350901,而报文段中
    数据字节数为 0。t c p d u m p显示这个字段的格式是开始的序号、一个冒号、隐含的结尾序号
    及圆括号内的数据字节数。显示序号和隐含结尾序号的优点是便于了解数据字节数大于 0时的
    隐含结尾序号。这个字段只有在满足条件( 1)报文段中至少包含一个数据字节;或者( 2)
    S Y N、F I N或R S T被设置为1时才显示。图1 8 - 1中的第1、2、4和6行是因为标志比特被置为 1而
    显示这个字段的,在这个例子中通信双方没有交换任何数据。
    
    
    在第2行中,字段ack 1270350902表示确认序号。它只有在首部中的 A C K标志比特被
    设置1时才显示。
    
    
    建立连接协议:
    
    1) 请求端(通常称为客户)发送一个 S Y N段指明客户打算连接的服务器的端口,以及初
    始序号(I S N,在这个例子中为1270350901)。这个S Y N段为报文段1。
    
    
    2) 服务器发回包含服务器的初始序号的 S Y N报文段(报文段2)作为应答。同时,将确认
    序号设置为客户的I S N加1以对客户的S Y N报文段进行确认。一个S Y N将占用一个序号。
    
    seq 2405243113, ack 1270350902
    
    
    客户必须将确认序号设置为服务器的 I S N加1以对服务器的S Y N报文段进行确认(报文
    段3)。
    
    ack 2405243114
    
  • 相关阅读:
    17. Letter Combinations of a Phone Number
    16. 3Sum Closest
    15. 3Sum
    14. Longest Common Prefix
    13. Roman to Integer
    12. Integer to Roman
    11. Container With Most Water
    10. Regular Expression Matching
    9. Palindrome Number
    8. String to Integer (atoi)
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13348576.html
Copyright © 2011-2022 走看看