在我的资源里可以下载(就在这篇文章的开头也可以下载)
R1<->R2:EBGP
R2<->R5:IBGP,OSPF
R5<->R6:EBGP
R2/R5:
mpls ldp router-id loopback 0
interface e0/1
mpls ip
R3/R4:
mpls ldp router-id loopback 0
interface range e0/0-1
mpls ip
R1#ping 6.6.6.6 so lo0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
R1#
网络通了
通过traceroute查看:中间MPLS域的确是通过label进行交换转发的
R1#traceroute 6.6.6.6 source lo 0
Type escape sequence to abort.
Tracing the route to 6.6.6.6
VRF info: (vrf in name/id, vrf out name/id)
1 12.1.1.2 1 msec 0 msec 0 msec
2 23.1.1.3 [MPLS: Label 18 Exp 0] 1 msec 1 msec 0 msec
3 * * *
4 45.1.1.5 1 msec 0 msec 1 msec
5 56.1.1.6 0 msec * 1 msec
R1#
如果不希望别人知道MPLS域内的主机的情况,可以关闭TTL复制功能,这样就可以只显示两个LER的路由器IP,隐藏内部的LSR路由器
关闭R2上的IP TTL复制功能,测试效果
R2(config)#no mpls ip propagate-ttl
R2(config)#
R1再次测试Traceroute
R1#traceroute 6.6.6.6 source lo 0
Type escape sequence to abort.
Tracing the route to 6.6.6.6
VRF info: (vrf in name/id, vrf out name/id)
1 12.1.1.2 0 msec 0 msec 0 msec
2 45.1.1.5 0 msec 1 msec 1 msec
3 56.1.1.6 1 msec * 2 msec
R1#
R6#traceroute 1.1.1.1 so lo0
Type escape sequence to abort.
Tracing the route to 1.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 56.1.1.5 0 msec 0 msec 0 msec
2 45.1.1.4 [MPLS: Label 16 Exp 0] 1 msec 1 msec 1 msec
3 * * *
4 23.1.1.2 1 msec 0 msec 1 msec
5 12.1.1.1 1 msec * 1 msec
R6#
R5也 关闭IPTTL复制功能,
R6#traceroute 1.1.1.1 so lo0
Type escape sequence to abort.
Tracing the route to 1.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
1 56.1.1.5 1 msec 0 msec 0 msec
2 23.1.1.2 1 msec 0 msec 1 msec
3 12.1.1.1 1 msec * 2 msec
R6#
MPLS对解决BGP路由黑洞问题的分析
为了便于查看,重新对标签按编号分区(要使新标签分区生效,要对接口关闭和开启MPLS)
R2 标签 200 - 299
R3 标签 300 - 399
R4 标签 400 - 499
R5 标签 500 - 599
R2:
mpls label range 200 299
router ospf 1
shutdown
no shutdown
R3:
mpls label range 300 399
router ospf 1
shutdown
no shutdown
R4:
mpls label range 400 499
router ospf 1
shutdown
no shutdown
R5:
mpls label range 500 599
router ospf 1
shutdown
no shutdown
上面拓扑中,只有R1
----(EBGP)----R2
----(1BGP)—R5
----(1BGP)—R6
运行了BGP,6.6.6.6路由对于R2来说下一跳为R5(5.5.5.5),于是:
label:302
R2#show ip cef 5.5.5.5
5.5.5.5/32
nexthop 23.1.1.3 Ethernet0/1 label 302-(local:202)
R2#
swap替换:302--->402
R3#show mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
300 Pop Label 2.2.2.2/32 635 Et0/1 23.1.1.2
301 Pop Label 4.4.4.4/32 0 Et0/0 34.1.1.4
302 402 5.5.5.5/32 685 Et0/0 34.1.1.4
303 Pop Label 45.1.1.0/24 0 Et0/0 34.1.1.4
R3#
R4#show mpls forwarding-table
Local Outgoing Prefix Bytes Label Outgoing Next Hop
Label Label or Tunnel Id Switched interface
400 300 2.2.2.2/32 899 Et0/0 34.1.1.3
401 Pop Label 3.3.3.3/32 0 Et0/0 34.1.1.3
402 Pop Label 5.5.5.5/32 816 Et0/1 45.1.1.5
403 Pop Label 23.1.1.0/24 0 Et0/0 34.1.1.3
R4#
R5#show ip cef 6.6.6.6
6.6.6.6/32
nexthop 56.1.1.6 Ethernet0/0
R5#
同理,R6环回口6.6.6.6访问1.1.1.1执行同样过程!