目录
一,实验题目
编辑
拓扑与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接口
四,测试
一,实验题目
实验要求:
1、R1与R5MPLS VPN
2、R6与R7MOLS VPN
3、R7可以访问R2/3/4的环回
拓扑与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 vpn-instance a
[r2-vpn-instance-a]route-distinguisher 1:1
[r2-vpn-instance-a-af-ipv4]vpn-target 1:1
[r2-vpn-instance-a-af-ipv4]int g0/0/0
[r2-GigabitEthernet0/0/0]ip binding vpn-instance a
[r2-GigabitEthernet0/0/0]ip add 192.168.2.2 24
[r2-GigabitEthernet0/0/0]q
[r2]ip vpn-instance b
[r2-vpn-instance-b]route-distinguisher 2:2
[r2-vpn-instance-b-af-ipv4]vpn-target 2:2
[r2-vpn-instance-b-af-ipv4]int g0/0/2
[r2-GigabitEthernet0/0/2]ip binding vpn-instance b
[r2-GigabitEthernet0/0/2]ip add 192.168.2.2 24
R4:
[r4]ip vpn-instance a
[r4-vpn-instance-a]route-distinguisher 1:1
[r4-vpn-instance-a-af-ipv4]vpn-target 1:1
[r4-vpn-instance-a-af-ipv4]int g0/0/1
[r4-GigabitEthernet0/0/1]ip binding vpn-instance a
[r4-GigabitEthernet0/0/1]ip add 192.168.3.2 24
[r4-GigabitEthernet0/0/1]q
[r4]ip vpn-instance b
[r4-vpn-instance-b]route-distinguisher 2:2
[r4-vpn-instance-b-af-ipv4]vpn-target 2:2
[r4-vpn-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 vpn-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 vpn-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 vpn-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 vpn-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 vpn-instance
[r2-bgp]ipv4-family vpnv4
[r2-bgp-af-vpnv4]peer 4.4.4.4 enable
[r2-bgp-af-vpnv4]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 vpnv4
[r4-bgp-af-vpnv4]peer 2.2.2.2 enable
3.8 双向重发布
R2:
[r2-bgp]ipv4-family vpn-instance a
[r2-bgp-a]import-route ospf 2
[r2-bgp]ipv4-family vpn-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 vpn-instance a
[r4-bgp]import-route ospf 2
[r4-bgp]ipv4-family vpn-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 vpn-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
四,测试
进行上网: