刚开学的时候在淘宝上买了一本盗版的《MPLS×××体系结构 CCIP版》,现在看着很是头大。倒不是说书映的不行,而是这本书太高深了,不知道怎么读下去。硬着头皮看了大半,实在不想翻了。翻译有问题,好多地方翻译的很突兀,这倒是其次,主要的问题是理论性的东西太多了,但是又泛泛而谈,云里雾里的,看一遍下来都不得要旨。实验印证的部分也太少,学起来真的不知道如何下手。总之,这本书不推荐。手头有一本我们实验室的CCIE(SP)苏老板推荐的cisco出的文档,700多页,全英文,当时想把中文的搞定了再来啃他深入学习。这一个多星期看看这个文档后,真是后悔早没看啊!

下面这段文字是读PE-CE运行OSPF的一点读书笔记,配合一个小实验。

在传统的OSPF骨干区域里传输TYPE 3LSA时,必须是从area 0区域的邻居传来的才接收,但是在MPLS ×××CE端无法形成邻居,因此,提出了superbackbone的概念。超级骨干区域的引入带来的改变就是所有连接到超级骨干的区域,不管其是backbone area 还是non-backbone area ,都视为backbone area。也就是说,传统的OSPF不再需要骨干区域。只有当PE连接了同一个OSPF下的不同area 时,PE才需要运行在骨干区域。 在超级骨干,不再有adjacent关系或者flooding,只有运行sham-link时才会形成邻居。PE通过MBGP-iBGP来运载拓展属性。

下图是MPLS ×××下的OSPF的拓展属性

 

*关于route拓展属性的option字段:如果设置为1表示E2,如果为0表示E1.

*关于domain-id:这个值默认就是取ospf的进程号。我们可以在OSPF进程下通过domain-id xx来修改。对端的PE如果接收到的routesdomain-id与自己的不同,就当作type-5来接收。

*上诉言论有待实验验证!

Domain-idMPLS ×××中对OSPF是一个十分重要的概念,区别于传统OSPFMPLS依赖domain-id来进行OSPF的路由传输。默认情况下domain-id就是process number,这个值在OSPF路由充分不进MP-iBGP的时候设置。

实验:主要对上面论述的一些概念结合实际的实验印证一下。

拓扑:

描述:

1.              CE1-ACE2-A作为××× A的两个远程客户端接入路由器,分别发布内部网络172.16.10.0/24172.16.20.0/24进入OSPF

2.              PE-CE间运行的OSPFprocess id号码为100,这个值在实验中重点关注。此外,PE-CE都运行在AREA 0

3.              P网络内部运行ISIS建立MPLSPE1-AS1PE2-AS1间使用loopback 0建立MP-iBGP

配置:

CE1-A

CE1-A#sh run

….omitted

hostname CE1-A

!

memory-size iomem 5

ip cef

!

interface Loopback0

 ip address 172.16.10.1 255.255.255.0

 ip ospf network point-to-point

!

interface FastEthernet0/0

 no ip address

 duplex auto

 speed auto

!

interface FastEthernet0/0.12

 encapsulation dot1Q 12

 ip address 12.1.1.1 255.255.255.0

!

router ospf 100

 router-id 1.1.1.1

 log-adjacency-changes

 passive-interface Loopback0

 network 12.1.1.1 0.0.0.0 area 0

 network 172.16.10.0 0.0.0.255 area 0

!       

PE1-AS1:

E1-AS1#sh run

(….omitted)

hostname PE1-AS1

!

ip cef

!

ip vrf A

 rd 1:0

 route-target export 1:0

 route-target import 1:0

!        

mpls label range 299 2999

mpls label protocol ldp

!

interface Loopback0

 ip address 2.2.2.2 255.255.255.255

 isis circuit-type level-2-only

!

interface FastEthernet0/0

 no ip address

 duplex auto

 speed auto

!

interface FastEthernet0/0.12

 encapsulation dot1Q 12

 ip vrf forwarding A

 ip address 12.1.1.2 255.255.255.0

!

interface FastEthernet0/0.23

 encapsulation dot1Q 23

 ip address 23.1.1.2 255.255.255.0

 ip router isis

 mpls ldp discovery transport-address interface

 mpls ip

 isis circuit-type level-2-only

!

router ospf 100 vrf A

 router-id 2.2.2.2

 log-adjacency-changes

 redistribute bgp 1 subnets

 network 12.1.1.2 0.0.0.0 area 0

!

router isis

 net 47.2340.0000.0000.2222.00

 is-type level-2-only

 metric-style wide

 passive-interface Loopback0

!

router bgp 1

 bgp router-id 2.2.2.2

 no bgp default ipv4-unicast

 bgp log-neighbor-changes

 neighbor 4.4.4.4 remote-as 1

 neighbor 4.4.4.4 update-source Loopback0

 !

 address-family ***v4

 neighbor 4.4.4.4 activate

 neighbor 4.4.4.4 send-community extended

 exit-address-family

 !

 address-family ipv4 vrf A

 redistribute ospf 100 vrf A

 no synchronization

 exit-address-family

!

mpls ldp router-id Loopback0 force

P:

P#sh run

(….omitted)

hostname P

!

ip cef

!

mpls label range 300 399

mpls label protocol ldp

!        

interface Loopback0

 ip address 3.3.3.3 255.255.255.255

 isis circuit-type level-2-only

!

interface FastEthernet0/0

 no ip address

 duplex auto

 speed auto

!

interface FastEthernet0/0.23

 encapsulation dot1Q 23

 ip address 23.1.1.3 255.255.255.0

 ip router isis

 mpls ldp discovery transport-address interface

 mpls ip

 isis circuit-type level-2-only

!

interface FastEthernet0/0.34

 encapsulation dot1Q 34

 ip address 34.1.1.3 255.255.255.0

 ip router isis

 mpls ldp discovery transport-address interface

 mpls ip

 isis circuit-type level-2-only

!

router isis

 net 47.2340.0000.0000.3333.00

 is-type level-2-only

 metric-style wide

 passive-interface Loopback0

!

mpls ldp router-id Loopback0 force

!

*R4,R5配置与R1,R2略同,略。

测试:

1.       PE1-AS1上的MPLS ×××的路由表

PE1-AS1#sh ip b *** all

BGP table version is 9, local router ID is 2.2.2.2

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path

Route Distinguisher: 1:0 (default for vrf A)

*> 12.1.1.0/24      0.0.0.0                  0         32768 ?

*>i45.1.1.0/24      4.4.4.4                  0    100      0 ?

*> 172.16.10.0/24   12.1.1.1                11         32768 ?

*>i172.16.20.0/24   4.4.4.4                 11    100      0 ?

         如上所示,都正常学到了。

2.       客户端路由

CE1-A#sh ip rou os

     172.16.0.0/24 is subnetted, 2 subnets

O IA    172.16.20.0 [110/21] via 12.1.1.2, 00:30:18, FastEthernet0/0.12

     45.0.0.0/24 is subnetted, 1 subnets

O IA    45.1.1.0 [110/11] via 12.1.1.2, 00:30:18, FastEthernet0/0.12

如上所示,这里接收到的路由都是O IA

 

3.       网络连通性测试

CE1-A#ping 172.16.20.1 sou l0

 

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 172.16.20.1, timeout is 2 seconds:

Packet sent with a source address of 172.16.10.1

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 68/87/104 ms

好,也通了。

 

下面重点关注在前文中描述的OSPF route domain-idrouter-id这三个拓展属性。其实这三个属性在一条命令中都显示出来了。

PE1-AS1#sh ip b *** all 172.16.20.0

BGP routing table entry for 1:0:172.16.20.0/24, version 9

Paths: (1 available, best #1, table A)

  Not advertised to any peer

  Local

    4.4.4.4 (metric 20) from 4.4.4.4 (4.4.4.4)

      Origin incomplete, metric 11, localpref 100, valid, internal, best

      Extended Community: RT:1:0 OSPF DOMAIN ID:0x0005:0x000000640200

        OSPF RT:0.0.0.0:2:0 OSPF ROUTER ID:4.4.4.4:0

      mpls labels in/out nolabel/403

OSPF DOMAIN ID:0x0005:0x000000640200

         从上面的这个字段可以读出domain-id,这里的输出与字段格式有点不一样,6416进制的,转换过来就是100,也就是我们前面设置的OSPF 进程号,因为默认这个进程号就是作为domain-id写入***v4的。

 

OSPF RT:0.0.0.0:2:0

           这里的0.0.0.0表示OSPF运行在区域02表示LSA是类型2(实验中的设备是用FastEthernet端口开子接口实现互联的),最后的0option字段,如果是类型3LSA话就显示出意义来了,后面的实验会有探讨。

OSPF ROUTER ID:4.4.4.4:0

           需要这里,这里的router-id就是PErouter-id,跟这个网段源自的那个路由器没有关系。

           前文有过交代,domain-id是决定LSA以何种类型的LSA转发的一个关键因素,也就是说,如果是TYPE1 TYPE2LSA,如果domain-id一直的话,都是以TYPE3LSA传递,对端收到的就是O IA路由;如果domain-id不一致的话,就都是以外部路由转发,也就是TYPE 5或者TYPE 7

           下面修改R4domain-id,然后观察对比效果。

PE2-AS1(config)#router os 100

PE2-AS1(config-router)#domain-id 0.0.0.200

PE2-AS1(config-router)#end

PE1-AS1#cle ip b * *** un so i

PE1-AS1#sh ip b *** all 172.16.20.0

BGP routing table entry for 1:0:172.16.20.0/24, version 19

Paths: (1 available, best #1, table A)

Flag: 0xA00

  Not advertised to any peer

  Local

    4.4.4.4 (metric 20) from 4.4.4.4 (4.4.4.4)

      Origin incomplete, metric 11, localpref 100, valid, internal, best

      Extended Community: RT:1:0 OSPF DOMAIN ID:0x0005:0x000000C80200

        OSPF RT:0.0.0.0:2:0 OSPF ROUTER ID:4.4.4.4:0

      mpls labels in/out nolabel/403

如上所示domain-id字段改变了,如果你手动算一下就会发现,C8转换成10进制就是200,就是我们在上面修改后的domain-id

然后再去CE1-A上看看路由。

CE1-A#sh ip rou os

     172.16.0.0/24 is subnetted, 2 subnets

O E2    172.16.20.0 [110/11] via 12.1.1.2, 00:06:37, FastEthernet0/0.12

     45.0.0.0/24 is subnetted, 1 subnets

O E2    45.1.1.0 [110/1] via 12.1.1.2, 00:06:37, FastEthernet0/0.12

哈哈,都变成OE2路由了。这是默认的路由类型。