本实验讨论如何优化控制标签的通告。

拓扑:

 

说明:四台路由器直连 R1ßàR2ßàR3ßàR4,各开一个loopback 0口宣告进OSPF

首先配置使得网络通畅。

1.         检测邻居建立情况

R1#sh mpls ldp nei

    Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 1.1.1.1:0

        TCP connection: 2.2.2.2.57359 - 1.1.1.1.646

        State: Oper; Msgs sent/rcvd: 11/11; Downstream

        Up time: 00:01:38

        LDP discovery sources:

          Serial0/0, Src IP addr: 12.1.1.2

        Addresses bound to peer LDP Ident:

          12.1.1.2        23.1.1.2        2.2.2.2

2.         查看LFIB

R1#sh mpls forwarding-table

Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop   

tag    tag or VC   or Tunnel Id      switched   interface             

100    200         34.1.1.0/24       0          Se0/0      point2point 

101    Pop tag      2.2.2.2/32        0          Se0/0      point2point 

102    202         3.3.3.3/32        0          Se0/0      point2point 

103    203         4.4.4.4/32        0          Se0/0      point2point 

104    Pop tag      23.1.1.0/24       0          Se0/0      point2point

3.         问题所在

在上面的LFIB中,100104这两个标签其实是不需要的,因为这两个标签对应的FEC是路由器之间的链路,我们发送数据包的时候并不会拿他们当作DIP。因此可以去除掉他们。同样的问题在其他的路由器中也同样存在!

4.         解决问题

1.         全局关闭标签通告:no mpls ldp advertise-label

R2#sh mpls for

Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop   

tag    tag or VC   or Tunnel Id      switched   interface             

200    Pop tag     34.1.1.0/24       0          Se0/1      point2point 

201    Untagged    1.1.1.1/32        0          Se0/0      point2point 

202    Pop tag     3.3.3.3/32        0          Se0/1      point2point 

203    302         4.4.4.4/32        0          Se0/1      point2point

R1上全局关闭标签分发后,在R2上可以查看到1.1.1.1pop tag 变为untagged。但是注意,R1不给R2传送标签,但是R2依然会给R3,R4传送1.1.1.1的标签,所以在R3,R41.1.1.1仍然是打标签的。

另外还有一点一定需要注意,关闭标签通告,并没有关闭标签分配!所以我们在R1show mpls ip binding’的时候,跟没有关闭标签通告时是一模一样的!

 

2.         手工指定那些FEC不需要通告给LDP对等体:mpls ldp advertise-labels for A to B

我们在R2R3上指定即可达到目的(后面会有说明)。

mpls ldp advertise-labels for 1 to 2

access-list 1 deny   12.1.1.0

access-list 1 deny   23.1.1.0

access-list 1 deny   34.1.1.0

access-list 1 permit any

access-list 2 permit 1.1.1.1

access-list 2 permit 3.3.3.3

access-list 2 deny any

需要注意的是,标签分配是在本实验中是根据路由表里的条目来分配的,也就是说,他也会给非自身直连的网段分配标签。所以,所有在自己路由表里面的对mpls不需要的都可以写到ACL中,并不是仅仅写自身直连的网段。

因此这倒让人省心不少,因为IGP数据库都是同步的,因此,上面饿这条命令在所有路由器上复制粘贴即可。

另外,前面我们说这段命令只需要在R2,R3上输入即可到达本实验的需求,R1,R4都不用输,这是因为23.1.1.034.1.1.0这两个网段,对R1来说R1是属于接受者,R1向上游通告是没有意义的,如果R1还有下游邻居,那么一定要就一定要写了;12.1.1.0是自身直连,不会打标签。

但是,R1,R4的无谓通告还是会带来无谓的CPU时间和带宽占用。因此,R1,R4都输上吧。

R4#sh ip acce

Standard IP access list 1

    10 deny   12.1.1.0 (6 matches)

    20 deny   23.1.1.0 (5 matches)

    30 deny   34.1.1.0 (4 matches)

    40 permit any (36 matches)

Standard IP access list 2

    10 permit 3.3.3.3 (20 matches)

     20 deny   any

 

3.         验收

R1#sh mpls for

Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop   

tag    tag or VC   or Tunnel Id      switched   interface             

100    Untagged    34.1.1.0/24       0          Se0/0      point2point 

101    Pop tag     2.2.2.2/32        0          Se0/0      point2point 

102    202         3.3.3.3/32        0          Se0/0      point2point 

103    203         4.4.4.4/32        0          Se0/0      point2point 

104    Untagged    23.1.1.0/24       0          Se0/0      point2point

R1#tra 4.4.4.4

 

Type escape sequence to abort.

Tracing the route to 4.4.4.4

  1 12.1.1.2 [MPLS: Label 203 Exp 0] 116 msec 136 msec 76 msec

  2 23.1.1.3 [MPLS: Label 302 Exp 0] 136 msec 92 msec 72 msec

  3 34.1.1.4 120 msec *  132 msec

好,依然畅通!上面讨论的是如果控制出战的标签通告,还可以对入站的标签进行过滤控制,命令为mpls ldp nei vrf ***-name nbr-add labels accept acl。

这个以后也可以做一个小实验,别看是小实验,小实验里也哟大学问啊!

好,今天的实验到此结束!