示例:在 QFX 系列和 EX4600 交换机上手动配置 VXLAN
以下示例显示 QFX5100、QFX5110、QFX5200、QFX5210 和 EX4600 交换机上手动配置 VXLAN 的用例。
示例:配置 VXLAN 中继交换机
如果 QFX 系列或 EX4600 交换机充当 VTEP 的下游设备的中继交换机,则无需在 QFX 系列或 EX4600 交换机上配置任何 VXLAN 信息。您需要在交换机上配置 PIM,以便它可以形成所需的组播树,以便 VTEP 可以彼此建立可达性。
要求
此示例使用以下硬件和软件组件:
两台 QFX5100 交换机
Junos OS 14.1X53-D10 版
概述
此示例显示了一个简单的用例,其中 QFX5100 交换机连接到充当 VTEP 的下游服务器。QFX5100 交换机需要在服务器 1 上的 VM 1 和服务器 2 的 VM 2 之间转发 VXLAN 数据包。由于此配置允许虚拟机之间通过 VXLAN 隧道进行第 2 层连接,因此应用程序可以在虚拟机之间实现 VMotion。
在传输交换机上配置 PIM
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层次结构级别的 CLI 中 [edit]
。
set protocols pim interface all set protocols pim rp static address ip-address
程序
逐步过程
如果未使用 SDN 控制器创建 VXLAN 控制平面,则必须在每个交换机上启用 PIM,以便 VTEP 可以使用组播组通告其存在并了解其他 VTEP。(配置 PIM 会自动启用 IGMP。)您无需执行任何特定于 VXLAN 的配置。请注意,您也不需要在任一交换机上配置 VLAN 1。
启用 PIM。
[edit] user@switch# set protocols pim interface all
配置 PIM 集合点的地址。
[edit] user@switch# set protocols pim rp static address ip-address
示例:配置 VXLAN 第 2 层网关
如果 QFX 系列或 EX4600 交换机连接到了下游服务器,该服务器托管的虚拟机需要与只能通过第 3 层网络访问的另一个虚拟机进行第 2 层连接,则必须请执行以下操作:
将交换机配置为 VTEP,即下游第 2 层设备的第 2 层网关。
在交换机上配置 PIM,以便它可以形成其他 VTEP 可访问性所需的组播树,并允许在 VTEP 之间转发 BUM 流量。
在 VTEP 的环路接口和第 3 层接口上启用路由协议,例如 OSPF。
要求
此示例使用以下硬件和软件组件:
两台 QFX5100 交换机
Junos OS 14.1X53-D10 版
概述
此示例显示了一个用例,其中 QFX5100 交换机充当 VTEP,允许在服务器 1 上的 VM 1 和服务器 2 上的 VM 2 之间建立第 2 层连接,以便在虚拟机之间发生 VMotion。此示例中的服务器可以位于相同或不同的数据中心中,唯一的限制是 QFX5100 交换机之间必须有第 3 层连接。这使您的网络能够非常敏捷地响应服务器使用需求或带宽需求的变化。
请注意,由于第 2 层域中都存在相同的 VLAN,并且两台交换机将 VLAN 流量封装到同一 VXLAN 中,因此在第 3 层网络中不需要 VXLAN 流量网关。第 3 层 VXLAN 数据包正常路由,无需解封装或重新封装。
配置交换机
CLI 快速配置
要快速配置此示例中的 QFX5100-96S 1,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,然后将命令复制并粘贴到层级的 [edit]
CLI 中。
set interfaces lo0 unit 0 family inet address 10.1.1.1 set switch-options vtep–source-interface lo0.0 set protocols pim interface lo0.0 set protocols ospf area 0.0.0.0 interface lo0.0 set protocols pim interface xe-0/0/0.0 set protocols ospf area 0.0.0.0 interface xe-0/0/0.0 set protocols pim rp static address 10.2.2.2 set vlans VLAN1 vlan-id 100 vxlan vni 100 multicast-group 233.252.0.2 set vlans VLAN1 vxlan encapsulate-inner-vlan set vlans VLAN1 vxlan unreachable-vtep-aging-timer 600 set protocols l2-learning decapsulate-accept-inner-vlan set interfaces xe-0/0/0 unit 0 family inet address 10.2.2.100/24 set interfaces xe-0/0/1 unit 0 family ethernet-switching interface-mode trunk set interfaces xe-0/0/1 unit 0 family ethernet-switching vlan members all set protocols ospf enable set protocols ospf area 0.0.0.0 interface em0.0 disable set protocols ospf area 0.0.0.0 interface all
QFX5100-96S 2 的配置相同,但对几个地址进行了更改:
set interfaces lo0 unit 0 family inet address 10.1.1.2 set switch-options vtep–source-interface lo0.0 set protocols pim interface lo0.0 set protocols ospf area 0.0.0.0 interface lo0.0 set protocols pim interface xe-0/0/0.0 set protocols ospf area 0.0.0.0 interface xe-0/0/0.0 set protocols pim rp static address 10.2.2.2 set vlans VLAN1 vlan-id 100 vxlan vni 100 multicast-group 233.252.0.2 set vlans VLAN1 vxlan encapsulate-inner-vlan set vlans VLAN1 vxlan unreachable-vtep-aging-timer 600 set protocols l2-learning decapsulate-accept-inner-vlan set interfaces xe-0/0/0 unit 0 family inet address 10.2.2.200/24 set interfaces xe-0/0/1 unit 0 family ethernet-switching interface-mode trunk set interfaces xe-0/0/1 unit 0 family ethernet-switching vlan members all set protocols ospf enable set protocols ospf area 0.0.0.0 interface em0.0 disable set protocols ospf area 0.0.0.0 interface all
您必须在两台交换机上配置相同的组播组地址 VLAN1
。
程序
逐步过程
在两台交换机上执行以下过程以设置示例配置。
在环路接口上创建可访问的 IPv4 地址。
[edit] user@switch# set interfaces lo0 unit 0 family inet address 10.1.1.1
对于交换机 QFX5100-96S 2,请使用地址
10.1.1.2.
配置环路接口(以及其关联地址)用作隧道源地址。
[edit] user@switch# set switch-options vtep-source-interface lo0.0
在环路接口上启用 PIM。
[edit] user@switch# set protocols pim interface lo0.0
将环路接口添加到 OSPF 区域 0.0.0.0。
[edit] user@switch# set protocols ospf area 0.0.0.0 interface lo0.0
在连接到第 3 层网络的接口上启用 PIM。
[edit] user@switch# set protocols pim interface xe-0/0/0.0
将连接到第 3 层网络的接口添加到 OSPF 区域 0.0.0.0。
[edit] user@switch# set protocols ospf area 0.0.0.0 interface xe-0/0/0.0
配置 PIM 集合点的地址。
[edit] user@switch# set protocols pim rp static address 10.2.2.2
创建 VLAN,将其映射到 VXLAN,并将组播组地址分配给 VXLAN。VXLAN 的所有成员都必须使用相同的组播组地址。
[edit] user@switch# set vlans VLAN1 vlan-id 100 vxlan vni 100 multicast-group 233.252.0.2
在此示例中,
vlan-id
两vni
者均设置为100
。这样做只是为了简单明了。您不需要将和vni
相同的值设置为vlan-id
相同的值。(可选)将交换机配置为在封装 VXLAN 后保留原始 VLAN 标记(在内部以太网数据包中)。默认情况下,当数据包被封装时,原始标记将被删除。
[edit] user@switch# set vlans VLAN1 vxlan encapsulate-inner-vlan
(可选)如果从该 VTEP 中学习到的所有 MAC 地址都已老化,则系统会将远程 VTEP(另一台 QFX5100 交换机)的地址淘汰。远程 VTEP 的地址在最后一个学习的 MAC 地址到期后,将按配置的秒数过期。
[edit] user@switch# set vlans VLAN1 vxlan unreachable-vtep-aging-timer 600
(可选)配置交换机以解封装并接受 VXLAN 数据包中的原始 VLAN 标记。默认情况下,在解封装数据包时,会丢弃保留的 VLAN 标记。
[edit] user@switch# set protocols l2-learning decapsulate-accept-inner-vlan
配置连接到第 3 层网络的接口。
[edit] user@switch# set interfaces xe-0/0/0 unit 0 family inet address 10.2.2.100/24
对于交换机 QFX5100-96S 2,请使用地址
10.2.2.200.
将面向服务器的接口配置为支持多个 VLAN。
[edit] user@switch# set interfaces xe-0/0/1 unit 0 family ethernet-switching interface-mode trunk [edit] user@switch# set interfaces xe-0/0/1 unit 0 family ethernet-switching vlan members all
注意:此示例仅显示一个 VLAN,因此对于该示例来说不需要这一步。但是,在实际配置中,为了支持连接到多个 VLAN 的多个虚拟机,将需要这一点。在这种情况下,您还需要配置额外的 VLAN 到 VXLAN 映射。
在映射到区域 0.0.0.0.0 的所有接口上启用 OSPF。
[edit] user@switch# set protocols ospf enable [edit] user@switch# set protocols ospf area 0.0.0.0 interface em0.0 disable [edit] user@switch# set protocols ospf area 0.0.0.0 interface all
结果
在配置模式下,在 QFX5100-96S 1 上输入以下命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以更正配置。
user@switch# show switch-options
vtep-source-interface lo0.0;
user@switch# show vlans
VLAN1 { vlan-id 100; vxlan { vni 100; multicast-group 233.252.0.2; encapsulate-inner-vlan; } }
user@switch# show interfaces
xe-0/0/0 { unit 0 { family inet { address 10.2.2.100/24; } } } xe-0/0/1 { unit 0 { family ethernet-switching { interface-mode trunk; vlan { members all; } } } } lo0 { unit 0 { family inet { address 10.1.1.1/32; } } }
user@switch# show protocols pim
rp { static { address 10.2.2.2; } } interface xe-0/0/0.0
验证
确认配置工作正常。
验证 VXLAN 可访问性
目的
在 QFX5100-96S 1 上,验证是否与远程 VTEP (QFX5100-96S 2) 进行了连接。
行动
user@switch> show ethernet-switching vxlan-tunnel-end-point remote Logical System Name Id SVTEP-IP IFL L3-Idx <default> 0 10.1.1.2 lo0.0 0 RVTEP-IP IFL-Idx NH-Id 10.1.1.2 559 1728 VNID MC-Group-IP 100 233.252.0.2
意义
QFX5100-96S 2 上的 VTEP 可访问,因为其 IP 地址(分配给环路接口的地址)显示在输出中。输出还显示,在远程 VTEP 上配置了 VXLAN (VNI 100) 和相应的组播组。
验证本地 VTEP 配置是否正确
目的
在 QFX5100-96S 1 上,验证隧道端点是否正确。
行动
user@switch> show ethernet-switching vxlan-tunnel-end-point source Logical System Name Id SVTEP-IP IFL L3-Idx <default> 0 10.1.1.1 lo0.0 0 L2-RTT Bridge Domain VNID MC-Group-IP default-switch VLAN1+100 100 233.252.0.2
意义
QFX5100-96S 1 上的 VTEP 会显示正确的隧道源 IP 地址(分配给环路接口)、VLAN 和 VXLAN 的组播组。
验证 MAC 从远程 VTEP 学习
目的
在 QFX5100-96S 1 上,验证它是否正在从远程 VTEP 学习 MAC 地址。
行动
user@switch> show ethernet-switching table MAC flags (S - static MAC, D - dynamic MAC, L - locally learned, P - Persistent static SE - statistics enabled, NM - non configured MAC, R - remote PE MAC) Ethernet switching table : 2 entries, 2 learned Routing instance : default-switch Vlan MAC MAC Age Logical name address flags interface VLAN1 00:00:00:ff:ff:ff D - vtep.12345 VLAN1 00:10:94:00:00:02 D - xe-0/0/0.0
意义
输出显示从远程 VTEP 学习的 MAC 地址(除了在正常第 2 层接口上学习的地址)。它还显示了远程 VTEP 接口的逻辑名称(vtep.12345
在上面的输出中)。
监控远程接口
目的
在 QFX5100-96S 1 上,监控远程 VTEP 接口的流量详细信息。
行动
user@switch> show interface vtep.12345 detail M Flags: Up SNMP-Traps Encapsulation: ENET2 VXLAN Endpoint Type: Remote, VXLAN Endpoint Address: 10.1.1.2, L2 Routing Instance: default-switch, L3 Routing Instance: default Traffic statistics: Input bytes : 228851738624 Output bytes : 0 Input packets: 714162415 Output packets: 0 Local statistics: Input bytes : 0 Output bytes : 0 Input packets: 0 Output packets: 0 Transit statistics: Input bytes : 228851738624 0 bps Output bytes : 0 0 bps Input packets: 714162415 0 pps Output packets: 0 0 pps Protocol eth-switch, MTU: 1600, Generation: 277, Route table: 5
意义
输出显示远程 VTEP 接口的流量详细信息。要获取这些信息,您必须提供远程 VTEP 接口的逻辑名称(上述输出中为 vtep.12345),您可以使用 show ethernet-switching table
命令学习该逻辑名称。
验证 OSPF 邻接方
目的
在 QFX5100-96S 1 上,验证远程 VTEP (QFX5100-96S 2) 是否已将自身确定为 OSPF 邻接方。
行动
user@switch> show ospf neighbor Address Interface State ID Pri Dead 10.2.2.200 xe-0/0/0.0 Full 10.2.3.2 128 38
意义
输出显示,QFX5100-96S 2 上的接口 xe-0/0/0.0 处于该 Full
状态,这意味着 QFX5100-96S 2 是完全相邻的邻接方。此 Full
状态还意味着 QFX5100-96S 1 和 QFX5100-96S 2 之间存在第 3 层连接。