EVPN基础入门整理

  • BGP
  • 225 clicked

EVPN相关内容看了不少内容,相对零散并非系统化。 这里对入门知识做一些简要总结,便于查询。

1. EVPN

EVPN(Ethernet Virtual Private Network)是一种用于二层网络互联的VPN技术。EVPN技术采用类似于BGP/MPLS IP VPN的机制,通过扩展BGP协议,使用扩展后的可达性信息,使不同站点的网络间的MAC地址学习和发布过程从数据平面转移到控制平面,而且还可以传播站点内主机IP地址相关的路由信息。因此EVPN作为不同站点间网络的控制平面,既可以承载二层业务,也可以承载三层业务。

当前EVPN支持如下几种路由:

  • Type 1 类型路由: Ethernet Auto-Discovery route 以太自动发现路由
    • Ethernet Auto-Discovery Route可以向其他PE通告本端PE对接入站点的MAC地址的可达性,即PE对连接的站点是否可达。
  • Type 2 类型路由:MAC advertisement route 通告二类路由
    • MAC/IP Advertisement Route可以用于从本端PE向其它PE发布单播MAC/IP地址的可达信息。
  • Type 3 类型路由:Inclusive Multicast Route 集成多播路由
    • PE设备之间通过Inclusive Multicast Route可以建立传送多播流量的隧道。
      Ethernet Segment Route
  • Type 4 类型路由:Ethernet Segment Route
    • Ethernet Segment Route用来实现连接到相同CE的PE设备之间互相自动发现。
  • Type 5 类型路由:IP Prefix Route IP前缀路由
    • IP Prefix Route用于在网络中传播从接入侧网络收到的主机IP地址信息或主机IP所在的网段信息。

这些路由在网络中传输的过程中是封装在BGP扩展后的可达性信息中,所以这些路由的报文格式同BGP的BGP UPDATE报文大部分都相同,主要差别在于MP_REACH_NLRI(多协议可达网络可达信息),所以本章对于EVPN路由报文的描述仅体现MP_REACH_NLRI部分的报文信息。

路由类型 作用 受益
(Type 1)Ethernet A-D Route 别名、MAC地址批量撤销、多活指示、通告ESI标签 环路避免、快速收敛、负载分担
(Type 2)MAC/IP Advertisement Route MAC地址学习通告、MAC/IP绑定、MAC地址移动性 基于每个MAC的策略、ARP抑制、主机迁移
(Type 3)Inclusive Multicast Route 组播隧道端点自动发现、组播类型自动发现 支持BUM流量转发
(Type 4)Ethernet Segment Route ES成员自动发现 DF选举 多活,单活支持
(Type 5)IP Prefix Route IP Prefix通告 支持L3 VPN功能

https://support.huawei.com/enterprise/zh/doc/EDOC1100174722/d475a4d6
https://blog.csdn.net/weixin_60266221/article/details/130346110

1.1. Type2路由: MAC\IP地址通告路由

MAC/IP地址通告路由:主要用于MAC和IP地址通告。从本端PE向其它PE发布单播MAC/IP地址的可达信息。

MAC/IP Advertisement Route可以根据携带的信息不同分为如下几种路由:

  • 纯MAC路由:如果MAC/IP Advertisement Route中仅携带了MAC地址相关信息,而未携带IP地址信息,则该路由被称为纯MAC路由。

  • ARP路由:如果MAC/IP Advertisement Route中既携带了MAC地址相关信息,又携带了IP地址信息,且仅携带有二层业务流量转发标签(MPLS Label1),则该路由被称为ARP路由。

  • IRB路由:如果MAC/IP Advertisement Route中既携带了MAC地址相关信息,又携带了IP地址信息,且同时携带有二层业务流量转发标签(MPLS Label1)和三层业务流量转发标签(MPLS Label2),则该路由被称为IRB路由。

1.1.1. 通告二类路由

NLRI格式 字段说明
Route Distinguisher(8 Byte) 该字段为EVPN实例下设置的RD值。
Ethernet Segment Identifier(10 Byte) PE与某一CE的连接定义的唯一标识。
Ethernet Tag ID(4 Byte) 该字段为当前设备上实际配置的VLAN ID。
MAC Address Length (1Byte) 该字段被设置为48 bit。
MAC Address(6 Byte) 该字段为此路由携带的主机MAC地址。
P Address Length(1Byte) 该字段为可选,可被设置为32或128bit。
IP Address(O或4或16Byte) 该字段为可选,携带的主机IP地址。
MPLSLabel1(3 Byte) 该字段由下游路由器分配,用于二层业务流量转发。
MPLSLabel2(0或3 Byte) 该字段为可选,用于三层业务流量转发

1.1.2. MAC迁移扩展团体属性

MAC Mobility 是EVPN Type 2路由所携带的扩展团体属性。
Flag字段中最低比特被定义为“Sticky/static”位,此位为1时标识MAC地址固定不能移动。

扩展团体属性 字段说明
Type(1 Byte) 该字段固定为0x06。
Sub-Type(1Byte) 该字段固定为0x00。
Flag(1 Byte) 该字段最低bit被定义为“Sticky/static”位,为0时标识MAC地址可移动。
Reserved (1 byte) 该字段保留全0。
Sequence Number (4Byte) 该字段用于收到多个更新时确保PE保持有正确的MAC/IP通告路由

1.2. Type3路由: Inclusive Multicast Route 集成多播路由

1.2.1. 集成多播路由(Inclusive Multicast Route)

用于处理BUM报文。多播流量包括广播流量、组播流量和未知目的地址的单播流量。

当PE之间的BGP邻居关系建立成功后,PE之间会传递集成多播路由,集成多播路由可以携带本端PE上EVPN实例的RD和RT(Route Target)值,以及Source IP(一般为本端PE的Loopback地址)和PMSI(Provider Multicast Service Interface)信息。PMSI和RT值承载在路由的属性信息中,RD和Source IP承载在路由的NLRI信息中

1.3. Type5路由: IP Prefix Route IP前缀路由

1.3.1. IP前缀路由(IP Prefix Route)

IP前缀路由用于在网络中传播从接入侧网络收到的主机IP地址信息或主机IP所在的网段信息。

NLRI格式 字段说明
Route Distinguisher (8 Byte) 该字段为EVPN实例下设置的RD值。
Ethernet Segment Identifier (10 Byte) PE与某—CE的连接定义的唯一标识。
Ethernet TagID(4 Byte) 该字段当前仅支持各位置0。
IPPrefix Length (1 Byte) 该字段为此路由携带的IP前缀掩码长度。
IP Prefix(4或16 Byte) 该字段为此路由携带的IP前缀。
GW IP Address(4或16 Byte) 该字段为默认网关地址。
MPLSLabel(3 Byte) 该字段为三层业务流量转发使用的标签。

2. 参考

router-mac 用于配置对端evpn的overlay mac,即从本地到对端的目的mac;

2.1. Router’s MAC Option

The router-mac option in gobgp CLI allows sending Router's
MAC Extended Community via BGP EVPN Type 2 and Type 5 advertisements.

As explained in below RFC draft, this community is used to carry the
MAC address of the VTEP where MAC-IP pair resides.

For example, GoBGP router (R1) peers with Cisco router (R2).
R1 is used by an orchestraction platform, e.g. OpenStack, Docker Swarm,
etc., to advertise container MAC-IP bindings. When R1 advertises the
binding it also sets next hop for the route as the host where the MAC-IP
binding (i.e. container) resides. When R2 receives the route, it will
not install it unless Router's MAC Extended Community is present. R2
will use the MAC address in the community to create an entry in MAC
address table of R2 pointint to NVE interface.

gobgp global rib -a evpn add macadv e9:72:d7:aa:1f:b4 \
    172.16.100.100 etag 0 label 34567 rd 10.1.1.1:100 \
    rt 65001:100 encap vxlan nexthop 10.10.10.10 \
    origin igp router-mac e9:72:d7:aa:1f:b4

gobgp global rib -a evpn add nexthop 10.10.10.10 origin igp \
    prefix 172.16.100.100/32 esi 0 etag 0 rd 10.1.1.1:100 \
    rt 65001:100 gw 10.10.10.10 label 34567 encap vxlan \
    router-mac e9:72:d7:aa:1f:b4

In the above example, a host with IP of 10.10.10.10 runs a
container connected to an Open vSwitch instance. The container's IP
address is 172.16.100.100 and MAC address e9:72:d7:aa:1f:b4.
The Open vSwitch is VTEP with tunnel_key=34567, i.e. VNID 34567.

GoBGP (R1) and Cisco (R2) routers are in BGP AS 65001. R1's IP is
10.1.1.1. R2 used RT of 65001:100 to import routes and place
them into appropriate VRF. In this case the VRF is associated with
L2VNI from VLAN 300. Upon the receipt of the above BGP EVPN
Type 2 and Type 5 routes, R2 will create create a MAC address
entry pointing to it's NVE interface with destination IP address
of 10.10.10.10.

Legend:
        * - primary entry, G - Gateway MAC, (R) - Routed MAC, O - Overlay MAC
        age - seconds since last seen,+ - primary entry using vPC Peer-Link,
        (T) - True, (F) - False, C - ControlPlane MAC
   VLAN     MAC Address      Type      age     Secure NTFY Ports
---------+-----------------+--------+---------+------+----+------------------
*  300     e972.d7aa.1fb4   static   -         F      F    nve1(10.10.10.10)

The R2 will use the router-mac e9:72:d7:aa:1f:b4 as the destination MAC
address of the inner VXLAN packet. For example, an underlay host 20.20.20.20
ping the container. The inner VXLAN L2 destination address is
e9:72:d7:aa:1f:b4. The inner VXLAN L2 source address is R2's MAC. The outer
VXLAN L3 source address, i.e. 10.2.2.2 is R2' NVE address.

OUTER VXLAN L2: 10:20:08:d0:ff:23 > b2:0e:19:6a:8d:51
OUTER VXLAN L3: 10.2.2.2.45532 > 10.10.10.10.4789: VXLAN, flags [I] (0x08), vni 34567
INNER VXLAN L2: 4e:f4:ca:aa:f6:7b > e9:72:d7:aa:1f:b4
INNER VXLAN L3: 20.20.20.20 > 172.16.100.100: ICMP echo reply, id 66, seq 1267, length 64

See also: Integrated Routing and Bridging in EVPN

发表评论

邮箱地址不会被公开。 必填项已用*标注