ping6 ipv6Address -s 1500
Run Code Online (Sandbox Code Playgroud)
此命令将产生一个片段。通过wireshark观察,第一个分片数据包的长度为1496(来自第3层)。由于 MTU 是 1500,我对这个 1496 的长度感到困惑。它从何而来?
这只是我自己关于 IPv6 MTU 的参考。我需要一些问题来添加它 - 我选择了你。
首先是我们的以太网数据包,通常我们会忽略它:
+-------------------------+
| Ethernet - 16 bytes |
| 6 byte destination MAC |
| 6 byte source MAC |
| 4 byte type |
+-------------------------+
| |
/ 1,500 byte payload /
| |
+-------------------------+
Run Code Online (Sandbox Code Playgroud)
现在我们添加 IPv4 或 IPv6 标头:
IPv4 IPv6
+-------------------------+ +-------------------------+
| Ethernet - 12 bytes | | Ethernet - 12 bytes |
| 6 byte destination MAC | | 6 byte destination MAC |
| 6 byte source MAC | | 6 byte source MAC |
| 4 byte type | | 4 byte type |
+-------------------------+ +-------------------------+
| IPv4 - 20 bytes | | IPv6 - 40 bytes |
| 10 byte control flags | | 6 byte control flags |
| 2 byte total length | | 2 byte payload length |
| 4 byte source addr | | 16 byte source addr |
| 4 byte dest addr | | |
+-------------------------+ | 16 byte dest addr |
| | | |
| | +-------------------------|
| | | |
/ 1,480 payload / / 1,460 payload /
| | | |
+-------------------------+ +-------------------------+
Run Code Online (Sandbox Code Playgroud)
接下来我们添加一个 PPPoE 连接的现实,它从 PPPoE PADS 标记的数据包中取出 8 个字节:
+-------------------------+
| Ethernet - 12 bytes |
| 6 byte destination MAC |
| 6 byte source MAC |
| 4 byte type |
+-------------------------+
| PPPoE PADS - 8 bytes |
+-------------------------+
| |
/ 1,492 payload /
| |
+-------------------------+
Run Code Online (Sandbox Code Playgroud)
这减少了可用于 IPv4 和 IPv6 流量的 MTU:
IPv4 IPv6
+-------------------------+ +-------------------------+
| Ethernet - 12 bytes | | Ethernet - 12 bytes |
| 6 byte destination MAC | | 6 byte destination MAC |
| 6 byte source MAC | | 6 byte source MAC |
| 4 byte type | | 4 byte type |
+-------------------------+ +-------------------------+
| PPPoE PADS - 8 bytes | | PPPoE PADS - 8 bytes |
+-------------------------+ +-------------------------+
| IPv4 - 20 bytes | | IPv6 - 40 bytes |
| 10 byte control flags | | 6 byte control flags |
| 2 byte total length | | 2 byte payload length |
| 4 byte source addr | | 16 byte source addr |
| 4 byte dest addr | | |
+-------------------------+ | 16 byte dest addr |
| | | |
| | +-------------------------|
| | | |
/ 1,472 payload / / 1,452 payload /
| | | |
+-------------------------+ +-------------------------+
Run Code Online (Sandbox Code Playgroud)
然后,就我而言,我正在使用Hurricane Electric的6in4 隧道,因为我的 ISP 不提供本地 IPv6 连接。这意味着我的 IPv6 流量包含在 IPv4 数据包中:
IPv4 IPv6
+-------------------------+ +-------------------------+
| Ethernet - 12 bytes | | Ethernet - 12 bytes |
| 6 byte destination MAC | | 6 byte destination MAC |
| 6 byte source MAC | | 6 byte source MAC |
| 4 byte type | | 4 byte type |
+-------------------------+ +-------------------------+
| PPPoE PADS - 8 bytes | | PPPoE PADS - 8 bytes |
+-------------------------+ +-------------------------+
| IPv4 - 20 bytes | | IPv4 - 20 bytes |
| 10 byte control flags | | 10 byte control flags |
| 2 byte total length | | 2 byte total length |
| 4 byte source addr | | 4 byte source addr |
| 4 byte dest addr | | 4 byte dest addr |
+-------------------------+ +-------------------------+
| | | IPv6 - 40 bytes |
| | | 6 byte control flags |
| | | 2 byte payload length |
| | | 16 byte source addr |
| | | |
| | | 16 byte dest addr |
| | | |
| | +-------------------------|
| | | |
/ 1,472 payload / / 1,432 payload /
| | | |
+-------------------------+ +-------------------------+
Run Code Online (Sandbox Code Playgroud)
但重要的数字是MTU,它是 IPv4 或 IPv6 自身可用的大小(包括其标头):
IPv4 IPv6
+-------------------------+ +-------------------------+
| Ethernet - 12 bytes | | Ethernet - 12 bytes |
| 6 byte destination MAC | | 6 byte destination MAC |
| 6 byte source MAC | | 6 byte source MAC |
| 4 byte type | | 4 byte type |
+-------------------------+ +-------------------------+
| PPPoE PADS - 8 bytes | | PPPoE PADS - 8 bytes |
+-------------------------+ +-------------------------+
| | | IPv4 - 20 bytes |
/ MTU = 1492 / | 10 byte control flags |
| | | 2 byte total length |
+-------------------------+ | 4 byte source addr |
| 4 byte dest addr |
+-------------------------+
| |
/ MTU = 1472 |
| |
+-------------------------+
Run Code Online (Sandbox Code Playgroud)
接下来是关于有效载荷大小的混淆,在使用不分段标志ping 某人时使用。ICMP 在 IP 上运行,并添加自己的头开销:
IPv4 IPv6
+-------------------------+ +-------------------------+
| Ethernet - 12 bytes | | Ethernet - 12 bytes |
| 6 byte destination MAC | | 6 byte destination MAC |
| 6 byte source MAC | | 6 byte source MAC |
| 4 byte type | | 4 byte type |
+-------------------------+ +-------------------------+
| IPv4 - 20 bytes | | IPv6 - 40 bytes |
| 10 byte control flags | | 6 byte control flags |
| 2 byte total length | | 2 byte payload length |
| 4 byte source addr | | 16 byte source addr |
| 4 byte dest addr | | |
+-------------------------+ | 16 byte dest addr |
| ICMP - 8 bytes | | |
+-------------------------+ +-------------------------|
| | | ICMP - 8 bytes |
| | +-------------------------+
| | | |
/ 1,472 ping payload / / 1,452 ping payload /
| | | |
+-------------------------+ +-------------------------+
Run Code Online (Sandbox Code Playgroud)
注意:这就是为什么您可以1,452在需要分段之前使用字节有效负载进行ping操作。
就我而言,使用 PPPoE PADS 标签的开销:
IPv4 IPv6
+-------------------------+ +-------------------------+
| Ethernet - 12 bytes | | Ethernet - 12 bytes |
| 6 byte destination MAC | | 6 byte destination MAC |
| 6 byte source MAC | | 6 byte source MAC |
| 4 byte type | | 4 byte type |
+-------------------------+ +-------------------------+
| PPPoE PADS - 8 bytes | | PPPoE PADS - 8 bytes |
+-------------------------+ +-------------------------+
| IPv4 - 20 bytes | | IPv6 - 40 bytes |
| 10 byte control flags | | 6 byte control flags |
| 2 byte total length | | 2 byte payload length |
| 4 byte source addr | | 16 byte source addr |
| 4 byte dest addr | | |
+-------------------------+ | 16 byte dest addr |
| ICMP - 8 bytes | | |
+-------------------------+ +-------------------------|
| | | ICMP - 8 bytes |
| | +-------------------------+
| | | |
/ 1,464 ping payload / / 1,444 ping payload /
| | | |
+-------------------------+ +-------------------------+
Run Code Online (Sandbox Code Playgroud)
我的额外开销6in4:
IPv4 IPv6
+-------------------------+ +-------------------------+
| Ethernet - 12 bytes | | Ethernet - 12 bytes |
| 6 byte destination MAC | | 6 byte destination MAC |
| 6 byte source MAC | | 6 byte source MAC |
| 4 byte type | | 4 byte type |
+-------------------------+ +-------------------------+
| PPPoE PADS - 8 bytes | | PPPoE PADS - 8 bytes |
+-------------------------+ +-------------------------+
| IPv4 - 20 bytes | | IPv4 - 20 bytes |
| 10 byte control flags | | 10 byte control flags |
| 2 byte total length | | 2 byte total length |
| 4 byte source addr | | 4 byte source addr |
| 4 byte dest addr | | 4 byte dest addr |
+-------------------------+ +-------------------------+
| ICMP - 8 bytes | | IPv6 - 40 bytes |
+-------------------------+ | 6 byte control flags |
| | | 2 byte payload length |
| | | 16 byte source addr |
| | | |
| | | 16 byte dest addr |
| | | |
| | +-------------------------|
| | | ICMP - 8 bytes |
| | +-------------------------+
| | | |
/ 1,464 ping payload / / 1,424 ping payload /
| | | |
+-------------------------+ +-------------------------+
Run Code Online (Sandbox Code Playgroud)
您会明白为什么我只能使用 1,424 字节的有效负载进行 ping 操作。
| 归档时间: |
|
| 查看次数: |
7285 次 |
| 最近记录: |