xref: /linux/Documentation/translations/zh_CN/networking/vxlan.rst (revision 8d2b0853add1d7534dc0794e3c8e0b9e8c4ec640)
1*f7a57c9cSQiu Yutan.. SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*f7a57c9cSQiu Yutan.. include:: ../disclaimer-zh_CN.rst
3*f7a57c9cSQiu Yutan
4*f7a57c9cSQiu Yutan:Original: Documentation/networking/vxlan.rst
5*f7a57c9cSQiu Yutan
6*f7a57c9cSQiu Yutan:翻译:
7*f7a57c9cSQiu Yutan
8*f7a57c9cSQiu Yutan 范雨 Fan Yu <fan.yu9@zte.com.cn>
9*f7a57c9cSQiu Yutan
10*f7a57c9cSQiu Yutan:校译:
11*f7a57c9cSQiu Yutan
12*f7a57c9cSQiu Yutan - 邱禹潭 Qiu Yutan <qiu.yutan@zte.com.cn>
13*f7a57c9cSQiu Yutan - 徐鑫 xu xin <xu.xin16@zte.com.cn>
14*f7a57c9cSQiu Yutan
15*f7a57c9cSQiu Yutan==========================
16*f7a57c9cSQiu Yutan虚拟扩展本地局域网协议文档
17*f7a57c9cSQiu Yutan==========================
18*f7a57c9cSQiu Yutan
19*f7a57c9cSQiu YutanVXLAN 协议是一种隧道协议,旨在解决 IEEE 802.1q 中 VLAN ID(4096)有限的问题。
20*f7a57c9cSQiu YutanVXLAN 将标识符的大小扩展到 24 位(16777216)。
21*f7a57c9cSQiu Yutan
22*f7a57c9cSQiu YutanVXLAN 在 IETF RFC 7348 中进行了描述,并已由多家供应商设计实现。
23*f7a57c9cSQiu Yutan该协议通过 UDP 协议运行,并使用特定目的端口。
24*f7a57c9cSQiu Yutan本文档介绍了 Linux 内核隧道设备,Openvswitch 也有单独的 VXLAN 实现。
25*f7a57c9cSQiu Yutan
26*f7a57c9cSQiu Yutan与大多数隧道不同,VXLAN 是 1 对 N 的网络,而不仅仅是点对点网络。
27*f7a57c9cSQiu YutanVXLAN 设备可以通过类似于学习桥接器的方式动态学习另一端点的 IP 地址,也可以利用静态配置的转发条目。
28*f7a57c9cSQiu Yutan
29*f7a57c9cSQiu YutanVXLAN 的管理方式与它的两个近邻 GRE 和 VLAN 相似。
30*f7a57c9cSQiu Yutan配置 VXLAN 需要 iproute2 的版本与 VXLAN 首次向上游合并的内核版本相匹配。
31*f7a57c9cSQiu Yutan
32*f7a57c9cSQiu Yutan1. 创建 vxlan 设备::
33*f7a57c9cSQiu Yutan
34*f7a57c9cSQiu Yutan	# ip link add vxlan0 type vxlan id 42 group 239.1.1.1 dev eth1 dstport 4789
35*f7a57c9cSQiu Yutan
36*f7a57c9cSQiu Yutan这将创建一个名为 vxlan0 的网络设备,该设备通过 eth1 使用组播组 239.1.1.1 处理转发表中没有对应条目的流量。
37*f7a57c9cSQiu Yutan目标端口号设置为 IANA 分配的值 4789,VXLAN 的 Linux 实现早于 IANA 选择标准目的端口号的时间。
38*f7a57c9cSQiu Yutan因此默认使用 Linux 选择的值,以保持向后兼容性。
39*f7a57c9cSQiu Yutan
40*f7a57c9cSQiu Yutan2. 删除 vxlan 设备::
41*f7a57c9cSQiu Yutan
42*f7a57c9cSQiu Yutan	# ip link delete vxlan0
43*f7a57c9cSQiu Yutan
44*f7a57c9cSQiu Yutan3. 查看 vxlan 设备信息::
45*f7a57c9cSQiu Yutan
46*f7a57c9cSQiu Yutan	# ip -d link show vxlan0
47*f7a57c9cSQiu Yutan
48*f7a57c9cSQiu Yutan使用新的 bridge 命令可以创建、销毁和显示 vxlan 转发表。
49*f7a57c9cSQiu Yutan
50*f7a57c9cSQiu Yutan1. 创建vxlan转发表项::
51*f7a57c9cSQiu Yutan
52*f7a57c9cSQiu Yutan	# bridge fdb add to 00:17:42:8a:b4:05 dst 192.19.0.2 dev vxlan0
53*f7a57c9cSQiu Yutan
54*f7a57c9cSQiu Yutan2. 删除vxlan转发表项::
55*f7a57c9cSQiu Yutan
56*f7a57c9cSQiu Yutan	# bridge fdb delete 00:17:42:8a:b4:05 dev vxlan0
57*f7a57c9cSQiu Yutan
58*f7a57c9cSQiu Yutan3. 显示vxlan转发表项::
59*f7a57c9cSQiu Yutan
60*f7a57c9cSQiu Yutan	# bridge fdb show dev vxlan0
61*f7a57c9cSQiu Yutan
62*f7a57c9cSQiu Yutan以下网络接口控制器特性可能表明对 UDP 隧道相关的卸载支持(最常见的是 VXLAN 功能,
63*f7a57c9cSQiu Yutan但是对特定封装协议的支持取决于网络接口控制器):
64*f7a57c9cSQiu Yutan
65*f7a57c9cSQiu Yutan - `tx-udp_tnl-segmentation`
66*f7a57c9cSQiu Yutan - `tx-udp_tnl-csum-segmentation`
67*f7a57c9cSQiu Yutan    对 UDP 封装帧执行 TCP 分段卸载的能力
68*f7a57c9cSQiu Yutan
69*f7a57c9cSQiu Yutan - `rx-udp_tunnel-port-offload`
70*f7a57c9cSQiu Yutan    在接收端解析 UDP 封装帧,使网络接口控制器能够执行协议感知卸载,
71*f7a57c9cSQiu Yutan    例如内部帧的校验和验证卸载(只有不带协议感知卸载的网络接口控制器才需要)
72*f7a57c9cSQiu Yutan
73*f7a57c9cSQiu Yutan对于支持 `rx-udp_tunnel-port-offload` 的设备,可使用 `ethtool` 查询当前卸载端口的列表::
74*f7a57c9cSQiu Yutan
75*f7a57c9cSQiu Yutan  $ ethtool --show-tunnels eth0
76*f7a57c9cSQiu Yutan  Tunnel information for eth0:
77*f7a57c9cSQiu Yutan    UDP port table 0:
78*f7a57c9cSQiu Yutan      Size: 4
79*f7a57c9cSQiu Yutan      Types: vxlan
80*f7a57c9cSQiu Yutan      No entries
81*f7a57c9cSQiu Yutan    UDP port table 1:
82*f7a57c9cSQiu Yutan      Size: 4
83*f7a57c9cSQiu Yutan      Types: geneve, vxlan-gpe
84*f7a57c9cSQiu Yutan      Entries (1):
85*f7a57c9cSQiu Yutan          port 1230, vxlan-gpe
86