网上很多实验有关于hub and spoke模型的mpls ***都是PE-hub  and  CE-hub 有两个接口的,具体拓扑图如下

PE-hub and CE-hub 只有一个接口的 hub and spoke 模型的mpls ***_第1张图片

我有看到一个教程实验说,其实PE-hub  and  CE-hub 可以只有一个接口,需要hub site向spoke sites 宣告默认路由。

拓扑图如下:

 

PE-hub and CE-hub 只有一个接口的 hub and spoke 模型的mpls ***_第2张图片

具体细节实现:

一、在PE-hub只需建立一个vrf,它需要接收各××× sites 传来的路由,同时也需要将一条默认路由分发给××× sites ,让××× sites 的 ××× 流量引导向 CE-hub。

R3:

ip vrf a

 rd 1:1

 route-target export 1:1

 route-target import 3:3

!

ip vrf b

 rd 2:2

 route-target export 1:1

 route-target import 3:3

R5:

ip vrf a 

 rd 3:3

 route-target export 3:3

 route-target import 1:1

 

二、在mp-bgp 路由协议通告中,需要注意的是分发给各 ××× sites 的默认路由下一跳要是 CE-hub 连 PE-hub 端的端口。

R5:

router bgp 1

  address-family ipv4 vrf a

  redistribute connected

【这条命令很关键,只有你重分布了CE-hub 连 PE-hub 端的端口才能将下面的默认路由下一跳设置为CE-hub 连 PE-hub 端的端口,不然在 mp-bgp vrf a 的路由表中是没有CE-hub 连 PE-hub 端的端口的,你再怎么设置默认路由也不会出现在mp-bgp vrf a 的路由表】

 

  default-information originate

  no synchronization

  exit-address-family

 

 

三、在CE-hub中也需要一条路由再将流量返回到PE-hub。

R5:

 

router ospf 2 vrf a

 log-adjacency-changes

 network 192.168.3.0 0.0.0.255 area 0

 default-information originate always

 

最后达到的实验结果:

R1#traceroute 22.22.22.22 source loo 0

 

Type escape sequence to abort.

Tracing the route to 22.22.22.22

 

  1 192.168.1.2 144 msec 184 msec 228 msec

  2 100.0.0.2 [MPLS: Labels 102/204 Exp 0] 980 msec 776 msec 888 msec

  3 192.168.3.1 [MPLS: Label 204 Exp 0] 516 msec 512 msec 732 msec

  4 192.168.3.2 712 msec 636 msec 548 msec

  5 192.168.3.1 556 msec 652 msec 592 msec

  6 100.0.1.1 [MPLS: Labels 101/21 Exp 0] 1120 msec 1384 msec 1980 msec

  7 192.168.2.2 [MPLS: Label 21 Exp 0] 1528 msec 1632 msec 1528 msec

  8 192.168.2.1 1604 msec 1228 msec 1292 msec

R3:

 

 

R3#show ip route vrf a

Gateway of last resort is 3.3.3.3 to network 0.0.0.0
 
     11.0.0.0/32 is subnetted, 1 subnets
O       11.11.11.11 [110/65] via 192.168.1.1, 00:27:53, Serial0/0
C    192.168.1.0/24 is directly connected, Serial0/0
B    192.168.3.0/24 [200/0] via 3.3.3.3, 00:27:07
B*   0.0.0.0/0 [200/16] via 3.3.3.3, 00:27:07
 
R5:
R5#show ip bgp ***v4 vrf a
BGP table version is 13, local router ID is 3.3.3.3
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: 3:3 (default for vrf a)
*> 0.0.0.0          192.168.3.2             16         32768 ?
*>i11.11.11.11/32   1.1.1.1                 65    100      0 ?
*>i22.22.22.22/32   1.1.1.1                 65    100      0 ?
*>i192.168.1.0      1.1.1.1                  0    100      0 ?
*>i192.168.2.0      1.1.1.1                  0    100      0 ?
*> 192.168.3.0      0.0.0.0                  0         32768 ?
 
 
R5#show mpls for d 
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface              
201    Pop tag     2.2.2.2/32        0          Se0/0      point2point  
        MAC/Encaps=4/4, MRU=1504, Tag Stack{}
        0F008847 
        No output feature configured
    Per-packet load-sharing
202    Pop tag     100.0.0.0/24      0          Se0/0      point2point  
        MAC/Encaps=4/4, MRU=1504, Tag Stack{}
        0F008847 
        No output feature configured
    Per-packet load-sharing
203    101         1.1.1.1/32        0          Se0/0      point2point  
        MAC/Encaps=4/8, MRU=1500, Tag Stack{101}
        0F008847 00065000
        No output feature configured
    Per-packet load-sharing
 
204    Untagged    0.0.0.0/0[V]      2232       Se0/1      point2point  
        MAC/Encaps=0/0, MRU=1504, Tag Stack{}
        ××× route: a
        No output feature configured
    Per-packet load-sharing
205    Aggregate   192.168.3.0/24[V] 0                                  
        MAC/Encaps=0/0, MRU=0, Tag Stack{}
        ××× route: a
        No output feature configured
    Per-packet load-sharing
 
 
R5#show ip route vrf a
 
Routing Table: a
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is 192.168.3.2 to network 0.0.0.0
 
     22.0.0.0/32 is subnetted, 1 subnets
B       22.22.22.22 [200/65] via 1.1.1.1, 00:29:53
     11.0.0.0/32 is subnetted, 1 subnets
B       11.11.11.11 [200/65] via 1.1.1.1, 00:29:53
B    192.168.1.0/24 [200/0] via 1.1.1.1, 00:29:53
B    192.168.2.0/24 [200/0] via 1.1.1.1, 00:29:53
C    192.168.3.0/24 is directly connected, Serial0/1
S*   0.0.0.0/0 [1/0] via 192.168.3.2
 
R3:
R3#show mpls for d
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface              
16     Pop tag     2.2.2.2/32        0          Se0/2      point2point  
        MAC/Encaps=4/4, MRU=1504, Tag Stack{}
        0F008847 
        No output feature configured
    Per-packet load-sharing
17     102         3.3.3.3/32        0          Se0/2      point2point  
        MAC/Encaps=4/8, MRU=1500, Tag Stack{102}
        0F008847 00066000
        No output feature configured
    Per-packet load-sharing
18     Pop tag     100.0.1.0/24      0          Se0/2      point2point  
        MAC/Encaps=4/4, MRU=1504, Tag Stack{}
        0F008847 
        No output feature configured
    Per-packet load-sharing
19     Untagged    11.11.11.11/32[V] 2628       Se0/0      point2point  
        MAC/Encaps=0/0, MRU=1504, Tag Stack{}
        ××× route: a
        No output feature configured
    Per-packet load-sharing
20     Aggregate   192.168.1.0/24[V] 0                                  
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface              
        MAC/Encaps=0/0, MRU=0, Tag Stack{}
        ××× route: a
        No output feature configured
    Per-packet load-sharing
21     Untagged    22.22.22.22/32[V] 624        Se0/1      point2point  
        MAC/Encaps=0/0, MRU=1504, Tag Stack{}
        ××× route: b
        No output feature configured
    Per-packet load-sharing
22     Aggregate   192.168.2.0/24[V] 0                                  
        MAC/Encaps=0/0, MRU=0, Tag Stack{}
        ××× route: b
        No output feature configured
    Per-packet load-sharing
 
R6:
R6#show ip rou
Gateway of last resort is 192.168.3.1 to network 0.0.0.0
 
C    192.168.3.0/24 is directly connected, Serial0/0
O*E2 0.0.0.0/0 [110/1] via 192.168.3.1, 00:00:15, Serial0/0
 
R3:
R3#show ip route vrf b
 
Gateway of last resort is 3.3.3.3 to network 0.0.0.0
 
     22.0.0.0/32 is subnetted, 1 subnets
O       22.22.22.22 [110/65] via 192.168.2.1, 00:32:37, Serial0/1
C    192.168.2.0/24 is directly connected, Serial0/1
B    192.168.3.0/24 [200/0] via 3.3.3.3, 00:31:52
B*   0.0.0.0/0 [200/16] via 3.3.3.3, 00:31:52