查看: 7851|回复: 14

一个关于seq和ack的问题

[复制链接]
发表于 2008-7-9 18:05:13 | 显示全部楼层 |阅读模式
请高手看看:

我抓到的一个报文

12的seq值是288,但是上一个的ack是289.

我想请问下,12的seq是不是一定应该比上一个的ack大或者相同,不可能比它小。有没人能从很基础的给我讲讲。

小弟在这里谢谢了


     11 16.798328   1.1.1.1         2.2.2.2         TCP      38608 > 1720 [ACK] Seq=249 Ack=289 Win=5840 Len=0

     12 46.819642   2.2.2.2         1.1.1.1         TCP      [TCP Keep-Alive] 1720 > 38608 [ACK] Seq=288 Ack=249 Win=4288 Len=1
                                           .

评分

1

查看全部评分

回复

使用道具 举报

发表于 2008-7-9 18:14:10 | 显示全部楼层
参考http://www.csna.cn/forum.php?mod=viewthread&tid=2218
同一个会话序列号应该是递增的,对2.2.2.2,12号包seq=288,len=1,11号包seq=289,似乎是先发而后至
在做实验?
回复

使用道具 举报

 楼主| 发表于 2008-7-9 19:18:10 | 显示全部楼层
原帖由 oldjiang 于 2008-7-9 18:14 发表
参考http://www.csna.cn/forum.php?mod=viewthread&tid=2218
同一个会话序列号应该是递增的,对2.2.2.2,12号包seq=288,len=1,11号包seq=289,似乎是先发而后至
在做实验?



问题是,我觉得也是递增的。由于1.1.1.1 是我公司设备。2.2.2.2是另一家公司设备。

我现在想找点文档来说明下,是哪里,哪句话定义了,这个seq不能比上一个ack小。

tcp丢太久了。完全搞不明白了。

忘兄弟姐妹指点下,小弟这里谢过了
回复

使用道具 举报

 楼主| 发表于 2008-7-9 19:25:37 | 显示全部楼层
所有的包  
    1 0.000000    10.70.130.34          10.70.159.229         TCP      38608 > 1720 [SYN] Seq=0 Ack=0 Win=5840 Len=0 MSS=1460 TSV=31606655 TSER=0 WS=0

      2 0.001065    10.70.159.229         10.70.130.34          TCP      1720 > 38608 [SYN, ACK] Seq=0 Ack=1 Win=4380 Len=0 MSS=1460

      3 0.004160    10.70.130.34          10.70.159.229         TCP      38608 > 1720 [ACK] Seq=1 Ack=1 Win=5840 Len=0

      4 0.005652    10.70.130.34          10.70.159.229         H.225.0  CS: setup OpenLogicalChannel

      5 0.007309    10.70.159.229         10.70.130.34          TCP      1720 > 38608 [ACK] Seq=1 Ack=249 Win=4288 Len=0

      6 0.015353    10.70.159.229         10.70.130.34          H.225.0  CS: callProceeding

      7 0.017459    10.70.130.34          10.70.159.229         TCP      38608 > 1720 [ACK] Seq=249 Ack=69 Win=5840 Len=0

      8 3.917693    10.70.159.229         10.70.130.34          H.225.0  CS: alerting OpenLogicalChannel

      9 3.919927    10.70.130.34          10.70.159.229         TCP      38608 > 1720 [ACK] Seq=249 Ack=199 Win=5840 Len=0

     10 16.796148   10.70.159.229         10.70.130.34          H.225.0  CS: connect

     11 16.798328   10.70.130.34          10.70.159.229         TCP      38608 > 1720 [ACK] Seq=249 Ack=289 Win=5840 Len=0

     12 46.819642   10.70.159.229         10.70.130.34          TCP      [TCP Keep-Alive] 1720 > 38608 [ACK] Seq=288 Ack=249 Win=4288 Len=1

     13 46.821675   10.70.130.34          10.70.159.229         TCP      [TCP Keep-Alive ACK] 38608 > 1720 [ACK] Seq=249 Ack=289 Win=5840 Len=0

     14 67.845795   10.70.130.34          10.70.159.229         TCP      38608 > 1720 [RST, ACK] Seq=249 Ack=289 Win=5840 Len=0

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?CSNA会员注册

×
回复

使用道具 举报

发表于 2008-7-9 20:12:51 | 显示全部楼层
能否把原始的数据包发上来,我用科来看看,科来有序列号、下一个序列号、确认号、tcp选项等,比较容易跟踪

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?CSNA会员注册

×
回复

使用道具 举报

发表于 2008-7-9 20:23:27 | 显示全部楼层
10号包发了多少字节的数据?89还是90?
回复

使用道具 举报

 楼主| 发表于 2008-7-9 20:29:12 | 显示全部楼层
附件就是原始包

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?CSNA会员注册

×
回复

使用道具 举报

发表于 2008-7-9 21:36:12 | 显示全部楼层
ip包的失序在网络中是很正常的事,你应该是在client与server之间的位置抓取的数据包
回复

使用道具 举报

发表于 2008-7-9 21:43:40 | 显示全部楼层
序列号

ip层总长度字段,减去40字节是数据长度

下一个序列号,应该等于序列号+数据长度

时间差


前三个包都合情合理,是不是10.70.159.229发生了什么错误?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?CSNA会员注册

×
回复

使用道具 举报

发表于 2008-7-9 21:55:03 | 显示全部楼层

回复 8# 的帖子

“失序”,学习了!搜索看到:TCP是一种可靠的传输层协议,它提供了全双工连接的字节流服务。TCP的带宽使它适合于远距离的IP网络,这种网络出现包丢失和包失序的可能性较大。真正是使TCP变得复杂的是流量控制和拥塞控制机制。
流量控制和拥塞控制以前就看的似懂非懂,是否有必要认真研究一下呢?
回复

使用道具 举报

 楼主| 发表于 2008-7-9 22:32:01 | 显示全部楼层
A "keep-alive" mechanism periodically probes the other end of a connection when the connection is otherwise idle, even when there is no data to be sent. The TCP specification does not include a keep-alive mechanism because it could: (1) cause perfectly good connections to break during transient Internet failures; (2) consume unnecessary bandwidth ("if no one is using the connection, who cares if it is still good?"); and (3) cost money for an Internet path that charges for packets.
Some TCP implementations, however, have included a keep-alive mechanism. To confirm that an idle connection is still active, these implementations send a probe segment designed to elicit a response from the peer TCP. Such a segment generally contains SEG.SEQ = SND.NXT-1 and may or may not contain one garbage octet of data. Note that on a quiet connection SND.NXT = RCV.NXT, so that this SEG.SEQ will be outside the window. Therefore, the probe causes the receiver to return an acknowledgment segment, confirming that the connection is still live. If the peer has dropped the connection due to a network partition or a crash, it will respond with a RST instead of an acknowledgment segment.

Unfortunately, some misbehaved TCP implementations fail to respond to a segment with SEG.SEQ = SND.NXT-1 unless the segment contains data. Alternatively, an implementation could determine whether a peer responded correctly to keep-alive packets with no garbage data octet.

A TCP keep-alive mechanism should only be invoked in server applications that might otherwise hang indefinitely and consume resources unnecessarily if a client crashes or aborts a connection during a network failure.



这个资料说,有一种方式是 “ Such a segment generally contains SEG.SEQ = SND.NXT-1 ”,所以我们看到是288=289-1,然后 may or may not contain one garbage octet of data,

文章也说了 ,不幸的是,有些 TCP的实现不支持 SEG.SEQ = SND.NXT-1"some misbehaved TCP implementations fail to respond to a segment with SEG.SEQ = SND.NXT-1" ,但是又来了一个unless ,“ unless the segment contains data”,

我这里有一个包,你看看

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?CSNA会员注册

×

评分

1

查看全部评分

回复

使用道具 举报

 楼主| 发表于 2008-7-9 22:45:57 | 显示全部楼层
苦脑啊。不晓得为啥了。很苦恼,是我们软件所安装的环境太老(红帽7.2 还是其他原因呢)
回复

使用道具 举报

 楼主| 发表于 2008-7-9 22:49:21 | 显示全部楼层
说一句题外话,rfc的英文原版文档,真是可以认真看看啊。很好,很强大啊
回复

使用道具 举报

发表于 2008-7-10 11:52:16 | 显示全部楼层
仔细看了下搂住的数据保,发现上面我的回答太武断了,跟失序无关,真的是由于tcp keepalive造成的,我记得在tcpip详解卷1中并未说道这种实现的机制,不知楼主在11楼所引用的rfc的编号是多少,想看看。
回复

使用道具 举报

 楼主| 发表于 2008-7-10 17:02:38 | 显示全部楼层
rfc1122


4.2.3.6  TCP Keep-Alives


http://www.delphi86.com/html/zyjswd/wlgc/20070805/1364_109.html

谢谢:)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | CSNA会员注册

本版积分规则

快速回复 返回顶部 返回列表