一、 预习:
EVPN Type 5 Prefix 路由:
三层路由不仅可以由 BGP MPLS V 标传送,也可以用 BGP EVPN E标 传送,区别是:
用 BGP V 标传送的过程:CE1 把 IP 路由 传给 PE1,PE1 会自动把它变为 VPN-Instance 路由,进入到 VPNv4 路由表中,携带 RD、RT 值传递给对端 PE2,对端 PE 2 会根据 RT 值将它导入相应的 VPN-Instance 路由表中,传递给 CE2。整个过程中,路由的交叉是自动完成的。
但 BGP EVPN 传递的 EVPN Type 5 prefix 路由的路由交叉需要手动完成:advertise l2vpn evpn
并且,E标 的产生也需要手工开启能力:evpn mpls routing-enable
Type 5 prefix route:用于在网络中传播从 CE 侧网络收到的 IP 地址信息或者主机 IP 所在的网段信息:Type 5 路由的 NLRI 格式内容中包括:
RD(8 Bytes)
ESI(10 Bytes)
Ethernet Tag ID(4 Byte)
IP Prefix Length(1 Bytes)
IP Prefix(4 或者 16 Bytes)
GW IP Address(4 或者 16 Bytes)
MPLS Label(3 Bytes)
二、拓扑:
三、配置过程:
1、创建三层实例
ip vpn-instance 1
route-distinguisher 100:1
vpn-target 100:1 evpn #声明RT类型,需要加上 evpn 才是 EVPN 携带的 RT,否则,默认是为 VPNv4 携带的 RT
evpn mpls routing-enable #EVPN中的隧道可以不用 MPLS,if 隧道用 MPLS,就需要手工产生标签
2、进入 BGP,在实例中发布路由:
bgp 100
ipv4-family vpn-instance 1
network 100.1.1.1 255.255.255.255 #先把三层实例路由发布到实例路由地址族中,再交叉到 EVPN 中
dis bgp vpnv4 all routing-table #现在可以看到实例路由已经自动生成,但是不会自动变成 EVPN Type 5 prefix-route
dis bgp evpn all routing-table prefix-route #查看一下 Type 5 路由,看到没有,so,手动让它生成和宣告:
advertise l2vpn evpn #手动交叉到 EVPN 路由表中,这时再查看 Type 5路由,就看到有了
3、在 PE 上配置对 CE 端接口的 ESI 号
三、验证和查看表项:
1、先来个跟踪:
2、在 PE1 右边抓个包可以看到两层标签,内层是 EVPN 为实例路由分配的48013,外层是 ISP 内部分配的 IGP 标签:
3、看一下标签:
4、看一下我们一直期待的 EVPN Type 5 prefix 路由:
5、抓包看一下 Type 5 路由,可以看到不但有IP地址、长度、还有网关、RD、标签:
四、详细配置:
R1(CE1):
interface GigabitEthernet0/0/0
ip address 11.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 100.1.1.1 255.255.255.255
#
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 11.1.1.0 0.0.0.255
network 100.1.1.1 0.0.0.0
#
NE1(PE1):
ip vpn-instance 1
ipv4-family
route-distinguisher 100:1
vpn-target 100:1 export-extcommunity evpn
vpn-target 200:1 import-extcommunity evpn
vpn-target 100:1 import-extcommunity evpn
evpn mpls routing-enable
#
mpls lsr-id 1.1.1.1
mpls
mpls ldp
#
ipv4-family
#
interface Ethernet1/0/0
undo shutdown
ip binding vpn-instance 1
ip address 11.1.1.2 255.255.255.0
esi 0000.1111.1111.1111.1111
undo dcn
undo dcn mode vlan
#
interface Ethernet1/0/1
undo shutdown
ip address 13.1.1.1 255.255.255.0
mpls
mpls ldp
undo dcn
undo dcn mode vlan
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
bgp 100
router-id 1.1.1.1
undo default ipv4-unicast
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
undo peer 2.2.2.2 enable
#
ipv4-family vpn-instance 1
import-route ospf 2
advertise l2vpn evpn
#
l2vpn-family evpn
undo policy vpn-target
peer 2.2.2.2 enable
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 13.1.1.0 0.0.0.255
#
ospf 2 router-id 6.6.6.6 vpn-instance 1
import-route bgp
area 0.0.0.0
network 11.1.1.0 0.0.0.255
#
undo dcn
#
evpn source-address 1.1.1.1
R3(P):
mpls lsr-id 3.3.3.3
mpls
mpls ldp
#
interface GigabitEthernet0/0/0
ip address 13.1.1.3 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 23.1.1.3 255.255.255.0
mpls
mpls ldp
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 13.1.1.0 0.0.0.255
network 23.1.1.0 0.0.0.255
#
NE2(PE2):
ip vpn-instance 1
ipv4-family
route-distinguisher 200:1
vpn-target 200:1 export-extcommunity evpn
vpn-target 100:1 import-extcommunity evpn
vpn-target 200:1 import-extcommunity evpn
evpn mpls routing-enable
#
mpls lsr-id 2.2.2.2
mpls
mpls ldp
#
ipv4-family
#
interface Ethernet1/0/0
undo shutdown
ip address 23.1.1.2 255.255.255.0
mpls
mpls ldp
undo dcn
undo dcn mode vlan
#
interface Ethernet1/0/1
undo shutdown
ip binding vpn-instance 1
ip address 22.1.1.1 255.255.255.0
esi 0000.2222.2222.2222.2222
undo dcn
undo dcn mode vlan
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
bgp 100
router-id 2.2.2.2
undo default ipv4-unicast
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
undo peer 1.1.1.1 enable
#
ipv4-family vpn-instance 1
import-route ospf 2
advertise l2vpn evpn
#
l2vpn-family evpn
undo policy vpn-target
peer 1.1.1.1 enable
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 23.1.1.0 0.0.0.255
#
ospf 2 router-id 3.3.3.3 vpn-instance 1
import-route bgp
area 0.0.0.0
network 22.1.1.0 0.0.0.255
#
undo dcn
#
evpn source-address 2.2.2.2
R2(CE2):
interface GigabitEthernet0/0/0
ip address 22.1.1.2 255.255.255.0
#
interface LoopBack0
ip address 200.1.1.1 255.255.255.255
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 22.1.1.0 0.0.0.255
network 200.1.1.1 0.0.0.0
#
五、附 EVPN 5种路由的图表: