HCIP-mpls实验报告

本文详细描述了如何在路由器r1-r8上进行IP配置,包括环回地址设置,以及OSPF、BGP、MPLS协议的配置,涉及虚拟接口创建、路由区分器、目标社区、邻居连接、静态路由和路由重发布等技术。
摘要由CSDN通过智能技术生成

一、搭建拓扑图

 

二、进行配置

对r1-r8进行IP配置及环回

[r1]interface LoopBack 0    
[r1-LoopBack0]ip address 1.1.1.1 32    
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24 

[r2]interface LoopBack 0
[r2-LoopBack0]ip address 2.2.2.2 32    
[r2]interface g0/0/0    
[r2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[r2]interface g0/0/1
[r2-GigabitEthernet0/0/1]ip address 23.1.1.1 24        
[r2]interface g0/0/2
[r2-GigabitEthernet0/0/2]ip address 24.1.1.1 24    

[r3]interface LoopBack 0
[r3-LoopBack0]ip address 3.3.3.3 32
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip address 23.1.1.2 24
[r3]interface g0/0/1
[r3-GigabitEthernet0/0/1]ip address 36.1.1.1 24
[r3]interface g0/0/2
[r3-GigabitEthernet0/0/2]ip address 35.1.1.1 24 

[r4]interface LoopBack 0    
[r4-LoopBack0]ip address 4.4.4.4 32    
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ip address 24.1.1.2 24 
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]ip address 45.1.1.1 24
[r4]interface g0/0/2
[r4-GigabitEthernet0/0/2]ip address 46.1.1.1 24 

[r5]interface LoopBack 0    
[r5-LoopBack0]ip address 5.5.5.5 32    
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ip address 45.1.1.2 24    
[r5]interface g0/0/1
[r5-GigabitEthernet0/0/1]ip address 35.1.1.2 24     
[r5]interface g0/0/2
[r5-GigabitEthernet0/0/2]ip address 57.1.1.1 24 

[r6]interface LoopBack 0    
[r6-LoopBack0]ip address 6.6.6.6 32    
[r6]interface g0/0/0
[r6-GigabitEthernet0/0/0]ip address 36.1.1.2 24 
[r6]interface g0/0/1
[r6-GigabitEthernet0/0/1]ip address 46.1.1.2 24
[r6]interface g0/0/2
[r6-GigabitEthernet0/0/2]ip address 68.1.1.1 24     

[r7]interface LoopBack 0    
[r7-LoopBack0]ip address 7.7.7.7 32    
[r7]interface g0/0/0
[r7-GigabitEthernet0/0/0]ip address 57.1.1.2 24  

[r8]interface LoopBack 0    
[r8-LoopBack0]ip address 8.8.8.8 32    
[r8]interface g0/0/0
[r8-GigabitEthernet0/0/0]ip address 68.1.1.2 24 

OSPF

[r2]ospf 1 router-id 2.2.2.2     
[r2-ospf-1]area 0        
[r2-ospf-1-area-0.0.0.0]network 23.1.1.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 24.1.1.1 0.0.0.0    
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0 

[r3]ospf 1 router-id 3.3.3.3     
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r3-ospf-1-area-0.0.0.0]quit  

[r4]ospf 1 router-id 4.4.4.4     
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255 

[r5]ospf 1 router-id 5.5.5.5     
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 35.1.1.2 0.0.0.0    
[r5-ospf-1-area-0.0.0.0]network 45.1.1.2 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0 

[r6]ospf 1 router-id 6.6.6.6    
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 36.1.1.2 0.0.0.0
[r6-ospf-1-area-0.0.0.0]network 46.1.1.2 0.0.0.0    
[r6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0 

[r7]ospf 2 router-id 7.7.7.7    
[r7-ospf-2]area 0
[r7-ospf-2-area-0.0.0.0]network 0.0.0.0 255.255.255.255 

BGP建邻

[r2]bgp 100
[r2-bgp]router-id 2.2.2.2 
[r2-bgp]peer 5.5.5.5 as-number 100    
[r2-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[r2-bgp]peer 6.6.6.6 as-number 100
[r2-bgp]peer 6.6.6.6 connect-interface LoopBack 0

[r5]bgp 100
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 2.2.2.2 as-number 100    
[r5-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r5-bgp]peer 6.6.6.6 as-number 100
[r5-bgp]peer 6.6.6.6 connect-interface LoopBack 0

[r6]bgp 100    
[r6-bgp]router-id 6.6.6.6
[r6-bgp]peer 2.2.2.2 as-number 100    
[r6-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r6-bgp]peer 5.5.5.5 as-number 100    
[r6-bgp]peer 5.5.5.5 connect-interface  LoopBack 0 

mpls 

[r2]mpls lsr-id 2.2.2.2 
[r2-mpls]mpls ld    
[r2]interface g0/0/1
[r2-GigabitEthernet0/0/1]mpls 
[r2-GigabitEthernet0/0/1]mpls ldp  
[r2]interface g0/0/2
[r2-GigabitEthernet0/0/2]mpls     
[r2-GigabitEthernet0/0/2]mpls ldp 

[r3]mpls lsr-id 3.3.3.3
[r3-mpls]mpls ld
[r3]interface g0/0/0    
[r3-GigabitEthernet0/0/0]mpls ldp     
[r3]interface g0/0/1    
[r3-GigabitEthernet0/0/1]mpls ldp 
[r3]interface g0/0/2    
[r3-GigabitEthernet0/0/2]mpls ldp  

[r4]mpls lsr-id 4.4.4.4    
[r4-mpls]mpls ld    
[r4]interface g0/0/0     
[r4-GigabitEthernet0/0/0]mpls ldp 
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]mpls ldp 
[r4]interface g0/0/2        
[r4-GigabitEthernet0/0/2]mpls ldp      

[r5]mpls lsr-id 5.5.5.5    
[r5-mpls]mpls ld
[r5]interface g0/0/0    
[r5-GigabitEthernet0/0/0]mpls ldp 
[r5]interface g0/0/1
[r5-GigabitEthernet0/0/1]mpls ldp  

[r6]mpls lsr-id 6.6.6.6
[r6-mpls]mpls ld        
[r6]interface g0/0/0        
[r6-GigabitEthernet0/0/0]mpls ldp     
[r6]interface g0/0/1         
[r6-GigabitEthernet0/0/1]mpls ldp      

人为打开社团属性 

[r2-bgp]ipv4-family vpnv4    
[r2-bgp-af-vpnv4]peer 5.5.5.5 enable     
[r2-bgp-af-vpnv4]peer 6.6.6.6 enable     
[r2-bgp-af-vpnv4]peer 5.5.5.5 next-hop-local 
[r2-bgp-af-vpnv4]peer 6.6.6.6 next-hop-local 

[r5]bgp 100
[r5-bgp]ipv4-family vpnv4    
[r5-bgp-af-vpnv4]peer 2.2.2.2 enable     
[r5-bgp-af-vpnv4]peer 6.6.6.6 enable     
[r5-bgp-af-vpnv4]peer 2.2.2.2 next-hop-local     
[r5-bgp-af-vpnv4]peer 6.6.6.6 next-hop-local  

[r6]bgp 100    
[r6-bgp]ipv4-family vpnv4    
[r6-bgp-af-vpnv4]peer 2.2.2.2 enable 
[r6-bgp-af-vpnv4]peer 2.2.2.2 next-hop-local     
[r6-bgp-af-vpnv4]peer 5.5.5.5 enable     
[r6-bgp-af-vpnv4]peer 5.5.5.5 next-hop-local 

 创建虚拟接口并绑定

[r2]ip vpn-instance 1
[r2-vpn-instance-1]route-distinguisher 1:1
[r2-vpn-instance-1-af-ipv4]vpn-target 1:1 export-extcommunity     
[r2-vpn-instance-1-af-ipv4]vpn-target 2:2 3:3 import-extcommunity 

[r2]interface g0/0/0    
[r2-GigabitEthernet0/0/0]undo ip address     
[r2-GigabitEthernet0/0/0]ip binding vpn-instance 1
[r2-GigabitEthernet0/0/0]ip address 12.1.1.2 24    
[r2-GigabitEthernet0/0/0]quit 
[r2]ip route-static vpn-instance 1 1.1.1.1 32 12.1.1.1 

[r5]ip vpn-instance 2    
[r5-vpn-instance-2]route-distinguisher 2:2    
[r5-vpn-instance-2-af-ipv4]vpn-target 2:2 export-extcommunity     
[r5-vpn-instance-2-af-ipv4]vpn-target 1:1 3:3 import-extcommunity

[r5]interface g0/0/2    
[r5-GigabitEthernet0/0/2]undo ip address 
[r5-GigabitEthernet0/0/2]ip binding vpn-instance 2
[r5-GigabitEthernet0/0/2]ip address 57.1.1.1 24
[r5]ospf 2 vpn-instance 2    
[r5-ospf-2]area 0    
[r5-ospf-2-area-0.0.0.0]network 57.1.1.1 0.0.0.0      

[r6]ip vpn-instance 3    
[r6-vpn-instance-3]route-distinguisher 3:3    
[r6-vpn-instance-3-af-ipv4]vpn-target 3:3 export-extcommunity     
[r6-vpn-instance-3-af-ipv4]vpn-target 1:1 2:2 import-extcommunity

[r6]interface g0/0/2    
[r6-GigabitEthernet0/0/2]undo ip address 
[r6-GigabitEthernet0/0/2]ip binding vpn-instance 3
[r6-GigabitEthernet0/0/2]ip address 68.1.1.1 24
[r6-GigabitEthernet0/0/2]quit     
[r6]rip 1 vpn-instance 3    
[r6-rip-1]version 2    
[r6-rip-1]network 68.0.0.0    
[r6-rip-1]import-route bgp     
[r6-rip-1]quit   

在r1上写静态路由 

[r1]ip route-static 0.0.0.0 0 12.1.1.2 

rip

[r8]rip 1     
[r8-rip-1]version 2    
[r8-rip-1]network 8.0.0.0    
[r8-rip-1]network 68.0.0.0 

重发布

[r2]bgp 100
[r2-bgp]ipv4-family vpn-instance 1    
[r2-bgp-1]import-route static 

[r5]bgp 100
[r5-bgp]ipv4-family vpn-instance 2    
[r5-bgp-2]import-route ospf 2 

[r6]bgp 100
[r6-bgp]ipv4-family vpn-instance 3    
[r6-bgp-3]import-route rip 1    
[r6-bgp-3]quit  

任务完成!

  • 20
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值