一、题目
二、实验要求
1、R1与R5MPLS VPN
2、R6与R7MPLS VPN
3、R7可以访问R2/3/4的环回
三、实验拓扑图搭建
四、实验思路
1、按照拓扑图配置好ip地址
2、公网用ospf协议让全网可达,且公网的边界路由器没有私网路由
3、配置MPLS – LDP
4、2,4路由器运行bgp协议建好正常的邻居关系,然后与对端建立一个vpnv4的关系,用来传递vpnv4的路由
5、配置MPLS VPN
6、各个私有网段区域做到内网可通
7、使用双向重发布,实现路由共享
8、r7的环回能上公网,用一条缺省指向公网
五、实验步骤
ospf协议让公网可通
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 23.1.1.1 0.0.0.0
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 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 34.1.1.1 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 34.1.1.2 0.0.0.0
[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]network 47.1.1.1 0.0.0.0
配置MPLS – LDP
[r2]mpls lsr-id 2.2.2.2
[r2]mpls
[r2]mpls ldp
[r2-GigabitEthernet0/0/2]mpls
[r2-GigabitEthernet0/0/2]mpls ldp
2、4路由器运行bgp协议
[r2]bgp 1
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 4.4.4.4 as-number 1
[r2-bgp]peer 4.4.4.4 connect-interface lo 0
[r2-bgp]ipv4-family vpnv4
[r2-bgp-af-vpnv4]peer 4.4.4.4 enable
[r4]bgp 1
[r4-bgp]router-id 4.4.4.4
[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
配置MPLS VPN
[r2]ip vpn-instance a1
[r2-vpn-instance-a1]ipv4-family
[r2-vpn-instance-a1-af-ipv4]route-distinguisher 1:1
[r2-vpn-instance-a1-af-ipv4]vpn-target 1:1
[r2-GigabitEthernet0/0/0]ip binding vpn-instance a1
[r2-GigabitEthernet0/0/0]ip address 192.168.2.2 24
[r2]ip vpn-instance a2
[r2-vpn-instance-a2]ipv4-family
[r2-vpn-instance-a2-af-ipv4]route-distinguisher 2:2
[r2-vpn-instance-a2-af-ipv4]vpn-target 2:2
[r2-GigabitEthernet0/0/1]ip binding vpn-instance a2
[r2-GigabitEthernet0/0/1]ip address 192.168.2.2 24
各个私有网段区域做到内网可通
[r6]rip 1
[r6-rip-1]version 2
[r6-rip-1]network 192.168.1.0
[r6-rip-1]network 192.168.2.0
[r2]rip 1 vpn-instance a2
[r2-rip-1]version 2
[r2-rip-1]network 192.168.2.0
[r4]ospf 2 vpn-instance a2
[r4-ospf-2]area 0
[r4-ospf-2-area-0.0.0.0]network 192.168.3.1 0.0.0.0
[r4-ospf-2-area-0.0.0.0]network 192.168.3.1 0.0.0.0
[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.2 0.0.0.0
[r7-ospf-2-area-0.0.0.0]network 192.168.3.2 0.0.0.0
[r2]ip route-static vpn-instance a1 192.168.1.0 24 192.168.2.1
[r4]ip route-static vpn-instance a1 192.168.4.0 24 192.168.3.2
使用双向重发布,实现路由共享
[r2]bgp 1
[r2-bgp]ipv4 vpn-instance a1
[r2-bgp-a1]import-route static
[r2-bgp-a1]import-route direct
[r4]bgp 1
[r4-bgp]ipv4-family vpnv4
[r4-bgp]ipv4-family vpn-instance a1
[r4-bgp-a1]import-route static
[r4-bgp-a1]import-route direct
[r2]rip 1 vpn-instance a2
[r2-rip-1]import-route bgp
[r2]bgp 1
[r2-bgp]ipv4-family vpn-instance a2
[r2-bgp-a2]import-route rip 1
[r4]ospf 2 vpn-instance a2
[r4-ospf-2]import-route bgp
[r4]bgp 1
[r4-bgp]ipv4-family vpn-instance a2
[r4-bgp-a2]import-route ospf 2
[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
[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
给r7写条缺省,能上公网
[r7]ip route-static 0.0.0.0 0 47.1.1.1
六、测试