HCIP实验之MPLS

目录

一,实验题目

​编辑

 拓扑与IP地址规划如图所示

二,实验思路

三,实验步骤

3.1 私网部分IP地址配置

3.2 LSP部分配置

3.3 启动OSPF协议

3.4 启动MPLS协议

3.5 启动MPLS VPN

3.6 实现公网私网互通

3.7 配置BGP

3.8 双向重发布

3.9 下发缺省路由

补充:

当公司A1可以通A2,B1可以通B2公司,则私网环境互通,可以配置LSP的R4与R7接口

四,测试


一,实验题目

HCIP实验之MPLS_第1张图片

实验要求:

1、R1与R5MPLS VPN

2、R6与R7MOLS VPN

3、R7可以访问R2/3/4的环回

HCIP实验之MPLS_第2张图片

 拓扑与IP地址规划如图所示

二,实验思路

1,合法IP地址分配(分配时注意LSP接口不可以在关联空间前配置)

2,配置OSPF协议、MPLS协议

3,MPLS VPN配置

4,BGP配置

三,实验步骤

3.1 私网部分IP地址配置

R1:
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.2.1 24
[r1-GigabitEthernet0/0/0]int lo0
[r1-LoopBack0]ip add 192.168.1.1 24
R5:
[r5]int g0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.3.1 24
[r5-GigabitEthernet0/0/0]int lo0
[r5-LoopBack0]ip add 192.168.4.1 24
R6:
[r6]int g0/0/0
[r6-GigabitEthernet0/0/0]ip add 192.168.2.1 24
[r6-GigabitEthernet0/0/0]int lo0
[r6-LoopBack0]ip add 192.168.1.2 24
R7:
[r7]int g0/0/0
[r7-GigabitEthernet0/0/0]ip add 192.168.3.1 24
[r7-GigabitEthernet0/0/0]int lo0
[r7-LoopBack0]ip add 192.168.4.2 24

3.2 LSP部分配置

R2:
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 23.1.1.2 24
[r2-GigabitEthernet0/0/1]int lo0
[r2-LoopBack0]ip add 2.2.2.2 24
[r2-LoopBack0]q
R3:
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]ip add 23.1.1.3 24
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip add 34.1.1.3 24
[r3-GigabitEthernet0/0/1]int lo0
[r3-LoopBack0]ip add 3.3.3.3 24
[r3-LoopBack0]q
R4:
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]ip add 34.1.1.4 24
[r4-GigabitEthernet0/0/0]int lo0
[r4-LoopBack0]ip add 4.4.4.4 24
[r4-LoopBack0]q

3.3 启动OSPF协议

R2:
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]a 0
[r2-ospf-1-area-0.0.0.0]network 23.1.1.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]a 0
[r3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 34.1.1.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]a 0
[r4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 4.4.4.0 0.0.0
[r4-ospf-1-area-0.0.0.0]network 4.4.4.0 0.0.0.255

3.4 启动MPLS协议

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

3.5 启动MPLS VPN

R2:
[r2]ip -instance a
[r2--instance-a]route-distinguisher 1:1
[r2--instance-a-af-ipv4]-target 1:1
[r2--instance-a-af-ipv4]int g0/0/0
[r2-GigabitEthernet0/0/0]ip binding -instance a
[r2-GigabitEthernet0/0/0]ip add 192.168.2.2 24
[r2-GigabitEthernet0/0/0]q
[r2]ip -instance b
[r2--instance-b]route-distinguisher 2:2
[r2--instance-b-af-ipv4]-target 2:2
[r2--instance-b-af-ipv4]int g0/0/2
[r2-GigabitEthernet0/0/2]ip binding -instance b
[r2-GigabitEthernet0/0/2]ip add 192.168.2.2 24
R4:
[r4]ip -instance a
[r4--instance-a]route-distinguisher 1:1
[r4--instance-a-af-ipv4]-target 1:1
[r4--instance-a-af-ipv4]int g0/0/1
[r4-GigabitEthernet0/0/1]ip binding -instance a
[r4-GigabitEthernet0/0/1]ip add 192.168.3.2 24
[r4-GigabitEthernet0/0/1]q
[r4]ip -instance b
[r4--instance-b]route-distinguisher 2:2
[r4--instance-b-af-ipv4]-target 2:2
[r4--instance-b-af-ipv4]int g0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.3.2 24

3.6 实现公网私网互通

R1:
[r1]ospf 2
[r1-ospf-2]a 0
[r1-ospf-2-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r1-ospf-2-area-0.0.0.0]network 192.168.2.0 0.0.0.255
R2:
[r2]ospf 2 -instance a
[r2-ospf-2]a 0
[r2-ospf-2-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r2]ospf 3 -instance b
[r2-ospf-3]a 0
[r2-ospf-3-area-0.0.0.0]network 192.168.2.0 0.0.0.255
R4:
[r4]ospf 2 -instance a
[r4-ospf-2]a 0
[r4-ospf-2-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r4]ospf 3 -instance b
[r4-ospf-3]a 0
[r4-ospf-3-area-0.0.0.0]network 192.168.3.0 0.0.0.255
R5:
[r5]ospf 2
[r5-ospf-2]a 0
[r5-ospf-2-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r5-ospf-2-area-0.0.0.0]network 192.168.4.0 0.0.0.255
R6:
[r6]ospf 3
[r6-ospf-3]a 0
[r6-ospf-3-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r6-ospf-3-area-0.0.0.0]network 192.168.2.0 0.0.0.255
R7:
[r7]ospf 3
[r7-ospf-3]a 0
[r7-ospf-3-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r7-ospf-3-area-0.0.0.0]network 192.168.4.0 0.0.0.255

3.7 配置BGP

R2:
[r2]bgp 1
[r2-bgp]peer 4.4.4.4 as-number 1
[r2-bgp]peer 4.4.4.4 connect-interface lo0  
[r2-bgp]ipv4-family -instance 
[r2-bgp]ipv4-family v4        
[r2-bgp-af-v4]peer 4.4.4.4 enable 
[r2-bgp-af-v4]q
R4:
[r4]bgp 1
[r4-bgp]peer 2.2.2.2 as-number 1
[r4-bgp]peer 2.2.2.2 connect-interface lo0
[r4-bgp]ipv4-family v4
[r4-bgp-af-v4]peer 2.2.2.2 enable 

3.8 双向重发布

R2:
[r2-bgp]ipv4-family -instance a
[r2-bgp-a]import-route ospf 2
[r2-bgp]ipv4-family -instance b
[r2-bgp-b]import-route ospf 3
[r2]ospf 2
[r2-ospf-2]import-route bgp 
[r2-ospf-2]ospf 3
[r2-ospf-3]import-route bgp
R4:
[r4-bgp]ipv4-family -instance a
[r4-bgp]import-route ospf 2
[r4-bgp]ipv4-family -instance b
[r4-bgp-b]q
[r4-bgp]import-route ospf 3
[r4-bgp]q
[r4]ospf 2
[r4-ospf-2]import-route bgp 
[r4-ospf-2]ospf 3
[r4-ospf-3]import-route bgp 
[r4-ospf-3]q

3.9 下发缺省路由

R3:
[r3]ip route-static 0.0.0.0 0 34.1.1.4
R4:
[r4]bgp 1 
[r4-bgp]net
[r4-bgp]network 100.1.1.0 24
[r4-bgp]ipv4-family -instance b
[r4-bgp-b]def
[r4-bgp-b]default-route i
[r4-bgp-b]default-route imported 
R6:
[r6]ip route-static 0.0.0.0 0 192.168.2.2
R7:
[r7]ospf 3
[r7-ospf-3]de`
[r7-ospf-3]de 
[r7-ospf-3]default-r
[r7-ospf-3]default-route-advertise a
[r7-ospf-3]default-route-advertise always 
[r7-ospf-3]q
[r7]ip rou
[r7]ip route-
[r7]ip route-static 0.0.0.0 0 100.1.1.1

补充:

当公司A1可以通A2,B1可以通B2公司,则私网环境互通,可以配置LSP的R4与R7接口
R4:
[r4]int g4/0/0 
[r4-GigabitEthernet4/0/0]ip add 100.1.1.1 24
R7:
[r7]int g0/0/1
[r7-GigabitEthernet0/0/1]ip add 100.1.1.2 24
[r7]int g0/0/1
[r7]acl 2000
[r7-acl-basic-2000]rule permit  source any 
[r7-acl-basic-2000]q
[r7]int g0/0/1
[r7-GigabitEthernet0/0/1]nat outbound 2000
[r7-GigabitEthernet0/0/1]q

四,测试

进行上网:

HCIP实验之MPLS_第3张图片

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