MPFS-vpn 实验

一、拓扑图

二、需求

1.合理划分IP地址,每个路由器配置环回接口

2.为R1-R5配置IGP协议为OSPF

3.在PE端(R3R4R5)创建虚拟空间,PE端创建VPN-instance (VRF),将接口划入VRF,同时需要重新配置接口IP地址

4.做MP-BGP,BGP的建邻,PE之间激活建立VPNV4-BGP能力

5.华为中,在ISP内部启用MPLS 技术

6.在CE端建立IGP协议,分别配置不同的协议

7.全网可达

三、配置步骤

1.IP地址划分

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        
GigabitEthernet4/0/1              unassigned           down       down      
GigabitEthernet4/0/2              unassigned           down       down      
GigabitEthernet4/0/3              unassigned           down       down  
LoopBack0                         1.1.1.1/32           up         up(s)    
NULL0                             unassigned           up         up(s)     
<r1>
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              23.1.1.1/24          up         up        
GigabitEthernet0/0/1              25.1.1.1/24          up         up        
GigabitEthernet0/0/2              12.1.1.2/24          up         up        
GigabitEthernet4/0/0              24.1.1.1/24          up         up        
GigabitEthernet4/0/1              unassigned           down       down      
GigabitEthernet4/0/2              unassigned           down       down      
GigabitEthernet4/0/3              unassigned           down       down 
LoopBack0                         2.2.2.2/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
<r2>
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/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
<r3>
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/32           up         up(s)      
NULL0                             unassigned           up         up(s)     
<r4>
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/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
<r5>
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/32           up         up(s)    
NULL0                             unassigned           up         up(s)     
<r6>
Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              47.1.1.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down   
LoopBack0                         7.7.7.7/32           up         up(s)   
NULL0                             unassigned           up         up(s)     
<r7>
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/32           up         up(s)     
NULL0                             unassigned           up         up(s)     
<r8>

2.为R1-R5配置IGP协议为OSPF

[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r2]ospf 1 router-id 2.2.2.2 
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]net	
[r3-ospf-1-area-0.0.0.0]network 13.1.1.2 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 14.1.1.2 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 24.1.1.2 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 15.1.1.2 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 25.1.1.2 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 5.5.5.5 0.0.0.0

3.在PE端(R3R4R5)创建虚拟空间,PE端创建VPN-instance (VRF),将接口划入VRF,同时需要重新配置接口IP地址

[r3]ip vpn-instance 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-vpn-instance-1-af-ipv4]q
[r3-vpn-instance-1]q


[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]undo ip address 
Aug 20 2024 15:22:54-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the DOWN state. 
[r3-GigabitEthernet0/0/0]ip binding vpn-instance 1
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!       
[r3-GigabitEthernet0/0/0]ip address 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 3:3 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful.
[r4-vpn-instance-2-af-ipv4]q
[r4-vpn-instance-2]q
[r4]in g 0/0/1
[r4-GigabitEthernet0/0/1]undo ip address 
Aug 20 2024 15:29:09-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the DOWN state. 
[r4-GigabitEthernet0/0/1]ip binding vpn-instance 2
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[r4-GigabitEthernet0/0/1]ip address 47.1.1.1 24
[r5]ip vpn-instance 3
[r5-vpn-instance-3]route-distinguisher 3:3
[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]vpn-target 1:1 2:2 import-extcommunity 
 IVT Assignment result: 
Info: VPN-Target assignment is successful.
[r5-vpn-instance-3-af-ipv4]q
[r5-vpn-instance-3]q

[r5]in g 0/0/1	
[r5-GigabitEthernet0/0/1]undo ip address 
Aug 20 2024 15:35:08-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the DOWN state. 
[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 address 58.1.1.1 24

4.做MP-BGP,BGP的建邻,PE之间激活建立VPNV4-BGP能力

[r3]bgp 1
[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 LoopBack 0
[r3-bgp]peer 5.5.5.5 as-number 1
[r3-bgp]peer 5.5.5.5 connect-interface LoopBack 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]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 LoopBack 0
[r4-bgp]peer 5.5.5.5 as-number 1
[r4-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[r4-bgp]
Aug 20 2024 15:59:14-08:00 r4 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
 peer 3.3.3.3 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, Sta
teChangeReason=Up)  	
[r4-bgp]ipv4-family vpnv4
[r4-bgp-af-vpnv4]peer 3.3.3.3 enable 
Aug 20 2024 16:00:09-08:00 r4 %%01BGP/3/STATE_CHG_UPDOWN(l)[1]:The status of the
 peer 3.3.3.3 changed from ESTABLISHED to IDLE. (InstanceName=Public, StateChang
eReason=CEASE/Other Configuration Change)  
[r4-bgp-af-vpnv4]peer 3.3.3.3 next-hop-local	
[r4-bgp-af-vpnv4]peer 5.5.5.5 enable 
Aug 20 2024 16:00:40-08:00 r4 %%01BGP/3/STATE_CHG_UPDOWN(l)[2]:The status of the
 peer 3.3.3.3 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, Sta
teChangeReason=Up)  
[r4-bgp-af-vpnv4]peer 5.5.5.5 next-hop-local
[r5]bgp 1
[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 LoopBack 0
[r5-bgp]peer 4.4.4.4 as-number 1
[r5-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r5-bgp]
Aug 20 2024 16:03:18-08:00 r5 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
 peer 3.3.3.3 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, Sta
teChangeReason=Up)  
[r5-bgp]
Aug 20 2024 16:03:37-08:00 r5 %%01BGP/3/STATE_CHG_UPDOWN(l)[1]:The status of the
 peer 4.4.4.4 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, Sta
teChangeReason=Up)  
[r5-bgp]ipv4-family vpnv4
[r5-bgp-af-vpnv4]peer 3.3.3.3 enable 
Aug 20 2024 16:04:09-08:00 r5 %%01BGP/3/STATE_CHG_UPDOWN(l)[2]:The status of the
 peer 3.3.3.3 changed from ESTABLISHED to IDLE. (InstanceName=Public, StateChang
eReason=CEASE/Other Configuration Change)  
[r5-bgp-af-vpnv4]peer 3.3.3.3 next-hop-local
[r5-bgp-af-vpnv4]peer 4.4.4.4 enable 
Aug 20 2024 16:04:29-08:00 r5 %%01BGP/3/STATE_CHG_UPDOWN(l)[3]:The status of the
 peer 4.4.4.4 changed from ESTABLISHED to IDLE. (InstanceName=Public, StateChang
eReason=CEASE/Other Configuration Change)  

Aug 20 2024 16:04:41-08:00 r5 %%01BGP/3/STATE_CHG_UPDOWN(l)[4]:The status of the
 peer 3.3.3.3 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, Sta
teChangeReason=Up)  
[r5-bgp-af-vpnv4]peer 4.4.4.4 next-hop-local

5.华为中,在ISP内部启用MPLS 技术

[r1]mpls lsr-id 1.1.1.1
[r1]mpls
Info: Mpls starting, please wait... OK!
[r1-mpls]
[r1-mpls]mpls ldp
[r1-mpls-ldp]
[r1-mpls-ldp]quit
[r1]
[r1]in g 0/0/0
[r1-GigabitEthernet0/0/0]mpls
[r1-GigabitEthernet0/0/0]
[r1-GigabitEthernet0/0/0]mpls ldp
[r1-GigabitEthernet0/0/0]
[r1-GigabitEthernet0/0/0]quit
[r1]in g 0/0/1
[r1-GigabitEthernet0/0/1]mpls
[r1-GigabitEthernet0/0/1]
[r1-GigabitEthernet0/0/1]mpls ldp
[r1-GigabitEthernet0/0/1]
[r1-GigabitEthernet0/0/1]quit
[r1]in g 0/0/2
[r1-GigabitEthernet0/0/2]mpls
[r1-GigabitEthernet0/0/2]
[r1-GigabitEthernet0/0/2]mpls ldp
[r1-GigabitEthernet0/0/2]
[r1-GigabitEthernet0/0/2]quit
[r1]in g 4/0/0
[r1-GigabitEthernet4/0/0]mpls
[r1-GigabitEthernet4/0/0]
[r1-GigabitEthernet4/0/0]mpls ldp
[r1-GigabitEthernet4/0/0]
[r1-GigabitEthernet4/0/0]quit

[r1]route recursive-lookup tunnel  

:华为设备默认不为BGP协议执行下一跳标签机制,cisco默认执行;

华为设备需要开启  route recursive-lookup tunnel   路由基于隧道进行递归查找 

R2-R5同上

6.在CE端建立IGP协议,分别配置不同的协议

R6端配置静态路由协议:

[r6]ip route-static 0.0.0.0 0 36.1.1.1

[r3]ip route-static vpn-instance 1 6.6.6.6 32 36.1.1.2

#将静态和直连重发布进BGP:

[r3]bgp 1
[r3-bgp]ipv4-family vpn-instance 1
[r3-bgp-1]import-route direct  
[r3-bgp-1]import-route static 

R7端配置RIP动态路由协议:

[r7]rip 1
[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 2
[r4-rip-1]version 2 
[r4-rip-1]network 47.0.0.0
#双向重发布:
[r4-rip-1]import-route bgp
[r4-rip-1]q
[r4]
[r4]bgp 1
[r4-bgp]ipv4-family vpn-instance 2
[r4-bgp-2]import-route rip 1

R8端配置OSPF动态路由协议: 

[r8]ospf 2 router-id 8.8.8.8
[r8-ospf-2]area 0
[r8-ospf-2-area-0.0.0.0]network 0.0.0.0 255.255.255.255

[r5]ospf 2 vpn-instance 3 router-id 5.5.5.5
[r5-ospf-2]area 0  
[r5-ospf-2-area-0.0.0.0]network 58.1.1.1 0.0.0.0
[r5-ospf-2-area-0.0.0.0]
[r5-ospf-2-area-0.0.0.0]q
[r5-ospf-2]import-route bgp
[r5-ospf-2]q
[r5]bgp 1
[r5-bgp]ipv4-family vpn-instance 3 
[r5-bgp-3]import-route ospf 2

7.全网可达测试:

[r8]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 12       Routes : 12       

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        6.6.6.6/32  O_ASE   150  1           D   58.1.1.1        GigabitEthernet
0/0/0
        7.7.7.7/32  O_ASE   150  1           D   58.1.1.1        GigabitEthernet
0/0/0
        8.8.8.8/32  Direct  0    0           D   127.0.0.1       LoopBack0
       36.1.1.0/24  O_ASE   150  1           D   58.1.1.1        GigabitEthernet
0/0/0
       47.1.1.0/24  O_ASE   150  1           D   58.1.1.1        GigabitEthernet
0/0/0
       58.1.1.0/24  Direct  0    0           D   58.1.1.2        GigabitEthernet
0/0/0
       58.1.1.2/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     58.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
[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=70 ms
    Reply from 6.6.6.6: bytes=56 Sequence=3 ttl=252 time=40 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=40 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/47/70 ms
[r8]ping 7.7.7.7
  PING 7.7.7.7: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 7.7.7.7: bytes=56 Sequence=2 ttl=252 time=40 ms
    Reply from 7.7.7.7: bytes=56 Sequence=3 ttl=252 time=30 ms
    Reply from 7.7.7.7: bytes=56 Sequence=4 ttl=252 time=60 ms
    Reply from 7.7.7.7: bytes=56 Sequence=5 ttl=252 time=30 ms

  --- 7.7.7.7 ping statistics ---
    5 packet(s) transmitted
    4 packet(s) received
    20.00% packet loss
    round-trip min/avg/max = 30/40/60 ms

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值