在此页面上
示例:在 MX 系列路由器上手动配置 VXLAN
虚拟可扩展局域网 (VXLAN) 是一种第 3 层封装协议,使 MX 系列路由器能够通过 VXLAN 隧道将第 2 层或第 3 层数据包推送到虚拟化数据中心或互联网。在两个虚拟隧道端点 (VTEP) 之间建立通信。VTEP 将虚拟机流量封装到 VXLAN 标头中,并剥离封装。
此示例说明如何使用默认桥接域中的交换机选项在 MX 系列路由器上配置 VXLAN。
要求
此示例使用以下硬件和软件组件:
MX 系列路由器
支持 VXLAN 的对等路由器
Junos OS 14.1 版
概述
在此示例中,VXLAN 配置为在默认桥接域上运行。VTEP 接口源配置为环路地址,VLAN 组在启用了 VXLAN 的桥接域下配置。针对 VLAN 标记和封装配置了接口,并启用了 IRB。OSPF 和 PIM 协议配置为便于单播和组播路由。机箱针对 GRES 和增强型 IP 服务进行了配置。
我们支持静态 VXLAN 和带有 IPv4 底层网络的 OVSDB-VXLAN。您可以将 VTEP 源接口配置为具有 IPv4 地址的环路接口。我们仅支持 EVPN-VXLAN 配置的 IPv6 底层网络(VTEP 源接口作为具有 IPv6 地址的环路接口)。
拓扑
在 MX 系列路由器上配置 VXLAN
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,然后将命令复制并粘贴到层次结构级别的 CLI [edit] 中。
set switch-options vtep-source-interface lo0.0 set bridge-domains vlan-5 vxlan vni 100 set bridge-domains vlan-5 vxlan multicast-group 233.252.0.1 set bridge-domains vlan-5 vlan-id 100 set bridge-domains vlan-5 routing-interface irb.0 set bridge-domains vlan-5 interface xe-1/0/0.0 set bridge-domains vlan-6 vxlan vni 200 set bridge-domains vlan-6 vxlan multicast-group 233.252.0.1 set bridge-domains vlan-6 vlan-id 200 set bridge-domains vlan-6 routing-interface irb.1 set bridge-domains vlan-6 interface xe-2/0/0.0 set interfaces xe-1/0/0 vlan-tagging set interfaces xe-1/0/0 encapsulation flexible-ethernet-services set interfaces xe-1/0/0 unit 0 encapsulation vlan-bridge set interfaces xe-1/0/0 unit 0 vlan-id 100 set interfaces xe-2/0/0 vlan-tagging set interfaces xe-2/0/0 encapsulation flexible-ethernet-services set interfaces xe-2/0/0 unit 0 encapsulation vlan-bridge set interfaces xe-2/0/0 unit 0 vlan-id 200 set interface irb unit 0 family inet address 10.5.5.1/24 set interface irb unit 1 family inet address 10.6.6.1/24 set interfaces lo0 unit 0 family inet address 10.3.3.3/32 set protocols ospf area 0.0.0.0 interface ge-8/3/8.0 set protocols ospf area 0.0.0.0 interface lo0.0 set protocols ospf area 0.0.0.0 interface xe-0/1/3.0 set protocols ospf area 0.0.0.0 interface ge-8/3/2.0 set protocols pim rp static address 10.2.1.3 set protocols pim interface lo0.0 mode bidirectional-sparse set protocols pim interface ge-8/3/8.0 mode bidirectional-sparse set protocols pim interface xe-0/1/3.0 mode bidirectional-sparse set protocols pim interface ge-8/3/2.0 mode bidirectional-sparse set chassis redundancy graceful-switchover set chassis aggregated-devices ethernet device-count 10 set chassis fpc 1 pic 0 tunnel-services bandwidth 10g set chassis network-services enhanced-ip
配置 VXLAN
分步过程
以下示例说明如何使用默认桥接域和交换机选项设置基本 VXLAN 配置。要在 MX 系列路由器上配置 VXLAN,请执行以下步骤:
在下
switch-options为默认交换机配置 VTEP 接口源。[edit] user@router# set switch-options vtep-source-interface lo0.0
设置名为
vlan-5的 VLAN 组,并将其 VXLAN 网络标识符 (VNI) 设置为 100。[edit] user@router# set bridge-domains vlan-5 vxlan vni 100
vlan-5配置 VXLAN 的组播组地址。[edit] user@router# set bridge-domains vlan-5 vxlan multicast-group 233.252.0.1/32
将 的
vlan-5VLAN ID 设置为 100。[edit] user@router# set bridge-domains vlan-5 vlan-id 100
为 配置
vlan-5集成桥接和路由 (IRB)。[edit] user@router# set bridge-domains vlan-5 routing-interface irb.0
将 xe-1/0/0.0 接口
vlan-5分配给 。[edit] user@router# set bridge-domains vlan-5 interface xe-1/0/0.0
设置名为
vlan-6的 VLAN 组,并将其 VXLAN 网络标识符 (VNI) 设置为 200。[edit] user@router# set bridge-domains vlan-6 vxlan vni 200
vlan-6配置 VXLAN 的组播组地址。[edit] user@router# set bridge-domains vlan-6 vxlan multicast-group 233.252.0.1
将 的
vlan-6VLAN ID 设置为 100。[edit] user@router# set bridge-domains vlan-6 vlan-id 200
为 配置
vlan-6IRB。[edit] user@router# set bridge-domains vlan-6 routing-interface irb.1
将 xe-2/0/0.0 接口
vlan-6分配给 。[edit] user@router# set bridge-domains vlan-6 interface xe-2/0/0.0
为 xe-1/0/0 设置 VLAN 标记。
[edit] user@router# set interfaces xe-1/0/0 vlan-tagging
在 xe-1/0/0 上配置灵活的以太网服务封装。
[edit] user@router# set interfaces xe-1/0/0 encapsulation flexible-ethernet-services
为 xe-1/0/0 单元 0 ̇ 设置 VLAN 桥接封装。
[edit] user@router# set interfaces xe-1/0/0 unit 0 encapsulation vlan-bridge
将 xe-1/0/0 单元 0 VLAN ID 设置为 100。
[edit] user@router# set interfaces xe-1/0/0 unit 0 vlan-id 100
为 xe-2/0/0 配置 VLAN 标记
[edit] user@router# set interfaces xe-2/0/0 vlan-tagging
在 xe-2/0/0 上设置灵活的以太网服务封装。
[edit] user@router# set interfaces xe-2/0/0 encapsulation flexible-ethernet-services
为 xe-2/0/0 单元 0 ̇ 配置 VLAN 桥接封装。
[edit] user@router# set interfaces xe-2/0/0 unit 0 encapsulation vlan-bridge
将 xe-2/0/0 单元 0 VLAN ID 设置为 200。
[edit] user@router# set interfaces xe-2/0/0 unit 0 vlan-id 200
配置 IRB 单元 0 系列的 inet 地址。
[edit] user@router# set interface irb unit 0 family inet address 10.5.5.1/24
配置 IRB 单元 1 系列的 inet 地址。
[edit] user@router# set interface irb unit 1 family inet address 10.6.6.1/24
将环路单元的家庭 inet 地址设置为 0。
[edit] user@router# set interfaces lo0 unit 0 family inet address 10.3.3.3/32
为 ge-8/3/8.0 接口设置 OSPF。
[edit] user@router# set protocols ospf area 0.0.0.0 interface ge-8/3/8.0
为环路接口配置 OSPF。
[edit] user@router# set protocols ospf area 0.0.0.0 interface lo0.0
为 xe-0/1/3.0 接口设置 OSPF。
[edit] user@router# set protocols ospf area 0.0.0.0 interface xe-0/1/3.0
为 ge-8/3/2.0 接口配置 OSPF。
[edit] user@router# set protocols ospf area 0.0.0.0 interface ge-8/3/2.0
为协议无关组播 (PIM) 集合点 (RP) 设置静态地址。
[edit] user@router# set protocols pim rp static address 10.2.1.3
将环路接口配置为 PIM 协议的双向稀疏模式。
[edit] user@router# set protocols pim interface lo0.0 mode bidirectional-sparse
将 ge-8/3/8.0 接口设置为 PIM 协议的双向稀疏模式。
[edit] user@router# set protocols pim interface ge-8/3/8.0 mode bidirectional-sparse
将 xe-0/1/3.0 接口配置为 PIM 协议的双向稀疏模式。
[edit] user@router# set protocols pim interface xe-0/1/3.0 mode bidirectional-sparse
将 gem-8/3/2.0 接口设置为 PIM 协议的双向稀疏模式。
[edit] user@router# set protocols pim interface ge-8/3/2.0 mode bidirectional-sparse
在机箱上配置冗余平滑切换。
[edit] user@router# set chassis redundancy graceful-switchover
将聚合以太网设备计数设置为 10。
[edit] user@router# set chassis aggregated-devices ethernet device-count 10
配置 FPC 1/PIC 0 的隧道服务带宽。
[edit] user@router# set chassis fpc 1 pic 0 tunnel-services bandwidth 10g
为机箱上的网络服务启用增强型 IP。
[edit] user@router# set chassis network-services enhanced-ip
结果
在配置模式下,输入以下命令确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明以更正配置。
user@router# show switch-options
switch-options {
vtep-source-interface lo0.0;
}
user@router# show bridge-domains
bridge-domains {
vlan-5 {
vxlan {
vni 100;
multicast-group 233.252.0.1;
}
vlan-id 100;
routing-interface irb.0;
interface xe-1/0/0.0;
}
vlan-6 {
vxlan {
vni 200;
multicast-group 233.252.0.1;
}
vlan-id 200;
routing-interface irb.1;
interface xe-2/0/0.0;
}
}
user@router# show interfaces
interfaces {
xe-1/0/0 {
vlan-tagging;
encapsulation flexible-ethernet-services;
unit 0 {
encapsulation vlan-bridge;
vlan-id 100;
}
}
xe-2/0/0 {
vlan-tagging;
encapsulation flexible-ethernet-services;
unit 0 {
encapsulation vlan-bridge;
vlan-id 200;
}
}
irb {
unit 0 {
family inet {
address 10.5.5.1/24;
}
}
unit 1 {
family inet {
address 10.6.6.1/24;
}
}
}
lo0 {
unit 0 {
family inet {
address 10.3.3.3/32;
}
}
}
}
user@router# show protocols ospf
area 0.0.0.0 {
interface ge-8/3/8.0;
interface lo0.0;
interface xe-0/1/3.0;
interface ge-8/3/2.0;
}
user@router# show protocols pim
rp {
static {
address 10.2.1.3;
}
}
user@router# show chassis
redundancy {
graceful-switchover;
}
aggregated-devices {
ethernet {
device-count 10;
}
}
fpc 1 {
pic 0 {
tunnel-services {
bandwidth 10g;
}
}
}
network-services enhanced-ip;
验证
确认配置工作正常。
验证可访问性
目的
验证网络是否已启动并运行,并安装了正确的接口和路由。
行动
user@router> show interfaces terse irb
Interface Admin Link Proto Local Remote
irb up up
irb.0 up up inet 10.5.5.1/24
multiservice
irb.1 up up inet 10.6.6.1/24
multiservice
user@router> ping 10.5.5.1/24
PING 10.5.5.1 (10.5.5.1): 56 data bytes
64 bytes from 10.5.5.1: icmp_seq=0 ttl=64 time=0.965 ms
64 bytes from 10.5.5.1: icmp_seq=1 ttl=64 time=0.960 ms
64 bytes from 10.5.5.1: icmp_seq=2 ttl=64 time=0.940 ms
^C
--- 10.1.1.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.940/0.955/0.965/0.011 ms
意义
使用 show interfaces terse irb 命令验证是否已正确配置 IRB 接口。 irb.0 和 irb.1 接口应显示正确的多服务 inet 地址。
使用 ping 命令确认网络已连接到 IRB 多服务地址。
验证 VXLAN
目的
验证 VXLAN 是否正常工作并启用了正确的协议。
行动
user@router> show interfaces vtep
Physical interface: vtep, Enabled, Physical link is Up
Interface index: 133, SNMP ifIndex: 575
Type: Software-Pseudo, Link-level type: VxLAN-Tunnel-Endpoint, MTU: 1600, Speed: Unlimited
Device flags : Present Running
Interface flags: SNMP-Traps
Link type : Full-Duplex
Link flags : None
Last flapped : Never
Input packets : 0
Output packets: 0
Logical interface vtep.32768 (Index 334) (SNMP ifIndex 607)
Flags: Up SNMP-Traps Encapsulation: ENET2
VXLAN Endpoint Type: Source, VXLAN Endpoint Address: 10.255.187.32, L2 Routing Instance: default-switch, L3 Routing Instance: default
Input packets : 0
Output packets: 0
user@router> show l2-learning vxlan-tunnel-end-point remote mac-table
MAC flags (S -static MAC, D -dynamic MAC, L -locally learned, C -Control MAC
SE -Statistics enabled, NM -Non configured MAC, R -Remote PE MAC)
Logical system : <default>
Routing instance : default-switch
Bridging domain : vlan-5+100, VLAN : 100, VNID : 100
Bridging domain : vlan-6+200, VLAN : 200, VNID : 200
user@router> show l2-learning vxlan-tunnel-end-point source
Logical System Name Id SVTEP-IP IFL L3-Idx
<default> 0 10.255.187.32 lo0.0 0
L2-RTT Bridge Domain VNID MC-Group-IP
default-switch vlan-5+100 100 233.252.0.1
default-switch vlan-6+200 200 233.252.0.1
意义
使用该 show interface vtep 命令显示有关 VXLAN 端点配置的信息。确保路由实例已分配给默认交换机。
使用该 show l2-learning vxlan-tunnel-end-point remote mac-table 命令确认桥接域 VLAN 组配置正确。
使用 show l2-learning vxlan-tunnel-end-point source 命令确认桥接域 VLAN 组的组播 IP 地址。