TCP 序列号 [英] TCP Sequence Number

查看:78
本文介绍了TCP 序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试了解 TCP 标头的序列号是如何生成的.

I'm trying to understand how the sequence numbers of the TCP header are generated.

在某些地方我读到它是数据包中第一个字节的索引"(link此处),在其他一些网站上,它是一个随机生成的 32 位数字,然后递增.

In some places I read that it is the "index of the first byte in the packet" (link here), on some other sites it is a random 32bit generated number that is then incremented.

我真的不知道哪个是哪个,所以这里有一些问题:

I don't really know which is which, so here are some questions:

  • 初始序列号是如何生成的?(如果有,请提供一个 RFC 编号)
  • 它是如何递增的?
  • 密钥是如何生成的?

我阅读了一些 RFC,例如 RFC 6528RFC 793RFC 1948 但我似乎无法理解实际实现的是哪个.

I read some of the RFCs like RFC 6528, RFC 793, and RFC 1948 but I can't seem to understand which one is actually implemented.

我了解了std"状态,但仍然......

I read about the "std" status but still...

先谢谢你!

推荐答案

TCP 连接的每个端点为其发送的数据包建立一个起始序列号,并在它作为建立连接的一部分发送的 SYN 数据包中发送此编号.

Each endpoint of a TCP connection establishes a starting sequence number for packets it sends, and sends this number in the SYN packet that it sends as part of establishing a connection.

没有要求任何一端在选择起始序列号时都遵循特定的程序.操作系统可以自由使用它喜欢的任何机制,但通常最好选择随机数,因为这样更安全.

There is no requirement for either end to follow a particular procedure in choosing the starting sequence number. The operating system is free to use any mechanism it likes, but generally it's best if it chooses a random number, as this is more secure.

从那个起点开始,任何一端发送的每个数据包都包含两个序列号 - 一个用于指定数据包在流中的位置,以及一个 ACK​​ 序列号,表示接收到的字节数.两个数字都被起始序列号偏移.

From that starting point, each packet sent by either end contains two sequence numbers - one to specify where in the stream the packet is, and an ACK sequence number which signifies the number of bytes received. Both numbers are offset by the starting sequence number.

当然可以在 维基百科中阅读所有相关内容 - 在该页面中查找序列号"获取所有血腥细节.

Read all about it in Wikipedia of course - look for "sequence number" in that page to get all the gory details.

这篇关于TCP 序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆