拓扑如下:pe和CE之间运行的ospf。
R1(PE)配置:
sys
sys R1
isis 1
net 49.0001.0000.0000.0001.00
#
mpls lsr 1.1.1.1
mpls
mpls ldp
ip vpn-instance vpna
route-distinguisher 100:1
vpn-target 100:1
#
int g 0/0/0
ip binding vpn-instance vpna
ip add 10.16.1.1 24
ospf enable 1 area 0.0.0.0
#
int g 0/0/2
ip add 10.12.1.1 24
isis en
mpls
mpls ldp
#
int lo0
ip add 1.1.1.1 32
isis en
#
bgp 100
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack0
ipv4-family vpnv4
policy vpn-target
peer 3.3.3.3 enable
#
ipv4-family vpn-instance vpna
import-route ospf 1
#
ospf 1 router-id 1.1.1.1 vpn-instance vpna
import-route bgp
area 0.0.0.0
#
return
R2配置:
sys
sys R2
#
mpls lsr 2.2.2.2
mpls
mpls ldp
#
isis 1
net 49.0001.0000.0000.0002.00
#
int g 0/0/0
ip add 10.12.1.2 24
isis en
mpls
mpls ldp
#
int g 0/0/1
ip add 10.23.1.2 24
isis en
mpls
mpls ldp
#
int lo0
ip add 2.2.2.2 32
isis en
#
return
#
R3(P)配置:
sys
sys R3
#
isis 1
net 49.0001.0000.0000.0003.00
#
mpls lsr 3.3.3.3
mpls
mpls ldp
#
ip vpn-instance vpna
route-d 300:1
vpn-t 100:1
#
int g 0/0/0
ip add 10.23.1.3 24
isis en
mpls
mpls ldp
#
int g 0/0/2
ip binding vpn vpna
ip add 10.37.1.3 24
ospf enable 1 area 0.0.0.0
#
int lo0
ip add 3.3.3.3 32
isis en
#
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack0
#
ipv4-family vpnv4
policy vpn-target
peer 1.1.1.1 enable
#
ipv4-family vpn-instance vpna
import-route ospf 1
#
ospf 1 router-id 3.3.3.3 vpn-instance vpna
import-route bgp
area 0.0.0.0
#
return
#
R6(CE)配置:
sys
sys R6
#
ospf 1 router-id 6.6.6.6
area 0.0.0.0
#
int g 0/0/0
ip add 10.16.1.6 24
ospf enable 1 area 0.0.0.0
#
int lo0
ip add 6.6.6.6 32
ospf enable 1 area 0.0.0.0
#
return
#
R7(CE)配置:
sys
sys R7
#
ospf 1 router-id 7.7.7.7
area 0.0.0.0
#
int g 0/0/0
ip add 10.37.1.7 24
ospf enable 1 area 0.0.0.0
#
int lo0
ip add 7.7.7.7 32
ospf enable 1 area 0.0.0.0
#
return
#
分析一下在R6上ping 7.7.7.7 数据过程。
1、CE设备ping 7.7.7.7 查询 fib表 dis fib 7.7.7.7
dis fib 7.7.7.7
发现tunnelID 为0x0
-
如果Tunnel ID值为0x0,则进入正常的IP转发流程。
-
如果Tunnel ID值不为0x0,则进入MPLS转发流程。
进行正常的ip转发流程封装数据包 发给吓一跳 10.16.1.1
2、R1收到数据包以后,
查询 dis fib
因为当前接口属于vpn实例接口 加上RD和RT属性然后根据
disp bgp vpnv4 all routing-table label
发出的时候需要打上内网1027的的内网标签。然后下吓一跳3.3.3.3