4 传输层
TCP
TCP包结构
What is the total size of the minimum TCP MTU, including TCP and IP overhead but not including data link layer overhead? 答: 576
TCP报文的最大负载和报文的最小长度 - zhuzhu2016 - 博客园 IP和TCP的头部都是20B TCP默认为536 536+20+20=576
TCP连接管理
Example
TCP uses __ handshake scheme to establish connections. 答:three-way
TCP流量控制
流量控制: 接收方在确认报文段中给出接收窗口大小(rwnd) 单位为字节
接收窗口=接收缓存大小-累积收到的数据
TCP 拥塞控制
拥塞控制: 发送方维护一个拥塞窗口大小(cwnd) 拥塞控制算法还需要一个阈值ssthresh.
发送窗口大小=min(cwnd,rwnd)
- 慢开始: 当cwnd<ssthresh: 先从只发送1个报文段开始 每经过一个RTT,cwnd=cwnd×2 (注意这里的1代表1个MSS,如果问的是KB需要转换)
- 拥塞避免: 当cwnd>ssthresh, 每经过一个RTT,cwnd=cwnd+1 (注意这里的1代表1个MSS,如果MSS=2KB就是每次+2KB)
- 如果超时 ssthresh=cwnd/2,cwnd=1 然后慢开始
- 快恢复: 当收到3个冗余ACK时
- TCP Reno版本:ssthresh=cwnd/2, cwnd=cwnd/2 然后加法增大
- TCP Tahoe: 跟超时一样 (已废弃不用)
例如 ssthresh=9 1->2->4->8->9 这样算4次RTT
Example
Suppose that the TCP congestion window is set to 18 KB and a timeout occurs. How big will the window be if the next four transmission bursts are all successful? Assume that the maximum segment size is 1 KB. 答: 9
如果超时就把最大值减半sshresh=9,cwnd=1. 每次成功后cwnd=2,4,8. 第4次成功后2cwnd>9,所以接下来cwnd=9
Example
In a network that has a maximum TPDU data size of 128 bytes, a maximum TPDU lifetime of 30 sec, and an 8-bit sequence number, what is the maximum data rate per connection?
A sender may not send more than 255 segments, i.e., 255 × 128 × 8 bits, in 30 sec. The data rate is thus no more than 8.704 kbps.
Example
A TCP machine is sending full windows of 65,535 bytes over a 1-Gbps channel that has a 10-msec one-way delay. What is the maximum throughput achievable? What is the line efficiency? (give your answer as xx.x)
maximum througput: 3.3 MB/s
line efficiency 2.6%
One window can be sent every 20 msec. This gives 50 windows/sec, for a maximum data rate of about 3.3 million bytes/sec. The line efficiency is then 26.4 Mbps/1000 Mbps or 2.6 percent.