之前有人说思科的没接触过,现在发布一套华为的,便于理解
工程利用ensp作为搭建环境(华为)
R7,R12作为CE端
R8,R11作为PE端
R9,R10作为运营商P设备
CE:
interface Ethernet0/0/0
ip address 12.1.1.2 255.255.255.252
ospf timer hello 5
ospf ldp-sync
ospf enable 1 area 0.0.0.0
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
ospf enable 1 area 0.0.0.0
#
interface LoopBack1
ip address 172.16.1.1 255.255.255.255
ospf enable 1 area 0.0.0.0
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
PE:
ip vir pri net-instance vir pri net
ipv4-family
route-distinguisher 1:1
vir pri net-target 1:1 export-extcommunity
vir pri net-target 1:1 import-extcommunity
ipv6-family
route-distinguisher 1:1
mpls lsr-id 2.2.2.2
mpls
#
mpls ldp
#
isis 100
graceful-restart
is-level level-2
cost-style wide
flash-flood level-2
network-entity 86.0029.0000.0000.2222.00
is-name 2.2.2.2
set-overload on-startup wait-for-bgp
#
interface Ethernet0/0/0
ip binding vir pri net-instance vir pri net
ip address 12.1.1.1 255.255.255.252
ospf timer hello 5
ospf ldp-sync
ospf enable 1 area 0.0.0.0
#
interface Ethernet0/0/1
ip address 10.1.23.1 255.255.255.252
isis enable 100
isis circuit-level level-2
isis cost 100 level-2
isis timer hello 5 level-2
isis small-hello
isis ldp-sync
mpls
mpls ldp
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
isis enable 100
isis circuit-level level-2
#
interface LoopBack1
ip address 192.168.1.1 255.255.255.0
#
bgp 100
router-id 2.2.2.2
peer 5.5.5.5 as-number 100
peer 5.5.5.5 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
undo peer 5.5.5.5 enable
#
ipv4-family vir pri netv4
policy vir pri net-target
peer 5.5.5.5 enable
#
ipv4-family vir pri net-instance vir pri net
import-route ospf 1
#
ospf 1 router-id 2.2.2.2 vir pri net-instance vir pri net
default-route-advertise always
area 0.0.0.0
#
P:
mpls lsr-id 3.3.3.3
mpls
#
mpls ldp
#
isis 100
graceful-restart
is-level level-2
cost-style wide
flash-flood level-2
network-entity 86.0029.0000.0000.3333.00
is-name 3.3.3.3
set-overload on-startup wait-for-bgp
#
firewall zone Local
priority 16
#
interface Ethernet0/0/0
ip address 10.1.23.2 255.255.255.252
isis enable 100
isis circuit-level level-2
isis cost 100 level-2
isis timer hello 5 level-2
isis small-hello
isis ldp-sync
mpls
mpls ldp
#
interface Ethernet0/0/1
ip address 10.1.34.1 255.255.255.252
isis enable 100
isis circuit-level level-2
isis cost 100 level-2
isis timer hello 5 level-2
isis small-hello
isis ldp-sync
mpls
mpls ldp
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
isis enable 100
isis circuit-level level-2
#
P端作为整个工程的核心节点,同时在面向客户端CE启用vir pri net zone下的IGP协议,还要在面向运营商公网P及其他站点PE上运行IGP、MBGP、MPLS、LDP等协议。
PE上面普通v4路由表下路由,保证PE-P-PE间路由可达。
查看bgp vir pri netv4路由表,因为之前将ospf路由导入到bgp下面,此时R7上面两条路由import进入bgp vir pri netv4路由传递到对端PE设备vir pri net-instance路由表中。
客户端CE1 → 客户端CE2 可正常通过mplsvir pri net互相访问。
通过抓包看到数据包打了两层标签,因为存在次末跳POP的机制,在R10处收到R9的数据包后弹出标签直接寻址普通数据包访问目标地址。