MPLS hub and spoke 实验问题


MPLS hub and spoke 实验问题_第1张图片

题目说明:spoke端不能直接通信,必须经过hub端中转,通过hub和spoke端不同的输入输出RT实现,因此上图中,在R3上的任何spoke路由如果没有进入BGP AS300就无法改变RT值,也就无法在R3上直接中转,这里设法使R3向AS 300内的其中一个router通告右侧spoke的路由,再从AS300的另一个router学到这些路由,此题以7.77.7为例,然后改变weight值,让r3优选迂回的路径,从而实现这些spoke路由改变了RT,让另一个spoke可以接受它们。

R1

   

no ip domain lookup
ip cef    
no ipv6 cef
!               
interface Loopback0
 ip address 1.1.1.1 255.255.255.255
!         
interface Ethernet0/0
 ip address 12.1.1.1 255.255.255.0
!         
interface Ethernet0/1
 ip address 13.1.1.1 255.255.255.0
!         
!         
router bgp 300
 bgp log-neighbor-changes
 network 1.1.1.1 mask 255.255.255.255
 neighbor 12.1.1.2 remote-as 300
 neighbor 13.1.1.3 remote-as 100
!         

-------------------------------------------------------------------

R2:


no ip domain lookup
ip cef    
no ipv6 cef
!         
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
!         
interface Ethernet0/0
 ip address 12.1.1.2 255.255.255.0
!         
interface Ethernet0/1
 ip address 23.1.1.2 255.255.255.0
!         
router bgp 300
 bgp log-neighbor-changes
 network 2.2.2.2 mask 255.255.255.255
 neighbor 12.1.1.1 remote-as 300
 neighbor 23.1.1.3 remote-as 100
 neighbor 23.1.1.3 advertisement-interval 60
!         
------------------------------------------------------------------------------

R3:

       
ip vrf cisco
 rd 3:3   
 route-target export 101:101
 route-target import 100:100
!          
no ip domain lookup
ip cef
no ipv6 cef
!
mpls label range 300 399
mpls label protocol ldp
!         
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
!         
interface Ethernet0/0
 ip vrf forwarding cisco
 ip address 13.1.1.3 255.255.255.0
!         
interface Ethernet0/1
 ip vrf forwarding cisco
 ip address 23.1.1.3 255.255.255.0
!         
interface Ethernet0/2
 ip address 34.1.1.3 255.255.255.0
 mpls ip  
!         
interface Ethernet0/3
 ip address 35.1.1.3 255.255.255.0
 mpls ip  
!         
!         
router ospf 1
 network 3.3.3.3 0.0.0.0 area 0
 network 34.1.1.0 0.0.0.255 area 0
 network 35.1.1.0 0.0.0.255 area 0
!         
router bgp 100
 bgp log-neighbor-changes
 neighbor 4.4.4.4 remote-as 100
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 neighbor 5.5.5.5 remote-as 100
 neighbor 5.5.5.5 update-source Loopback0
 neighbor 5.5.5.5 next-hop-self
 !        
 address-family v4
  neighbor 4.4.4.4 activate
  neighbor 4.4.4.4 send-community both
  neighbor 4.4.4.4 route-reflector-client /*R3是v4的RR*/

  neighbor 5.5.5.5 activate
  neighbor 5.5.5.5 send-community both
  neighbor 5.5.5.5 route-reflector-client
 exit-address-family
 !        
 address-family ipv4 vrf cisco
  redistribute connected
  neighbor 13.1.1.1 remote-as 300
  neighbor 13.1.1.1 activate
  neighbor 13.1.1.1 allowas-in
  neighbor 23.1.1.2 remote-as 300
  neighbor 23.1.1.2 activate
  neighbor 23.1.1.2 advertisement-interval 60 /*减少路由抖动,在R3上会出现通过R2来的7.7.7.7 时隐时现的现象,增加通告间隔后,条目存在时间更长,原因是通过AS 300的路径更长

  neighbor 23.1.1.2 allowas-in/*允许相同的AS条目进入*/
  neighbor 23.1.1.2 distribute-list 10 out /*禁止向R2通告关于list 10指定的路由,这里是7.7.7.7,从而让r2从r1学到7.7.7.7后通告给r3,在r3上改变7.7.7.7的权重,使得R3优选通过R2-R1的方式迂回到7.7.7.7

  neighbor 23.1.1.2 route-map cisco in /*作用同上*/
 exit-address-family
!         
access-list 5 permit 7.7.7.7 /*作用同上*/
access-list 10 deny   7.7.7.7 /*作用同上*/
access-list 10 permit any

route-map cisco permit 10 /*作用同上*/
 match ip address 5
 set weight 5
!         
route-map cisco permit 20
!         
!         
mpls ldp router-id Loopback0

----------------------------------------------

R4:

!         
!         
ip vrf cisco
 rd 4:4   
 route-target export 100:100
 route-target import 101:101
!              
no ip domain lookup
ip cef    
no ipv6 cef
!  
mpls label range 400 499
mpls label protocol ldp
!      
interface Loopback0
 ip address 4.4.4.4 255.255.255.255
!         
interface Ethernet0/0
 ip address 34.1.1.4 255.255.255.0
 mpls ip  
!         
interface Ethernet0/1
 ip vrf forwarding cisco
 ip address 47.1.1.4 255.255.255.0
!         
router ospf 1
 network 4.4.4.4 0.0.0.0 area 0
 network 34.1.1.0 0.0.0.255 area 0
!         
router bgp 100
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 100
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 !        
 address-family v4
  neighbor 3.3.3.3 activate
  neighbor 3.3.3.3 send-community both
 exit-address-family
 !        
 address-family ipv4 vrf cisco
  redistribute connected
  neighbor 47.1.1.7 remote-as 200
  neighbor 47.1.1.7 activate
 exit-address-family  
!         
mpls ldp router-id Loopback0



------------------------------------------------------------------

R5:

!         
ip vrf cisco
 rd 5:5   
 route-target export 100:100
 route-target import 101:101
!         
no ip domain lookup
ip cef    
no ipv6 cef
!   
mpls label range 500 599
mpls label protocol ldp
!         
interface Loopback0
 ip address 5.5.5.5 255.255.255.255
!         
interface Ethernet0/0
 ip address 35.1.1.5 255.255.255.0
 mpls ip  
!         
interface Ethernet0/1
 ip vrf forwarding cisco
 ip address 58.1.1.5 255.255.255.0
!         
router ospf 1
 network 5.5.5.5 0.0.0.0 area 0
 network 35.1.1.0 0.0.0.255 area 0
!         
router bgp 100
 bgp log-neighbor-changes
 neighbor 3.3.3.3 remote-as 100
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 !        
 address-family v4
  neighbor 3.3.3.3 activate
  neighbor 3.3.3.3 send-community both
 exit-address-family
 !        
 address-family ipv4 vrf cisco
  redistribute connected
  neighbor 58.1.1.8 remote-as 400
  neighbor 58.1.1.8 activate
 exit-address-family
!         
mpls ldp router-id Loopback0



-------------------------------------------------------------


R7:

       
no ip domain lookup
ip cef    
no ipv6 cef
!         
interface Loopback0
 ip address 7.7.7.7 255.255.255.255
!         
interface Ethernet0/0
 ip address 47.1.1.7 255.255.255.0
!   
router bgp 200
 bgp log-neighbor-changes
 network 7.7.7.7 mask 255.255.255.255
 neighbor 47.1.1.4 remote-as 100

----------------------------------------------------------

R8:

      
no ip domain lookup
ip cef    
no ipv6 cef
!  
interface Loopback0
 ip address 8.8.8.8 255.255.255.255
!         
interface Ethernet0/0
 ip address 58.1.1.8 255.255.255.0
!         
router bgp 400
 bgp log-neighbor-changes
 network 8.8.8.8 mask 255.255.255.255
 neighbor 58.1.1.5 remote-as 100


--------------------------------------------------------


r3的v4路由表

MPLS hub and spoke 实验问题_第2张图片

MPLS hub and spoke 实验问题_第3张图片


r5的v4路由表

MPLS hub and spoke 实验问题_第4张图片


R8成功收到了另一个spoke端的路由

MPLS hub and spoke 实验问题_第5张图片

你可能感兴趣的:(Cisco,思科,总结)