一、实验拓扑图
首先是配置网段,如图:
这是配置好的地址,然后我们开始进行接下来的操作 。
二、配置
1、首先我们将R2、3、4路由之间的IGP关系建立成功。这里我用的是OSPF进行igp内部连通。
R2:
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 23.0.0.0 0.0.0.255
R3
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 23.0.0.0 0.0.0.255
network 34.0.0.0 0.0.0.255
R4:
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 34.0.0.0 0.0.0.255
network 47.0.0.0 0.0.0.255
这样,我们IGP 就ok了。
2、下来则是进行MPLS配置
[r2]mpls lsr-id 2.2.2.2 //定义mpls的ID
[r2]mpls 全局开启mpls
[r2-mpls]mpls ldp[r2-GigabitEthernet0/0/1]mpls 接口开启MPLS
[r2-GigabitEthernet0/0/1]mpls ldp
r4同上,不做过多赘述
3、MPlS建立成功之后我们将R2、R4这两个PE设备(服务提供商边界设备)做虚拟空间
R2:
ip vpn-instance a //a空间
ipv4-family
route-distinguisher 100:100 //设置RD值
vpn-target 100:1 export-extcommunity //RT值
vpn-target 100:1 import-extcommunity
#
ip vpn-instance b //b空间
ipv4-family
route-distinguisher 200:200
vpn-target 200:1 export-extcommunity
vpn-target 200:1 import-extcommunity
R4:
ip vpn-instance a
ipv4-family
route-distinguisher 100:100
vpn-target 100:1 export-extcommunity
vpn-target 100:1 import-extcommunity
#
ip vpn-instance b
ipv4-family
route-distinguisher 200:200
vpn-target 200:1 export-extcommunity
vpn-target 200:1 import-extcommunity
4、建立完空间后,看要求R1、R5需要配置静态路由方式
R1:ip route-static 192.168.3.0 255.255.255.0 192.168.2.2
ip route-static 192.168.4.0 255.255.255.0 192.168.2.2R2:ip route-static vpn-instance a 192.168.1.0 255.255.255.0 192.168.2.1
R4:ip route-static vpn-instance a 192.168.4.0 255.255.255.0 192.168.3.2
R5:ip route-static 192.168.1.0 255.255.255.0 192.168.3.1
ip route-static 192.168.2.0 255.255.255.0 192.168.3.1
这样,我们R1和R5就静态路由就建立好了,但是还不能通信因为R2、R5还未发布路由
R2:
ipv4-family vpn-instance a
import-route direct //导入直连
import-route static //导入静态路由
R4:
ipv4-family vpn-instance a
import-route direct
import-route static
这样R1、5就可以进行通信了,验证:
5、接下来我们 进行R6、R7的mpls vpn:
首先要求R6用rip方式,
R6:
rip 1
version 2
network 172.16.0.0
R2:
rip 1 vpn-instance b
version 2
network 172.16.0.0import-route bgp //导入bgp进程
同时r2的bgp也要导入rip进程:
ipv4-family vpn-instance b
import-route rip 1
R7要求用OSPF,
R7:
ospf 2 router-id 7.7.7.7
area 0.0.0.0
network 172.16.0.0 0.0.255.255
R4:
ospf 2 router-id 4.4.4.4 vpn-instance b
import-route bgp
area 0.0.0.0
network 172.16.0.0 0.0.255.255
同时进入bgp进程导入OSPF
R4:
ipv4-family vpn-instance b
import-route ospf 2
6、下来则是R7的可以访问R2、3、4环回
这里用的是下放缺省
ip route-static 0.0.0.0 0.0.0.0 47.0.0.1
OK,大功告成!!!!
希望对您有所帮助.