TCP基础
帧-类型
ip-协议
传输层-端口(应用)
TCP不能分片,ip允许分片
TCP中的MSS(不包含ip头部和tcp头部)最大段尺寸 ,TCP能承载的最大数据
MTU
MTU(1500巨型帧),属于二层以上数据大小
只有IP允许分片,TCP不能分片,二层帧也不能分片
<Huawei>dis in g0/0/0
GigabitEthernet0/0/0 current state : UP
Line protocol current state : DOWN
Description:HUAWEI, AR Series, GigabitEthernet0/0/0 Interface
Route Port,The Maximum Transmit Unit is 1500 #MTU
Internet protocol processing : disabled
---- More ----
[R1-GigabitEthernet0/0/0]ping ?
STRING<1-255> IP address or hostname of a remote system
-a Select source IP address, the default is the IP address of the
output interface
-c Specify the number of echo requests to be sent, the default is
5
-d Specify the SO_DEBUG option on the socket being used
-f Set Don't Fragment flag in packet (IPv4-only)
-s Specify the number of data bytes to be sent, the default is
56bytes
---- More ----
[R1-GigabitEthernet0/0/0]ping -f -s 1500 202.100.1.2 #ping不允许分片,大小1500,-s指的是IP承载的数据大小(不包含IP的头部)
PING 202.100.1.2: 1501 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 202.100.1.2 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
[R1-GigabitEthernet0/0/0]ping -s 1500 202.100.1.2 #ping允许分片
PING 202.100.1.2: 1500 data bytes, press CTRL_C to break
Reply from 202.100.1.2: bytes=1500 Sequence=1 ttl=255 time=100 ms
Reply from 202.100.1.2: bytes=1500 Sequence=2 ttl=255 time=30 ms
Reply from 202.100.1.2: bytes=1500 Sequence=3 ttl=255 time=30 ms
Reply from 202.100.1.2: bytes=1500 Sequence=4 ttl=255 time=30 ms
Reply from 202.100.1.2: bytes=1500 Sequence=5 ttl=255 time=40 ms
--- 202.100.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/46/100 ms
在AR1的g0/0/0口抓取ping -s 1500 202.100.1.2的报文
ICMP消息封装格式,如下图
[R1-GigabitEthernet0/0/0]ping -f -s 1472 202.100.1.2
PING 202.100.1.2: 1472 data bytes, press CTRL_C to break
Reply from 202.100.1.2: bytes=1472 Sequence=1 ttl=255 time=20 ms
Reply from 202.100.1.2: bytes=1472 Sequence=2 ttl=255 time=20 ms
Reply from 202.100.1.2: bytes=1472 Sequence=3 ttl=255 time=10 ms
Reply from 202.100.1.2: bytes=1472 Sequence=4 ttl=255 time=20 ms
Reply from 202.100.1.2: bytes=1472 Sequence=5 ttl=255 time=20 ms
--- 202.100.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/18/20 ms
MSS
head length=固定长度20+options的12=32
TCP
TCP头部
TCP的三次握手和4次挥手
- TCP通过三次握手建立可靠连接
小写的ack是acknowledge number
三次建立过程解释,以打电话比喻,张三(a)想和李四(b)打电话
1、a问b能听到?
2、b回答我可以听到你说话,你能听到我说话吗?
3、a回答我可以听到
双方互相确认可以听到,于是可以通信了
- 主机在关闭连接之前,要确认收到来自对方的ACK
4次挥手
1、a向b说,我要和你分手
2、b回复说我知道了
3、b经过一番考虑(b把自己未处理的事情处理后),向a说,我也要和你分手,请你确认
4、a回复说,我确认,分手吧