mpls实验

例图:

需求:

1 使用mpls协议配置,路由器 3 4 5 建立bgp  3 4 5为pe 端,678为ce端

2 igp 协议为 ospf

3 ce端将私网路由传递到pe端协议分别为r6 静态  r7rip  r8ospf

4 全网可达

实验步骤:

1.配置IP地址

<r1>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 0
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              13.1.1.1/24          up         up        
GigabitEthernet0/0/1              14.1.1.1/24          up         up        
GigabitEthernet0/0/2              12.1.1.1/24          up         up        
GigabitEthernet4/0/0              15.1.1.1/24          up         up        
LoopBack0                         1.1.1.1/24           up         up(s)     
<r2>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 0
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              24.1.1.1/24          up         up        
GigabitEthernet0/0/1              23.1.1.1/24          up         up        
GigabitEthernet0/0/2              12.1.1.2/24          up         up        
GigabitEthernet4/0/0              25.1.1.1/24          up         up        
LoopBack0                         2.2.2.2/24           up         up(s)     
NULL0                             unassigned           up         up(s)   
<r3>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              36.1.1.1/24          up         up        
GigabitEthernet0/0/1              13.1.1.2/24          up         up        
GigabitEthernet0/0/2              23.1.1.2/24          up         up        
LoopBack0                         3.3.3.3/24           up         up(s)    
<r4>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              14.1.1.2/24          up         up        
GigabitEthernet0/0/1              47.1.1.1/24          up         up        
GigabitEthernet0/0/2              24.1.1.2/24          up         up        
LoopBack0                         4.4.4.4/24           up         up(s)     
<r5>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              25.1.1.2/24          up         up        
GigabitEthernet0/0/1              58.1.1.1/24          up         up        
GigabitEthernet0/0/2              15.1.1.2/24          up         up        
LoopBack0                         5.5.5.5/24           up         up(s)     
NULL0                             unassigned           up         up(s)     
<r6>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              36.1.1.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         6.6.6.6/24           up         up(s)     
<r8>dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 2
 
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              58.1.1.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         8.8.8.8/24           up         up(s)     
NULL0                             unassigned           up         up(s)     

2. 配置igp协议

[r3]ospf 100 router-id 93.3.3.3	
[r3-ospf-100]area 0
[r3-ospf-100-area-0.0.0.0]network 13.1.1.2 0.0.0.0	
[r3-ospf-100-area-0.0.0.0]network 3.3.3.3 0.0.0.0	
[r3-ospf-100-area-0.0.0.0]network 23.1.1.2 0.0.0.0
  
[r1]ospf 100 router-id 91.1.1.1
[r1-ospf-100]area 0
[r1-ospf-100-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r2]ospf 100 router-id 92.2.2.2
[r2-ospf-100]area 0
[r2-ospf-100-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r4-ospf-100]area 0	
[r4-ospf-100-area-0.0.0.0]network 14.1.1.2 0.0.0.0
[r4-ospf-100-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r4-ospf-100-area-0.0.0.0]network 24.1.1.2 0.0.0.0
[r5-ospf-100-area-0.0.0.0]network 5.5.5.5 0.0.0.0
[r5-ospf-100-area-0.0.0.0]network 15.1.1.2 0.0.0.0

3 .创建MPLS、 VPN

[r3]ip vpn-instance 1
[r3-vpn-instance-1]route-distinguisher 1:1		
[r3-vpn-instance-1-af-ipv4]vpn-target 1:1 export-extcommunity 
 EVT Assignment result: 
Info: VPN-Target assignment is successful.		
[r3-vpn-instance-1-af-ipv4]vpn-target 2:2 3:3 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful.
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]undo ip add 
[r3-GigabitEthernet0/0/0]ip binding vpn-instance 1
[r3-GigabitEthernet0/0/0]ip add 36.1.1.1 24
[r4]ip vpn-instance 2
[r4-vpn-instance-2]route-distinguisher 2:2
[r4-vpn-instance-2-af-ipv4]vpn-target 2:2 export-extcommunity 
 EVT Assignment result: 
Info: VPN-Target assignment is successful.
[r4-vpn-instance-2-af-ipv4]vpn-target 1:1 2:2 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful.
[r4-vpn-instance-2-af-ipv4]q
[r4-vpn-instance-2]q
[r4]int g 0/0/1
[r4-GigabitEthernet0/0/1]undo ip add
[r4-GigabitEthernet0/0/1]ip binding vpn-instance 2
[r4-GigabitEthernet0/0/1]ip add 47.1.1.1 24
[r5]ip vpn	
[r5]ip vpn-instance 3
[r5-vpn-instance-3]route-distinguisher 3:3	
[r5-vpn-instance-3-af-ipv4]vpn-target 1:1 2:2 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful.
[r5-vpn-instance-3-af-ipv4]vpn-target 3:3 export-extcommunity 
 EVT Assignment result: 
Info: VPN-Target assignment is successful.
[r5-vpn-instance-3-af-ipv4]q
[r5-vpn-instance-3]q
[r5]int g 0/0/1
[r5-GigabitEthernet0/0/1]undo ip add
[r5-GigabitEthernet0/0/1]ip binding vpn-instance 3
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[r5-GigabitEthernet0/0/1]ip add 58.1.1.1 24

4 在R3 R4 R5上建立BGP协议

[r3]bgp 1
[r3-bgp]route-select
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 4.4.4.4 as-number 1
[r3-bgp]peer 4.4.4.4 connect-interface l 0
[r3-bgp]peer 5.5.5.5 as-number 1	
[r3-bgp]peer 5.5.5.5 connect-interface l 0
[r3-bgp]ipv4-family vpnv4
[r3-bgp-af-vpnv4]peer 4.4.4.4 enable 
[r3-bgp-af-vpnv4]peer 4.4.4.4 next-hop-local
[r3-bgp-af-vpnv4]peer 5.5.5.5 enable 	
[r3-bgp-af-vpnv4]peer 5.5.5.5 next-hop-local
[r4]bgp 1
[r4-bgp]route-select
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 3.3.3.3 as-number 1
[r4-bgp]peer 3.3.3.3 connect-interface l 0
[r4-bgp]peer 5.5.5.5 as-number 1
[r4-bgp]peer 5.5.5.5 connect-interface l 0
[r4-bgp]ipv4-family vpnv4
[r4-bgp-af-vpnv4]peer 3.3.3.3 enable  
[r4-bgp-af-vpnv4]peer 3.3.3.3 next-hop-local
[r4-bgp-af-vpnv4]peer 5.5.5.5 enable 
[r4-bgp-af-vpnv4]peer 5.5.5.5 next-hop-local
[r5]bgp 1
[r5-bgp]route-select
[r5-bgp]router-id 5.5.5.5 
[r5-bgp]peer 3.3.3.3 as-number 1
[r5-bgp]peer 3.3.3.3 connect-interface l 0
[r5-bgp]peer 4.4.4.4 as-number 1
[r5-bgp]peer 4.4.4.4 connect-interface l 0
[r5-bgp]ipv4-family vpnv4
[r5-bgp-af-vpnv4]peer 3.3.3.3 enable    
[r5-bgp-af-vpnv4]peer 3.3.3.3 next-hop-local	
[r5-bgp-af-vpnv4]peer 4.4.4.4 enable 
[r5-bgp-af-vpnv4]peer 4.4.4.4 next-hop-local

5 . 起mpls协议

[r1]mpls lsr-id 1.1.1.1
Info: Mpls starting, please wait... OK!
[r1-mpls]mpls ldp
[r1-mpls-ldp]q
[r1]int g 0/0/1
[r1-GigabitEthernet0/0/1]mpls
[r1-GigabitEthernet0/0/1]mpls ldp
[r1-GigabitEthernet0/0/1]q
[r1]int g 4/0/0
[r1-GigabitEthernet4/0/0]mpls
[r1-GigabitEthernet4/0/0]mpls l	
[r1-GigabitEthernet4/0/0]mpls l2vc
[r1-GigabitEthernet4/0/0]mpls ld	
[r1-GigabitEthernet4/0/0]mpls ldp 
[r1-GigabitEthernet4/0/0]q
[r1]int g 0/0/2
[r1-GigabitEthernet0/0/2]mpls
[r1-GigabitEthernet0/0/2]mpls ldp
[r1-GigabitEthernet0/0/2]	
[r1-GigabitEthernet0/0/2]q
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]mpls
[r1-GigabitEthernet0/0/0]mpls ldp

R2R3R4R5配置和上面一样。

补命令

route recursive-lookup tunnel 

6 .进行重发布以及配置ce端私网协议

[r6]ip route-static 0.0.0.0 0 36.1.1.1
  
[r3]bgp 1
[r3-bgp]ipv4-family vpnv4	
[r3-bgp]ipv4-family vpn-instance 1		
[r3-bgp-1]import-route direct 	
[r3-bgp-1]import-route static 
[r7]rip 1
[r7-rip-1]verify-source
[r7-rip-1]version 2
[r7-rip-1]network 7.0.0.0
[r7-rip-1]network 47.0.0.0
  
[r4]rip 1 vpn-instance 
[r4]rip 1 vpn-instance 2
[r4-rip-1]verify-source
[r4-rip-1]version 2
[r4-rip-1]network 47.0.0.0
[r4-rip-1]import-route bgp
[r4]bgp 1	
[r4-bgp]ipv4-family vpn-instance 2	
[r4-bgp-2]import-route rip 1

全网可达

[r8]ping 6.6.6.6
  PING 6.6.6.6: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 6.6.6.6: bytes=56 Sequence=2 ttl=252 time=80 ms
    Reply from 6.6.6.6: bytes=56 Sequence=3 ttl=252 time=50 ms
    Reply from 6.6.6.6: bytes=56 Sequence=4 ttl=252 time=40 ms
    Reply from 6.6.6.6: bytes=56 Sequence=5 ttl=252 time=50 ms
 
  --- 6.6.6.6 ping statistics ---
    5 packet(s) transmitted
    4 packet(s) received
    20.00% packet loss
    round-trip min/avg/max = 40/55/80 ms

  • 11
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值