还是这张图,但是BGP是配置在环回口上的!
R4(config)#router bgp 10
R4(config-router)#no neighbor 45.45.45.5 remote-as 20
R4(config-router)#nei 5.5.5.5 remote 20
R4(config-router)#nei 5.5.5.5 up lo 0
R4(config-router)#add v
R4(config-router-af)#nei 5.5.5.5 ac
R4(config-router-af)#nei 5.5.5.5 e
R5(config)#router bgp 20
R5(config-router)#no neighbor 45.45.45.4 remote-as 10
R5(config-router)#nei 4.4.4.4 remote 10
R5(config-router)#nei 4.4.4.4 up lo 0
R5(config-router)#add v
R5(config-router-af)#nei 4.4.4.4 ac
R5(config-router-af)#nei 4.4.4.4 e
然而4.4.4.4,5.5.5.5都是不可达的所以要写一条静态路由!
R4(config)#ip route 5.5.5.5 255.255.255.255 45.45.45.5
R5(config)#ip route 4.4.4.4 255.255.255.255 45.45.45.4
并且R4,R5使用next-hop-self
R1#show ip route ospf
8.0.0.0/32 is subnetted, 1 subnets
O IA 8.8.8.8 [110/11] via 12.12.12.2, 00:01:18, FastEthernet0/0
78.0.0.0/24 is subnetted, 1 subnets
O IA 78.78.78.0 [110/11] via 12.12.12.2, 00:01:18, FastEthernet0/0
R8#show ip route ospf
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/11] via 78.78.78.7, 00:01:39, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.12.12.0 [110/11] via 78.78.78.7, 00:01:39, FastEthernet0/0
现在学习到了路由,但是Ping的通嘛?
R1#traceroute 8.8.8.8
1 12.12.12.2 72 msec 8 msec 56 msec
2 * * *
3
显然Ping不通,这是什么原因呢?
R2#show ip cef vrf abc 8.8.8.8 detail
8.8.8.8/32, version 10, epoch 0, cached adjacency 23.23.23.3
0 packets, 0 bytes
tag information set
local tag: 205
fast tag rewrite with Fa0/1, 23.23.23.3, tags imposed: {301 406}
via 4.4.4.4, 0 dependencies, recursive
next hop 23.23.23.3, FastEthernet0/1 via 4.4.4.4/32
valid cached adjacency
tag rewrite with Fa0/1, 23.23.23.3, tags imposed: {301 406}
301是顶层标签目的是为了发到下一跳,406是底层标签是由R4分配的,然后在R4上看。
R4#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
400 Pop tag 3.3.3.3/32 0 Fa0/0 34.34.34.3
401 300 2.2.2.2/32 0 Fa0/0 34.34.34.3
402 Pop tag 23.23.23.0/24 0 Fa0/0 34.34.34.3
403 Untagged 5.5.5.5/32 0 Fa0/1 45.45.45.5
404 204 10:2:12.12.12.0/24 \
0 Fa0/0 34.34.34.3
405 203 10:2:1.1.1.1/32 0 Fa0/0 34.34.34.3
木有406!!!!!
而且看到这一条路由它是Untagged的!很显然的发现R4和R5之间没有标签的交换,它无法到达下一跳!
在R4和R5之间建立LDP邻居关系之后:
R4#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
400 Pop tag 3.3.3.3/32 0 Fa0/0 34.34.34.3
401 300 2.2.2.2/32 0 Fa0/0 34.34.34.3
402 Pop tag 23.23.23.0/24 0 Fa0/0 34.34.34.3
403 Pop tag 5.5.5.5/32 0 Fa0/1 45.45.45.5
404 204 10:2:12.12.12.0/24 \
0 Fa0/0 34.34.34.3
405 203 10:2:1.1.1.1/32 0 Fa0/0 34.34.34.3
406 505 10:7:8.8.8.8/32 0 Fa0/1 45.45.45.5
407 504 10:7:78.78.78.0/24 \
0 Fa0/1 45.45.45.5
406出现啦!!!!
R1#traceroute 8.8.8.8
1 12.12.12.2 124 msec 32 msec 64 msec
2 23.23.23.3 [MPLS: Labels 301/406 Exp 0] 248 msec 208 msec 100 msec
3 34.34.34.4 [MPLS: Label 406 Exp 0] 60 msec 176 msec 88 msec
4 45.45.45.5 [MPLS: Label 505 Exp 0] 88 msec 40 msec 176 msec
5 56.56.56.6 [MPLS: Labels 601/703 Exp 0] 156 msec 204 msec 104 msec
6 78.78.78.7 [MPLS: Label 703 Exp 0] 64 msec 172 msec 36 msec
7 78.78.78.8 132 msec * 240 msec
下一跳改变了三次所以底层标签改变3次!