MPLS实验

实验要求
MPLS实验_第1张图片
1.R1和R5是客户A两个站点的CE设备,R6和R7是客户B两个站点的CE设备。设备MPLS骨干网络分别连接不同客户的不同站点。

2.R1和R5采用静态路由的方式相互传递私网路由;R6通过RIP将私网路由传递给PE设备,R7通过OSPF将私网路由传递给PE设备,两者相互传递私网路由。

3.R1与R2私网之间使用静态路由;R4与R5私网之间使用静态路由;R2与R6私网之间使用RIP;R4与R7私网之间使用OSPF。

4.R7单独拉一根网线保证可以访问公网,R7可以访问R2、R3、R4环回。

1.进行接口配置

R1
display ip interface br
*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 192.168.1.2/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 1.1.1.1/24 up up(s)
NULL0 unassigned up up(s)

R2
display ip interface br
*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 192.168.1.1/24 up up
GigabitEthernet0/0/1 192.168.2.1/24 up up
GigabitEthernet0/0/2 13.0.0.1/24 up up
LoopBack0 2.2.2.2/24 up up(s)
NULL0 unassigned up up(s)

R3
dis ip int br
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 13.0.0.2/24 up up
GigabitEthernet0/0/1 14.0.0.1/24 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 3.3.3.3/24 up up(s)
NULL0 unassigned up up(s)
R4
dis ip int br
*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 14.0.0.2/24 up up
GigabitEthernet0/0/1 192.168.3.1/24 up up
GigabitEthernet0/0/2 192.168.4.1/24 up up
GigabitEthernet4/0/0 17.0.0.1/24 up up
LoopBack0 4.4.4.4/24 up up(s)
NULL0 unassigned up up(s)

R5
dis ip int br
*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 192.168.3.2/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 5.5.5.5/24 up up(s)
NULL0 unassigned up up(s)

R6
dis ip int br
*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 192.168.2.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)
NULL0 unassigned up up(s)

R7
dis ip int br
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.4.2/24 up up
GigabitEthernet0/0/1 17.0.0.2/24 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 7.7.7.7/24 up up(s)
NULL0 unassigned up up(s)

MPLS骨干OSPF配置

R2
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 13.0.0.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 2.2.2.0 0.0.0.255
R3
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 13.0.0.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 14.0.0.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255
R4
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 14.0.0.0 0.0.0.255

开启mpls使用ldp进行动态搭建

R2
[r2]mpls lsr-id 2.2.2.2
[r2]mpls
[r2-mpls]mpls ldp
[r2]int g0/0/2
[r2]int g0/0/2
[r2-GigabitEthernet0/0/2]mpls
[r2-GigabitEthernet0/0/2]mpls ldp
R3
[r3]mpls lsr-id 3.3.3.3
[r3]mpls
Info: Mpls starting, please wait… OK!
[r3]mpls ldp
[r3]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
R4
[r4]mpls lsr-id 4.4.4.4
[r4]mpls
Info: Mpls starting, please wait… OK!
[r4]mpls ldp
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]mpls
[r4-GigabitEthernet0/0/0]mpls ldp

配置VRF空间

配置VRF-a

R2
[r2]ip -instance a
[r2--instance-a]route-distinguisher 100:10
[r2--instance-a-af-ipv4]-target 100:1 export-extcommunity
EVT Assignment result:
Info: VPN-Target assignment is successful.
[r2--instance-a-af-ipv4]-target 100:2 import-extcommunity
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip binding -instance a
[r2-GigabitEthernet0/0/0]ip add 192.168.1.1 24
R4
[r4]ip -instance a
[r4--instance-a]route-distinguisher 100:10
Jul 28 2022 12:10:37-08:00 r4 %%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 3.3.3.3.
[r4--instance-a]route-distinguisher 100:10
[r4--instance-a-af-ipv4]-target 100:1 export-extcommunity
EVT Assignment result:
Info: VPN-Target assignment is successful.
[r4--instance-a-af-ipv4]-target 100:2 import-extcommunity
IVT Assignment result:
Info: VPN-Target assignment is successful.
[r4]int g0/0/1
[r4-GigabitEthernet0/0/1]ip binding -instance a
[r4-GigabitEthernet0/0/1]ip add 192.168.3.1 24

配置VRF-b

R2
[r2]ip -instance b
[r2--instance-b]route-distinguisher 100:11
[r2--instance-b-af-ipv4]-target 100:3 both
IVT Assignment result:
Info: VPN-Target assignment is successful.
EVT Assignment result:
Info: VPN-Target assignment is successful.
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip binding -instance b
Jul 28 2022 12:16:03-08:00 r2 %%01IFNET/4/LINK_STATE(l)[9]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the DOWN state.
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
[r2-GigabitEthernet0/0/1]ip add 192.168.2.1 24
R4
[r4]ip -instance b
Jul 28 2022 12:17:23-08:00 r4 %%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 3.3.3.3.
[r4--instance-b]route-distinguisher 100:11
[r4--instance-b-af-ipv4]-target 100:3 both
IVT Assignment result:
Info: VPN-Target assignment is successful.
EVT Assignment result:
Info: VPN-Target assignment is successful.
[r4]int g0/0/2
Jul 28 2022 12:18:08-08:00 r4 %%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 3.3.3.3.
[r4-GigabitEthernet0/0/2]ip binding -instance b
Info: All IPv4 related configurations on this interface are removed!
Info: All IPv6 related configurations on this interface are removed!
Jul 28 2022 12:18:19-08:00 r4 %%01IFNET/4/LINK_STATE(l)[13]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the DOWN state.
[r4-GigabitEthernet0/0/2]ip add 192.168.4.1 24

编写路由

R1
[r1]ip route-static 192.168.2.0 24 192.168.1.1
[r1]ip route-static 192.168.3.0 24 192.168.1.1
[r1]ip route-static 192.168.4.0 24 192.168.1.1
[r1]ip route-static 2.2.2.0 24 192.168.1.1
[r1]ip route-static 5.5.5.0 24 192.168.1.1
[r1]ip route-static 7.7.7.0 24 192.168.1.1
R2
[r2]ip route-static -instance a 1.1.1.0 24 192.168.1.2
[r2]ip route-static -instance b 6.6.6.0 24 192.168.2.2
R4
[r4]ip route-static -instance a 5.5.5.0 24 192.168.3.2
[r4]ip route-static -instance b 7.7.7.0 24 192.168.4.2
R5
[r5]ip route-static 192.168.1.0 24 192.168.3.1
[r5]ip route-static 192.168.2.0 24 192.168.3.1
[r5]ip route-static 192.168.4.0 24 192.168.3.1

编写B区域的协议

R2与R6rip协议

[r2]rip 1 -instance b
[r2-rip-1]v 2
[r2-rip-1]network 192.168.1.0
[r2-rip-1]network 192.168.2.0

R4与R7OSPF协议

[r4]ospf 2 -instance b router-id 4.4.4.4
[r4-ospf-2]area 0
[r4-ospf-2-area-0.0.0.0]network 192.168.4.0 0.0.0.255

[r7]ospf 2 router-id 7.7.7.7
[r7-ospf-2]area 0
[r7-ospf-2-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r7-ospf-2-area-0.0.0.0]network 4.4.4.0 0.0.0.255

开启BGP

R2
[r2]bgp 1
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 4.4.4.4 as 1
[r2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r2-bgp]ipv4-family v4
[r2-bgp-af-v4]peer 4.4.4.4 enable
R4
[r4]bgp 1
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 2.2.2.2 as 1
[r4-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[r4-bgp]ipv4-family v4
[r4-bgp-af-v4]peer 2.2.2.2 enable

重发布

区域A

R4
[r4-bgp]ipv4-family v4
[r4-bgp]ipv4-family -instance a
[r4-bgp-a]import-route direct
[r4-bgp-a]import-route static
R2
[r2-bgp]ipv4-family v4
[r2-bgp]ipv4-family -instance a
[r2-bgp-a]import-route direct
[r2-bgp-a]import-route static

区域B

R2
[r2-bgp]ipv4-family v4
[r2-bgp]ipv4-family -instance b
[r2-bgp-b]import-route rip 1
[r2-rip-1]import-route bgp
R4
[r4-bgp]ipv4-family v4
[r4-bgp]ipv4-family -instance b
[r4-bgp-b]import-route ospf 2
[r4-ospf-2]import-route bgp

R7单独拉一根网线保证可以访问公网

[r7]ip route-static 0.0.0.0 24 17.0.0.1

你可能感兴趣的:(HCLP,网络)