多协议标签交换——ensp

一、搭建实验环境

多协议标签交换——ensp_第1张图片

二、配置

1.ip配置

使用路由协议使运营商设备互通,此处省略

2.mpls域

[r2]mpls lsr-id 2.2.2.2
[r2]mpls
[r2-mpls]lsp-trigger all 
[r2-mpls]mpls ldp
[r2]int g0/0/1
[r2-GigabitEthernet0/0/1]mpls 
[r2-GigabitEthernet0/0/1]mpls ldp

[r3]mpls lsr-id 3.3.3.3
[r3]mpls
[r3-mpls]lsp-trigger all 
[r3-mpls]mpls ldp
[r3-mpls-ldp]int g0/0/0mp 
[r3-GigabitEthernet0/0/0]mpls 
[r3-GigabitEthernet0/0/0]mpls ldp 
[r3]int g0/0/01
[r3-GigabitEthernet0/0/1]mpls
[r3-GigabitEthernet0/0/1]mpls ldp

[r4]mpls lsr-id 4.4.4.4
[r4]mpls
[r4-mpls]lsp-trigger all
[r4-mpls]mpls ldp
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]mpls
[r4-GigabitEthernet0/0/0]mpls ldp

3.配置mpls vp

r2

[r2]ip -instance ccna    //创建名为ccna的vrf空间
[r2--instance-a]ipv4-family    //进入IPV4的配置模式下
[r2--instance-a-af-ipv4]route-distinguisher 1:1   //RD值
[r2--instance-a-af-ipv4]-target 1:1   //RT值 必须对端的PE端一致
[r2]interface GigabitEthernet 0/0/0    //进入链接CE端的接口
[r2-GigabitEthernet0/0/0]ip binding -instance ccna  //关联到vrf空间
[r2-GigabitEthernet0/0/0]ip address 192.168.2.2 24   //配置私有ip地址
[r2]display  ip routing-table -instance ccna    //查看空间内的私有路由表
[r2]ping --instance  ccna  192.168.2.1   //正常测试将在公有路由表中查询记录

多协议标签交换——ensp_第2张图片

 

r4

[r4]ip -instance ccnp
[r4--instance-ccnp]ipv4-family
[r4--instance-ccnp-af-ipv4]route-distinguisher 1:1
[r4--instance-ccnp-af-ipv4]-target 1:1  //import-extcommunity  export-extcommunity
[r4--instance-ccnp-af-ipv4]int g0/0/1 
[r4-GigabitEthernet0/0/1]ip binding -instance ccnp
[r4-GigabitEthernet0/0/1]ip address 192.168.3.1 24

4.PE与PE间建立MP-BPG邻居关系

[r2]bgp 1
[r2-bgp]router-id 2.2.2.2
[r2-bgp]pe 4.4.4.4 as 1
[r2-bgp]pe 4.4.4.4 con lo0
[r2-bgp]pe 4.4.4.4 next-hop-local
[r2-bgp]ipv4-family v4
[r2-bgp-af-v4]peer 4.4.4.4 enable
[r2]route recursive-lookup tunnel
华为设备需要开启  route recursive-lookup tunnel   路由基于隧道进行递归查找   

[r4]bgp 1
[r4-bgp]router-id 4.4.4.4
[r4-bgp]pe 2.2.2.2 as 1
[r4-bgp]pe 2.2.2.2 con lo0
[r4-bgp]pe 2.2.2.2 next-hop-local
[r4-bgp]ipv4-family v4
[r4-bgp-af-v4]pe 2.2.2.2 enable
[r2]route recursive-lookup tunnel

[r2-bgp]display bgp v4 all peer  查看mp-bgp邻居关系

多协议标签交换——ensp_第3张图片

 5.CE端与PE端交互路由

<1>静态路由(r1,r2之间)

CE端

[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

PE端

[r2]ip route-static -instance ccna 192.168.1.0 24 192.168.2.1
[r2]bgp 1
[r2-bgp]ipv4-family -instance ccna   //将本地vrf空间内的静态和直连路由重发布到BGP协议传递到对端的PE
[r2-bgp-ccna]import-route static 
[r2-bgp-ccna]import-route direct

<2>动态路由ospf(r4,r5之间)

CE端

[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]a 0
[r5-ospf-1-area-0.0.0.0]network 192.168.4.1 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 192.168.3.2 0.0.0.0

PE端

[r4]ospf 2 -instance ccnp
[r4-ospf-2]a 0
[r4-ospf-2-area-0.0.0.0]net
[r4-ospf-2-area-0.0.0.0]network 192.168.3.1 0.0.0.0 
互相重发布
[r4]bgp 1
[r4-bgp]ipv4-family -instance ccnp
[r4-bgp-ccnp]import-route ospf 2

[r4]ospf 2 -instance ccnp 
[r4-ospf-2]import-route bgp 

 

你可能感兴趣的:(ensp)