详 mplsoption a b c产生背景 及实验

tech2025-03-01  12

学习目标:

:了解MPLS


学习内容:

提示:

1、单域mpls vpn架构回顾 2、Option A的设计思想 3、 Option A的命令行 4 、Option B的设计思想 5、Option B的的命令行 5.基于思科华为的配置


学习时间:

提示:这里可以添加计划学习的时间 例如: 1、 周一至周五晚上 7 点—晚上9点 2、 周六上午 9 点-上午 11 点 3、 周日下午 3 点-下午 6 点


学习产出:

内容:

单域vpn:

zz mpls vpn处理行为:isp内网运行igp 内网启一个mpls ldp。 在pe上创建vpn instance ,针对每一个独立的客户拿不同的vpn instance 拿跟客户关联。关联最简单的方式就是。直接拿创建出来的vpn instance跟客户去做一个绑定。通过这个接口学到的路由都会加入vpn instance对应的子路由表。并且由于pe之间有vpn v4的邻居建立,在vpn instance中 设置路由的rt 和rd ,结合路由前缀掩码+rd和rt 将ipv4路由 转变成vpn v4 路由 给其它pe传递走。其它pe rt和rd做导入导出操作 将vpn v4路由还原成ipv4路由,给所连接的另一个pe将路由传递走。 内层标签是pe路由器在通告vpn v4路由时 自动通告的。收到标签是不能直接使用的,因为没有运行vpn insatnce的路由器是看不懂的。需要启mpls 针对vpn v4邻居更新源地址对应的igp路由来做一个标签分发

通过pe的公网接口转发时,会给数据打上标签,一般是两层,,内层标签:通常是vpn v4的标签 。外层 :去往vpn v4邻居针对路由下一跳所对应igp路由的标签,中间路由器只会查看外部标签,只会认为是是发给pe的,到达pe后通过php次末跳标签弹出 就只剩内层标签 pe在通过查找 vpn instance路由表来转发数据 。

ps :在日常的网络环境中 单域是不常见的,因为做单域的条件是非常苛刻的,因为需要总部和公司需要连接到同一家运营商 并且需要在同一个as。 所以当我们想实现跨域 跨运营商的架构时,就有4种解决方案:option a b c1 c2.

option a设计思想 :asbr对于一个isp不要将另一个isp当isp来看,当客户来看


实验

查看拓扑了解一下路由器的角色:

实验目的:连接2家运营商连接同一家公司的不同客 户,使用mpls vpn option a来打通

option a:

r1,r2:asbr,isp之间互联的链路两端的设备。 as域之间asbr不需要运行mpls ,只建立ipv4邻居关系 向对方发送简单的路由

ps :正统的option a bc中r1 r2都不会做路由重分发,只有在option c2中通过重分发来实现路由的传递。 ar1和ar2之间起子接口,通过绑定子接口,来发送私网路由。

2跟6之间启vpn v4邻居 1跟5vpn v4邻居。2和1能接收到vpn v4路由 但不能加入路由表 加路由表的前提是创建vrf r7 r8做rr.他们不在小数据层面的骨干流量传递路径.

9.10是路由反射器因为在运营商的网络环境中,需要大量路由器运行bgp,需要建立ibgp邻居,没有反射器存在的话,会导致邻居建立臃肿。rr会无视 vpn v4 r5过滤器的机制。 rt过滤器:我通过我的vpn v4邻居收到路由,全部接收。只能给ibgp邻居。但ibgp可以通过放行的rt传给其他EBGP邻居,和ibgp邻居没联系。

当pe路由器传递 vpnv 4路由的前提是,创建了vrf,vrf里会收集到ce的路由,给邻居发送走,邻居收到会查看路由携带的rt,有没有被 他导入,没有就丢弃。

option a:设计思想,把r2 r1把对方都当ce来看,创建vrf,asbr之间建立ebgp或igp。 彼此之间互传的都是ipv4路由,但都会把对方传过来的路由加入vrf路由表。

缺点:

配置量比较大带标签的报文不能端到端传递,不能做qos只有在 不同客户连接的不同as ,as也互联的情况下才能做optiion a 不具备任何的可扩展性。

option b:

在r1,r2之间直接建立vpn v4邻居,不用子接口。直连链路要使用mpls ,创建跟r6相似的vrf 一样的导入导出rt.需要关闭vpn v4的rt过滤器,只有关闭过滤器会收到vpn v4才能加入到本地的vpn v4 bgp 表里,才能把路由从asbr传递给另一端的asbr

缺:虽然标签是没有中断的,在左边isp传输标签时,标签是由r2通告的,在asbr之间传递的时候,标签被交换成对端的asbr所通告的标签,在右边isp中传递标签才是他真正产生这条路由的pe路由器所以分发的标签。不同运营商需要互连,当有第三方运营商中断了,作为穿越路由中断不同运营商的互连,并且他并没有直接连接客户 不可行

r9把路由传递给r10的时候 下一跳会变成r9,r5收到下一跳是r9.会出现问题,流量路由会很奇怪,就算能通rr做路由反射器对cpu 内存已经是极大的消耗了,如果还在流量路径中,需要做流量传递,那么在 控制层面 和数据层面 的双重打击下,rr可能 会hold 不住。 通过next-hop-unchange 来解决 能保证路由下一跳是不变的

option c1:

基于bgp的解决方案 r6,r5k跟rr建立vpn v4邻居, asbr之间建立ipv4邻居,rr需要把vpn v4路由传递给ebgp邻居。 r9 r10需要关闭vpn v4过滤器。

打三第三重标签:关于asbr的igp路由标签

bgp端到端传递

option c2:

r2把所属as路由发送给r1, asbr跟rr不用建立内部的igp邻居关系, 通过重分发把igp 路由到bgp 。 带有标签的路由在重分发时,需要标签继承、

ps:华为默认不会把带标签的报文发送给ebgp邻居,收到带标签的ebgp路由发现给ibgp 邻居时标签默认不能 ,pe收到pe的路由 加表的前提是需要有对端32位的主机路由

实验:

1.配置接口ip 地址

r7 : 192.168.7.7 192.168.57.7 r8 172.16.8.8 172.16.68.8 其它的:xy.1.1.x xy.1.1.y

2. 运营商内网启用igp

r1 router isis net 49.0001.0000.0000.0001.00 log-adjacency-changes all is-type level-2-only metric-style wide interface range loopback 0 . ethernet 0/1 ip router isis r3: router isis net 49.0001.0000.0000.0003.00 log-adjacency-changes all is-type level-2-only metric-style wide intface range ethernet 0/0-2 ,loopback 0 ip router isi r5: router isis net 49.0001.0000.0000.0005.00 log-adjacency-changes all is-type level-2-only metric-style wide int range e0/0-1 ,loopback ip router isis r10: r5: router isis net 49.0001.0000.0000.000A.00 log-adjacency-changes all is-type level-2-only metric-style wide int range e0/0 ,loopback 0 ip router isis r2 router ospf 110 router-id 2.2.2.2 intface range ethernet 0/0 ,loopback 0 ip ospf 110 area 0 r4: router ospf 110 router-id 4.4.4.4 int range e0/0-2 ,loopback 0 ip ospf 110 area 0 r6: router ospf 110 router-id 6.6.6.6 int range e0/1 ,loopback 0 ip ospf 110 area 0 r9: router ospf 110 router-id 9.9.9.9 int range e0/0,loopback 0 ip ospf 110 area 0

3.在内网启用mpls

r1,r2,r3,r4,r5,r6 ,r9 ,r10: ip cef mpls ip mpls label protocol ldp mpls ldp router-id loopback 0 force 内网接口启用 mpls ip show mpls ldp neighbor

4.解决ce和pe的问题

r6 vrf definition a-bj address-family ipv4 unicast exit rd 10:10 address-family ipv4 unicast route-target both 1010 exit int eth0/0 vrf forwarding a-bj ip add 172.16.68.6 255.255.255.0 ping vrf 172.16.68.8 r8: router bgp 8 no auto-summary no synchronization bgp router-id 8.8.8.8 redistribute connected neighbor 172.16.68.6 remote-as 8 r6:router bgp 10 no auto-summary no synchronazation bgp router-id 6.6.6.6 addres-family ipv4 vrf a-bj neighbor 172.16.68.8 remote-as 8 neighbor 172.16.68.8 active r5: vrf definition a-sh rd 10:10 address-family ipv4 unicast route-target 1010 both int e0/2 vrf forwarding a-sh ip add 192.168.57.5 255.255.255.0 router bgp 5 no synchronization no auto-summary bgp router-id 5.5.5.5 address-family ipv4 unicast vrf a-sh neighbor 192.168.57.7 r7 router bgp 7 no synchronization no auto-summary bgp router-id 7.7.7.7 neighbor 192.168.57.5 remote-as 5 reditribute connected
ps show bgp vrf 名 vpnv4 unicast 看路由
show bgp vrf 名 vpnv4 unicast summary 查看邻居

option a

r1 r2创建vrf

r2: vrf definition a-bj rd 10:10 address-family ipv4 unicast router-target both 10:10 interface e0/1.10 encapsulation dot1q 10 vrf forwarding a-bj ip adddress 10.1.1.2 255.255.255.0 no shut r6: no bgp default ipv4-unicast neighbor 9.9.9.9 remote-as 10 address-family vpnv4 unicast neighbor 9.9.9.9 active r9 router bgp 10 no auto-summary no synchronization bgp router-id 9.9.9.9 no bgp default ipv4-unicast bgp router-id 9.9.9.9 neighbor 6.6.6.6 remote-as 10 neighbor 2.2.2.2 remote-as 10 neighbor 6.6.6.6 update-sorce loopback 0 address-family vpnv4 unicast neighbor 6.6.6.6 active neighbor 2.2.2.2 active **neighbor 6.6.6.6 route-reflector-client neighbor 2.2.2.2 route-reflector-client** r2: router bgp 10 no auto-summary no synchronization bgp router-id 2.2.2.2 no bgp default ipv4 unicast neighbor 9.9.9.9 remote-as 10 neighbor 9.9.9.9 update-source loopback 0 address-family vpnv4 unicast neighbor 9.9.9.9 active

r2和r1建邻居

router bgp 10 address-family ipv4 vrf a-bj neighbor10.1.1.1 remote-as 20 neighbor 10.1.1.1 activate

右边的vpn v4

r10 : router bgp 20 no auto-summary no synchronizaiton bgp router -id 10.10.10.10 no bgp default ipv4-unicast neighbor 5.5.5.5 remote-as 20 neighbor 1.1.1.1 remote-as 20 neighbor 5.5.5.5 update-source loopback 0 neighbor 1.1.1.1 update-source loopback 0 address-family vpnv4 unicast neighbor 5.5.5.5 activate neighbor 5.5.5.5 activate neighbor 5.5.5.5 route-reflector-client neighbor 1.1.1.1 route-reflector-client r5: router bgp 20 bgp router-id 5.5.5.5 no bgp default ipv4 unicast neighbor 10.10.10.10 remote-as 20 neighbor 10.10.10.10 update-source loopback 0 address-family vpnv4 unicast neighbor 10.10.10.10 activate r1 router bgp 20 no auto-summary no synchronization bgp router-id 1.1.1.1 no bgp default ipv4 unicast neighbor 10.10.10.10 remote-as 20 neighbor 10.10.10.10 update-source loopback 0 address-family vpnv4 unicast neighbor 10.10.10.10 activate

r1的vrf

vrf definition a-sh rd 10:10 address-family ipv4 unicast route-target both 10:10 int e0/1.10 encapsulation dot1q 10 vrf forwarding a-sh ip add 10.1.1.1 255.255.255.0 no shut

r1和r2连接

r1 router bgp 20 address-family ipv4 vrf a-sh neighbor 10.1.1.2 remote-as 10 neighbor 10.1.1.2 activate

option B

1. asbr之间直接建立 vpnv4的邻居 删除掉vrf

ar1: routter bgp 20 neighbor 12.1.1.2 remote-as 10 address-family vpnv4 unicast neighbor 12.1.1.2 activate r2 router bgp 10 neighbor 12.1.1.1 remote-as 20 address-family vpnv4 unicast neighobr 12.1.1.1 activate

但现在是看不到传过来的vpnv4路由的 要关闭rt过滤器

no bgp default route-target filter 清路由 clear bgp vpnv4 unicast * soft r1 router bgp 20 addres-family vpnv4 unicast neighbor 10.10.10.10 next-hop-self clear bgp vpnv4 unicast * soft r2 router bgp 10 addres-family vpnv4 unicast neighbor 9.9.9.9 next-hop-self clear bgp vpnv4 unicast * soft

按常理来说:是通不了的 还需要启用mpls 思科模拟器 当针对物理链路启用vpnv4 邻居时,物理接口会自动启用mpls vrf forwarding

option C

1跟2之间不用建立vpnv4 bgp 建立ipv4 传公网路由

r1 router bgp 20 no neighbor 12.1.1.2 remote-as 10 neighbor 12.1.1.2 remote-as 10 address-family ipv4 unicast neighbor 12.1.1.2 activate neighbor 12.1.1.2 send-label r2 router bgp 10 no neighbor 12.1.1.1 remote-as 20 neighbor 12.1.1.1 remote-as 20 address-family ipv4 unicast neighbor 12.1.1.1 activate neighbor 12.1.1.1 send-label

做ipv4 bgp

r6: router bgp 10 nextwork 6.6.6.6 mask 255.255.255.255 address-family ipv4 unicast neighbor 9.9.9.9 active neighbor 9.9.9.9 send-label 通告ipv4路由携带标签 r9: router bgp 10 address-family ipv4 unicast network 9.9.9.9 mask 255.255.255.255.255 neighbor 6.6.6.6 activate neighbor 6.6.6.6 route-reflector-client neighbor 6.6.6.6 send-label neighbor 2.2.2.2 activate neighbor 2.2.2.2 route-reflector -client neighbor 2.2.2.2 send-label r2: network 2.2.2 mask 255.255.255.255 address-family ipv4 unicast neighbor 9.9.9.9 activate neighbor 9.9.9.9 send-label

去掉vpnv4

r2: router bgp 10 address-family vpnv4 unicast no neighbor 9.9.9.9 activate r9: router bgp 10 address-family vpnv4 unicast no neighbor 2.2.2.2 activate r1 router bgp 20 address-family vpnv4 unicast no neighbor10.10.10.10 activate r10

内网ibgp ipv4

r10 router bgp 20 addressfaily ipv4 unicast network 10.10.10.10 mask 255.255.255.255 neighbor 5.5.5.5 activate neighbor 5.5.5.5 route-reflector-client neighbor 5.5.5.5 send-label neighbor 1.1.1.1activate neighbor 1.1.1.1route-reflector-client neighbor 1.1.1.1send-label r5: router bgp 20 address-family ipv4 unicast neighbor 10.10.10.10 activate neighbor 10.10.10.10 send-label r1 router bgp 20 address-family ipv4 unicast neighbor 10.10.10.10 activate neighbor 10.10.10.10 send-label

1对10 2对9 指next-self-self 因为在vpnv4子地址簇中删除x.x.x.x activate 相关的命令都会被删除

9和10之间建立vpnv4 这里

r9 router bgp 10 no bgp default ipv4 unicast no bgp default route-target filter neighobr 10.10.10.10 update-source loopback 0 neighbor 10.10.10.10 ebgp-multihop addresss-family vpnv4 unicast neighbor 10.10.10.10 next-hop-unchange r10: router bgp 20 neighbor 9.9.9.9 remote-as 10 neighbor 9.9.9.9 ebgp-multihop no bgp default route-target filter addresss-family vpnv4 unicast neighbor 9.9.9.9 activate neighbor 9.9.9.9 next-hop-unchange

show 标签

show mpls forwarding-table show bgp ipv4 unicast labels

option C2

9和6 5和10 的ipv4 bgp 去掉 r2只需要跟r1 建立 ipv4 bgp路由

r9 router bgp 10 no neighbor 2.2.2.2 address-family ipv4 unicast no network 9.9.9.9 mask 255.255.255.255 no neighbor 6.6.6.6 activate no neighbor 2.2.2.2 activate r6: router bgp 10 address-family ipv4 unicast no network 6.6.6.6 mask 255.255.255.255 no neighbor 9.9.9.9 activate r2: route bgp 10 address-family ipv4 unicast no neighbor 9.9.9.9 activate no network 2.2.2.2 mask 255.255.255.255 r10 router bgp 20 no neighbor 1.1.1.1 adress-family ipv4 unicast no network 10.10.10.10 mask 255.255.255.255 no neighbor 5.5.5.5 activate r1: router bgp 20 no neighbor 10.10.10.10 // 直接去掉所有关于10.10.10.10 的配置 address-family ipv4 unicast no network 1.1.1.1 mask 255.255.255.255 no neighbor 10.10.10.10 activate r5 router bgp 20 address-family ipv4 unicast no netwrok 5.5.5.5 mask 255.255.255.255 no neighbor 10.10.10.10 activate

r2做route-map

r2 ip prefix-list ccie seq 10 permit 6.6.6.6/32 ip prefix-list ccie sq1 20 permit 9.9.9.9/32 route-map o-2-b permit 10 match ip address prefix-list ccie router bgp 10 address-family ipv4 unicast redistribute ospf 110 route-map o-2-b r1 ip prefix-list ccie seq 10 permit 5.5.5.5/32 ip prefix-list ccie sq1 20 permit 10.10.10.10/32 route-map i-2-b permit 10 match ip address prefix-list ccie router bgp 20 address-family ipv4 unicast redistribute isis level-2 route-map i-2-b
最新回复(0)