拓扑图
实验要求
- R1和R5是客户A两个站点的CE设备,R6和R7是客户B的两个站点的CE设备。通过MPLS VPN骨干网络分别连接不同客户的不同站点
- R1和R5采用静态路由的方式传递私网路由;R6通过RIP将私网路由传递给PE设备;R7通过ospf将私网路由传递给PE设备
- R7单独拉一根网线保证可以访问公网,R7可以访问R2/R3/R4环回
思路
R1~R7配置环回
1.1.1.1
2.2.2.2
3.3.3.3
4.4.4.4
5.5.5.5
6.6.6.6
7.7.7.7
先配置mpls 骨干IP地址,骨干ospf,激活mpls ,然后配置VRF空间
配置命令
R1
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip a 192.168.2.1 24
Nov 4 2022 11:19:19-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]int lo0
[r1-LoopBack0]ip a 192.168.1.1 24
[r1-LoopBack0]q
[r1]ip rou
[r1]ip route-
[r1]ip route-static 192.168.3.0 24 192.168.2.2
[r1]ip route-static 192.168.4.0 24 192.168.2.2
R2
老师我R2配置命令翻不上去,我把路由表放上来
R3
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r3
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip a 23.0.0.2 24
[r3-GigabitEthernet0/0/0]
Nov 4 2022 10:45:46-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip a 34.0.0.1 24
Nov 4 2022 10:46:12-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]int lo0
[r3-LoopBack0]ip a 3.3.3.3 24
[r3-LoopBack0]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<r3>
<r3>sys
Enter system view, return user view with Ctrl+Z.
[r3]ospf
[r3]ospf 1 rou
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]a 0
[r3-ospf-1-area-0.0.0.0]networ
[r3-ospf-1-area-0.0.0.0]network 23.0.0.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]net
[r3-ospf-1-area-0.0.0.0]network
Nov 4 2022 11:03:05-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[0]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.23, NeighborE
vent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[r3-ospf-1-area-0.0.0.0]network
Nov 4 2022 11:03:05-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[1]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.23, NeighborE
vent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way)
[r3-ospf-1-area-0.0.0.0]network
Nov 4 2022 11:03:05-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.23, NeighborE
vent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart)
[r3-ospf-1-area-0.0.0.0]network
Nov 4 2022 11:03:05-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.23, NeighborE
vent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exchan
ge)
[r3-ospf-1-area-0.0.0.0]network
Nov 4 2022 11:03:05-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.23, NeighborE
vent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loading)
[r3-ospf-1-area-0.0.0.0]network
Nov 4 2022 11:03:05-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.23, NeighborE
vent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
[r3-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]ne
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]
Nov 4 2022 11:05:13-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[6]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.34, NeighborE
vent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[r3-ospf-1-area-0.0.0.0]
Nov 4 2022 11:05:23-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[7]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.34, NeighborE
vent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=ExStart)
[r3-ospf-1-area-0.0.0.0]
Nov 4 2022 11:05:23-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[8]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.34, NeighborE
vent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exchan
ge)
[r3-ospf-1-area-0.0.0.0]
Nov 4 2022 11:05:23-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[9]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.34, NeighborE
vent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loading)
[r3-ospf-1-area-0.0.0.0]
Nov 4 2022 11:05:23-08:00 r3 %%01OSPF/4/NBR_CHANGE_E(l)[10]:Neighbor changes ev
ent: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.34, Neighbor
Event=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]q
[r3]mpls
Warning: Please configure mpls lsr-id first.
[r3]mpls
[r3]mpls l
[r3]mpls ls
[r3]mpls lsr-id 3.3.3.3
[r3]mpls
Info: Mpls starting, please wait... OK!
[r3-mpls]mpls ld
[r3-mpls]mpls ldp
[r3-mpls-ldp]int g0/0/0
[r3-GigabitEthernet0/0/0]mpls
[r3-GigabitEthernet0/0/0]mpls ldp
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]mpls
[r3-GigabitEthernet0/0/1]mpls ldp
[r3-GigabitEthernet0/0/1]
Nov 4 2022 11:09:38-08:00 r3 %%01LDP/4/SSNHOLDTMREXP(l)[11]:Sessions were delet
ed because the session hold timer expired and the notification of the expiry was
sent to the peer 2.2.2.2.
[r3-GigabitEthernet0/0/1]
Nov 4 2022 11:10:23-08:00 r3 %%01LDP/4/SSNHOLDTMREXP(l)[12]:Sessions were delet
ed because the session hold timer expired and the notification of the expiry was
sent to the peer 2.2.2.2.
[r3-GigabitEthernet0/0/1]
Nov 4 2022 11:11:09-08:00 r3 %%01LDP/4/SSNHOLDTMREXP(l)[13]:Sessions were delet
ed because the session hold timer expired and the notification of the expiry was
sent to the peer 2.2.2.2.
[r3-GigabitEthernet0/0/1]
Nov 4 2022 11:11:54-08:00 r3 %%01LDP/4/SSNHOLDTMREXP(l)[14]:Sessions were delet
ed because the session hold timer expired and the notification of the expiry was
sent to the peer 2.2.2.2.
[r3-GigabitEthernet0/0/1]
Nov 4 2022 11:12:39-08:00 r3 %%01LDP/4/SSNHOLDTMREXP(l)[15]:Sessions were delet
ed because the session hold timer expired and the notification of the expiry was
sent to the peer 2.2.2.2.
[r3-GigabitEthernet0/0/1]
Nov 4 2022 11:13:24-08:00 r3 %%01LDP/4/SSNHOLDTMREXP(l)[16]:Sessions were delet
ed because the session hold timer expired and the notification of the expiry was
sent to the peer 2.2.2.2.
[r3-GigabitEthernet0/0/1]
Nov 4 2022 11:14:09-08:00 r3 %%01LDP/4/SSNHOLDTMREXP(l)[17]:Sessions were delet
ed because the session hold timer expired and the notification of the expiry was
sent to the peer 2.2.2.2.
[r3-GigabitEthernet0/0/1]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<r3>
Nov 4 2022 11:44:13-08:00 r3 %%01LDP/4/SSNHOLDTMREXP(l)[0]:Sessions were delete
d because the session hold timer expired and the notification of the expiry was
sent to the peer 2.2.2.2.
<r3>
Nov 4 2022 11:44:58-08:00 r3 %%01LDP/4/SSNHOLDTMREXP(l)[1]:Sessions were delete
d because the session hold timer expired and the notification of the expiry was
sent to the peer 2.2.2.2.
<r3>
Nov 4 2022 11:45:44-08:00 r3 %%01LDP/4/SSNHOLDTMREXP(l)[2]:Sessions were delete
d because the session hold timer expired and the notification of the expiry was
sent to the peer 2.2.2.2.
R4
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r4
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip a 34.0.0.2 24
Nov 4 2022 10:54:20-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]int g4/0/0
[r4-GigabitEthernet4/0/0]ip a 47.0.0.2 24
Nov 4 2022 10:54:58-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[r4-GigabitEthernet4/0/0]int lo0
[r4-LoopBack0]ip a 4.4.4.4 24
[r4-LoopBack0]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]ospf 1 rou
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]a 0
[r4-ospf-1-area-0.0.0.0]netw
[r4-ospf-1-area-0.0.0.0]network 34.0.0.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]ne
[r4-ospf-1-area-0.0.0.0]network 47.0.0.0 0.0.0.
Nov 4 2022 11:05:23-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[0]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.34, NeighborE
vent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[r4-ospf-1-area-0.0.0.0]network 47.0.0.0 0.0.0.
Nov 4 2022 11:05:23-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[1]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.34, NeighborE
vent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way)
[r4-ospf-1-area-0.0.0.0]network 47.0.0.0 0.0.0.
Nov 4 2022 11:05:23-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.34, NeighborE
vent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart)
[r4-ospf-1-area-0.0.0.0]network 47.0.0.0 0.0.0.
Nov 4 2022 11:05:23-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.34, NeighborE
vent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exchan
ge)
[r4-ospf-1-area-0.0.0.0]network 47.0.0.0 0.0.0.
Nov 4 2022 11:05:23-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.34, NeighborE
vent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loading)
[r4-ospf-1-area-0.0.0.0]network 47.0.0.0 0.0.0.
Nov 4 2022 11:05:23-08:00 r4 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.34, NeighborE
vent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
[r4-ospf-1-area-0.0.0.0]network 47.0.0.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]net
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r4-ospf-1-area-0.0.0.0]
[r4-ospf-1-area-0.0.0.0]
[r4-ospf-1-area-0.0.0.0]q
[r4-ospf-1]q
[r4]mpls ls
[r4]mpls lsr-id 4.4.4.4
[r4]mpls
Info: Mpls starting, please wait... OK!
[r4-mpls]mpls ldp
[r4-mpls-ldp]int g0/0/0
[r4-GigabitEthernet0/0/0]mpls
[r4-GigabitEthernet0/0/0]mpls ldp
[r4-GigabitEthernet0/0/0]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<r4>
<r4>
<r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]ip vp
[r4]ip vpn-instance a
[r4-vpn-instance-a]rou
[r4-vpn-instance-a]route-distinguisher 100:100
[r4-vpn-instance-a-af-ipv4]vp
[r4-vpn-instance-a-af-ipv4]vpn-target 100:1 b
[r4-vpn-instance-a-af-ipv4]vpn-target 100:1 both
IVT Assignment result:
Info: VPN-Target assignment is successful.
EVT Assignment result:
Info: VPN-Target assignment is successful.
[r4-vpn-instance-a-af-ipv4]int g0/0/1
[r4-GigabitEthernet0/0/1]ip b
[r4-GigabitEthernet0/0/1]ip binding vp
[r4-GigabitEthernet0/0/1]ip binding vpn-instance a
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[r4-GigabitEthernet0/0/1]q
[r4]ip vp
[r4]ip vpn-instance b
[r4-vpn-instance-b]rou
[r4-vpn-instance-b]route-distinguisher 200:200
[r4-vpn-instance-b-af-ipv4]vp
[r4-vpn-instance-b-af-ipv4]vpn-target 200:1 bo
[r4-vpn-instance-b-af-ipv4]vpn-target 200:1 both
IVT Assignment result:
Info: VPN-Target assignment is successful.
EVT Assignment result:
Info: VPN-Target assignment is successful.
[r4-vpn-instance-b-af-ipv4]int g0/0/2
[r4-GigabitEthernet0/0/2]ip b
^
Error:Incomplete command found at '^' position.
[r4-GigabitEthernet0/0/2]
[r4-GigabitEthernet0/0/2]ip b
[r4-GigabitEthernet0/0/2]ip binding vp
[r4-GigabitEthernet0/0/2]ip binding vpn-instance b
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[r4-GigabitEthernet0/0/2]int g0/0/1
[r4-GigabitEthernet0/0/1]ip a 192.168.3.2 24
Nov 4 2022 11:18:09-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]int g0/0/2
[r4-GigabitEthernet0/0/2]ip a 172.16.3.2 24
Nov 4 2022 11:18:34-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r4-GigabitEthernet0/0/2]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<r4>
<r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]ip rou
[r4]ip route
[r4]ip route-static vpn
[r4]ip route-static vpn-instance a 192.168.4.0 24 192.168.3.1
[r4]ospf 2 vp
[r4]ospf 2 vpn-instance b ro
[r4]ospf 2 vpn-instance b router-id 4.4.4.4
[r4-ospf-2]a 0
[r4-ospf-2-area-0.0.0.0]ney
[r4-ospf-2-area-0.0.0.0]net
[r4-ospf-2-area-0.0.0.0]network 172.16.0.0 0.0.0.255
[r4-ospf-2-area-0.0.0.0]q
[r4-ospf-2]q
[r4]bgp 1
[r4-bgp]rou
[r4-bgp]route-select
[r4-bgp]router-id 4.4.4.4
[r4-bgp]pe
[r4-bgp]peer 2.2.2.2 as 1
[r4-bgp]pei
[r4-bgp]pe
[r4-bgp]peer 2.2.2.2 com
[r4-bgp]peer 2.2.2.2 con
[r4-bgp]peer 2.2.2.2 connect-interface l
[r4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r4-bgp]ip
[r4-bgp]ipv4-family v
[r4-bgp]ipv4-family vpnv4
[r4-bgp-af-vpnv4]pe
[r4-bgp-af-vpnv4]peer 2.2.2.2 en
[r4-bgp-af-vpnv4]peer 2.2.2.2 enable
[r4-bgp-af-vpnv4]q
[r4-bgp]ip
[r4-bgp]ipv4-family vp
[r4-bgp]ipv4-family vpnv4
[r4-bgp]ipv4-family vpn-instance a
[r4-bgp-a]im
[r4-bgp-a]import-route s
[r4-bgp-a]import-route static
[r4-bgp-a]import-route
[r4-bgp-a]import-route d
[r4-bgp-a]import-route direct
[r4-bgp-a]q
[r4-bgp]ip
[r4-bgp]ipv4-family vp
[r4-bgp]ipv4-family vpnv4
[r4-bgp]ipv4-family vpn-instance b
[r4-bgp-b]im
[r4-bgp-b]import-route os
[r4-bgp-b]import-route ospf 2
[r4-bgp-b]q
[r4-bgp]q
[r4]ospf 2
[r4-ospf-2]im
[r4-ospf-2]import-route bgp
[r4-ospf-2]
R5
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip a 172.16.2.1 24
Nov 4 2022 11:21:54-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r5-GigabitEthernet0/0/0]int lo0
[r5-LoopBack0]ip a 192.168.4.1 24
[r5-LoopBack0]
[r5-LoopBack0]
[r5-LoopBack0]q
[r5]ip rou
[r5]ip route
[r5]ip route-static 192.168.1.0 24 192.168.3.2
[r5]ip route-static 192.168.2
R6
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r6
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip a 172.16.2.1 24
Nov 4 2022 11:20:25-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r6-GigabitEthernet0/0/0]int lo0
[r6-LoopBack0]ip a 172.16.1.1 24
[r6-LoopBack0]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<r6>
<r6>sys
Enter system view, return user view with Ctrl+Z.
[r6]rip 1
[r6-rip-1]v2
^
Error: Unrecognized command found at '^' position.
[r6-rip-1]v
[r6-rip-1]net
[r6-rip-1]network 172.16.0.0
[r6-rip-1]
R7
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r7
[r7]int g0/0/1
[r7-GigabitEthernet0/0/1]ip a 47.0.0.1 24
Nov 4 2022 10:55:53-08:00 r7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r7-GigabitEthernet0/0/1]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<r7>
<r7>
<r7>int g0/0/0
^
Error: Unrecognized command found at '^' position.
<r7>sys
Enter system view, return user view with Ctrl+Z.
[r7]int g
[r7-GigabitEthernet0/0/0]ip a 172.168.3.1 24
Nov 4 2022 11:22:57-08:00 r7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r7-GigabitEthernet0/0/0]int lo0
[r7-LoopBack0]ip a 172.16.4.1 24
[r7-LoopBack0]
[r7-LoopBack0]
[r7-LoopBack0]q
[r7]ospf 1
[r7]ospf 1 r
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]a 0
[r7-ospf-1-area-0.0.0.0]net
[r7-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.0.255
[r7-ospf-1-area-0.0.0.0]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<r7>
<r7>sys
Enter system view, return user view with Ctrl+Z.
[r7]ip rou
[r7]ip route
[r7]ip route-static 0.0.0.0 47.0.0.2
^
Error:Incomplete command found at '^' position.
[r7]ip route-static 0.0.0.0 0
实验结果
R1
R2
R6
隧道b
r1pingr5
r7pingr2 r3 r4