zzff7298
驱动牛犊
驱动牛犊
  • 注册日期2003-03-04
  • 最后登录2005-01-28
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1310回复:4

请教一个tcpdump的问题?

楼主#
更多 发布于:2003-04-01 21:12
[root@fang root]# tcpdump -vv tcp
tcpdump: listening on eth0
15:40:06.764387 172.22.130.228.32887 > 172.22.130.238.webcache: P 3905307296:3905307852(556) ack 2435919762 win 8250 <nop,nop,timestamp 3304336 59769> (DF) (ttl 64, id 60187, len 608)
15:40:06.931787 172.22.130.238.webcache > 172.22.130.228.32887: . [tcp sum ok] 1:1(0) ack 556 win 63039 <nop,nop,timestamp 60722 3304336> (DF)
(ttl 128, id 60504, len 52)

也上是我用dump 的两个tcp包。请问一下这两个tcp包的包长是多少?我要用来做流量计费。
heehaw
驱动小牛
驱动小牛
  • 注册日期2003-03-20
  • 最后登录2005-04-25
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2003-04-02 07:57
len 608和len 52应该就是包长吧
 :D :D :D :D :D
我热爱生命,但面对现实的社会经常感到无奈,所以只有嘿嘿傻笑 我迷恋科技,但飞速发展的世界使我眼花缭乱,所以必须埋头苦练
hometown
驱动大牛
驱动大牛
  • 注册日期2002-10-24
  • 最后登录2004-05-21
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2003-04-02 08:54
第一个包的数据长度是556, 不包括IP和TCP头,第二个包的数据长度是0, 这是个ACK包。

608 = 556 + 20(IP 头长度) + 32 (20 字节的常规TCP头  + 10 字节的时间戳 + 2字节的NOP, 这是时间戳选项为了对齐4而加的2个NOP)

52 = 20 + 32

[编辑 -  4/2/03 by  hometown]
How fair and how pleasant art thou, O love, for delights!This thy stature is like to a palm tree, and thy breasts to clusters of grapes.I said, I will go up to the palm tree, I will take hold of the boughs thereof: now also thy breasts shall be as clusters of the vine, and the smell of thy nose like apples;And the roof of thy mouth like the best wine for my beloved, that goeth down sweetly, causing the lips of those that are asleep to speak.
zzff7298
驱动牛犊
驱动牛犊
  • 注册日期2003-03-04
  • 最后登录2005-01-28
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2003-04-04 09:41
第一个包的数据长度是556, 不包括IP和TCP头,第二个包的数据长度是0, 这是个ACK包。

608 = 556 + 20(IP 头长度) + 32 (20 字节的常规TCP头  + 10 字节的时间戳 + 2字节的NOP, 这是时间戳选项为了对齐4而加的2个NOP)

52 = 20 + 32

[编辑 -  4/2/03 by  hometown]


给分了先

另外我想问的是,一般计算流量是算608还是算556。
如果算608的话,那么没有登陆上一个网站,也算了流量。
hometown
驱动大牛
驱动大牛
  • 注册日期2002-10-24
  • 最后登录2004-05-21
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2003-04-05 09:29
[quote]第一个包的数据长度是556, 不包括IP和TCP头,第二个包的数据长度是0, 这是个ACK包。

608 = 556 + 20(IP 头长度) + 32 (20 字节的常规TCP头  + 10 字节的时间戳 + 2字节的NOP, 这是时间戳选项为了对齐4而加的2个NOP)

52 = 20 + 32

[编辑 -  4/2/03 by  hometown]


给分了先

另外我想问的是,一般计算流量是算608还是算556。
如果算608的话,那么没有登陆上一个网站,也算了流量。 [/quote]

这个要看ISP的情况了, 不管哪种情况, 都是很容易实现的。 在做这个程序中, 可以设计对两种情况的考虑。 加个选项, 就可以控制这样两种情况
How fair and how pleasant art thou, O love, for delights!This thy stature is like to a palm tree, and thy breasts to clusters of grapes.I said, I will go up to the palm tree, I will take hold of the boughs thereof: now also thy breasts shall be as clusters of the vine, and the smell of thy nose like apples;And the roof of thy mouth like the best wine for my beloved, that goeth down sweetly, causing the lips of those that are asleep to speak.
游客

返回顶部