跨域Option A配置

拓扑图

在这里插入图片描述
首先介绍拓扑结构和网络需求:现在要实现CE1通过VPN访问CE2,分别有4个AS,分别是100,200,300,400,AS内部使用OSPF作为IGP协议,CE与PE之间使用BGP进行传递路由,设备接口地址设置为AB.1.1.X,现在要求使用OptionA方式进行实现。

大体步骤为:

  • CE与PE之间通过路由协议,将CE设备上的路由传递给PE设备;
  • PE与ASBR-PE设备之间建立VPNv4邻居,即打内层标签,VPNv4的内层标签;
  • 运营商内部要开启MPLS技术进行标签转发,即外层标签,通过MPLS技术进行分配的标签;
  • ASBR-PE之间通过建立VPN实例将对端作为CE设备进行处理;
  • 最终测试CE1与CE2的连通性即可。

将CE设备的路由传递到PE设备

CE1:
任务:与PE设备建立EBGP邻居关系并且宣告自身网段使得PE设备学习到

[CE1]bgp 100
配置自身AS号

[CE1-bgp]peer 12.1.1.2 as 200
与PE设备建立EBGP邻居关系

[CE1-bgp]network 1.1.1.1 32
宣告自身网段,使得PE设备学习到

PE1:
任务1:建立VPN实例,并设置相关参数。(因为已经虚拟成了逻辑上的多个路由器)

[PE1]ip vpn-instance aaa
这里建立了一个VPN实例,为什么要建立VPN实例呢?是因为之前已经说到,因为PE设备可能不只连接一台CE设备,会连接多台CE设备,但是这个时候CE设备之间的路由信息会重叠,那如何进行区分呢?就是将一台物理的设备虚拟成逻辑上的多台设备,每台虚拟的设备都各自维护一张路由表项。除此之外PE设备还有一张公用的表项,用于在公网进行传输。

[PE1-vpn-instance-aaa]route-distinguisher 1:1
在VPN实例里面,使用RD值进行区分来自不同CE设备的相同路由。

[PE1-vpn-instance-aaa]vpn-target 100:1 export-extcommunity
在VPN实例里面,使用RT值进行标记设备的“喜好”,也就是发送给对端的PE设备之后,对端是否接收,或者对端发送过来信息,本端是否接收。自身的export值要对应对端的import值,别人发来的信息中的export值要对应自身的import值,只有这样才能正确接收,并且放进自身的路由表中。

[PE1-vpn-instance-aaa]vpn-target 100:1 import-extcommunity
同理,这条配置设置自身的import属性。

任务2:在接口上绑定新建的VPN实例。
[PE1]int g0/0/0
进入与CE相连的物理接口。

[PE1-GigabitEthernet0/0/0]ip binding vpn-instance aaa
将接口绑定到VPN实例aaa中,因为一个接口就要维护一张单独的表项,要与全局的路由表区分开。

[PE1-GigabitEthernet0/0/0]ip address 12.1.1.2 24
绑定完之后,若原接口有IP地址,则会被清除,需要重新进行设置IP地址,此时按照规则设置接口地址即可。

任务3:在BGP的VPN实例进程下与CE设备建立邻居关系。
[PE1]bgp 200
进入自身的BGP进程

[PE1-bgp]ipv4-family vpn-instance aaa
因为现在是把物理路由器虚拟成多个逻辑上的路由器,每个逻辑路由器又单独维护一张表,所以不能在全局的状态下去建立BGP了,而是应该在自己本身,也就是自身的这个VPN实例(视图)中,去跟CE设备建立邻居关系。

[PE1-bgp-aaa]peer 12.1.1.1 as 100
在VPN视图中与CE设备建立EBGP邻居关系。

PE设备与ASBR-PE设备之间建立VPNv4邻居

PE1:
任务:与ASBR-PE建立VPNv4邻居

[PE1]bgp 200
进入BGP进程。

[PE1-bgp]peer 4.4.4.4 as 200
在IPv4视图下与ASBR-PE建立邻居。

[PE1-bgp]peer 4.4.4.4 connect-interface loopback 0
使用loopback接口建立邻居。

[PE1-bgp]ipv4-family vpnv4
使能VPN实例IPv4地址族,并进入VPN实例IPv4地址族视图。

[PE1-bgp-af-vpnv4]peer 4.4.4.4 enable
激活VPNv4视图下的邻居关系。

ASBR-PE1:
[ASBR-PE1]bgp 200
[ASBR-PE1-bgp]peer 2.2.2.2 as 200
[ASBR-PE1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[ASBR-PE1-bgp]ipv4-family vpnv4
[ASBR-PE1-bgp-af-vpnv4]peer 2.2.2.2 enable

PE设备与ASBR-PE设备之间MPLS的LSP

在MPLS域内建立一条完整的LSP,用于公网传输。

PE1:
任务:设置MPLS LSR-ID,接口使能MPLS并且启用LDP协议进行标签的分发

[PE1]mpls lsr-id 2.2.2.2
设置MPLS LSR-ID用于后续建立LSP,这个LSR-ID作为LDP邻居的建立地址,要求互相之间可以互通
[PE1]mpls
全局使能MPLS,否则无法启用MPLS LDP协议。

[PE1-mpls]mpls ldp
全局使能MPLS LDP协议。

[PE1-mpls-ldp]int g0/0/1
进入相应接口。

[PE1-GigabitEthernet0/0/1]mpls
接口下使能MPLS。

[PE1-GigabitEthernet0/0/1]mpls ldp
接口下使能MPLS LDP协议,自动进行标签的分发。

P1:
[P1]mpls lsr-id 3.3.3.3
[P1]mpls
[P1-mpls]mpls ldp
[P1-mpls-ldp]int g0/0/0
[P1-GigabitEthernet0/0/0]mpls
[P1-GigabitEthernet0/0/0]mpls ldp
[P1-GigabitEthernet0/0/0]int g0/0/1
[P1-GigabitEthernet0/0/1]mpls
[P1-GigabitEthernet0/0/1]mpls ldp

ASBR-PE1:
[ASBR-PE1]mpls lsr-id 4.4.4.4
[ASBR-PE1]mpls
[ASBR-PE1-mpls]mpls ldp
[ASBR-PE1-mpls-ldp]int g0/0/0
[ASBR-PE1-GigabitEthernet0/0/0]mpls
[ASBR-PE1-GigabitEthernet0/0/0]mpls ldp

ASBR-PE之间建立邻居关系

这里ASBR-PE设备把对端的所有设备统统看作一个小小的CE设备,然后使用之前与CE相同的方式方法进行建立邻居。
唯一一点需要注意的就是两台ASBR-PE设备都是在VPN实例的视图下与对方建立的EBGP邻居关系。

ASBR-PE1:
任务1:建立VPN实例:
[ASBR-PE1]ip vpn-instance bbb
[ASBR-PE1-vpn-instance-bbb]route-distinguisher 1:1
[ASBR-PE1-vpn-instance-bbb]vpn-target 100:1 export-extcommunity
[ASBR-PE1-vpn-instance-bbb]vpn-target 100:1 import-extcommunity

任务2:将VPN实例绑定到接口
[ASBR-PE1-vpn-instance-bbb]int g 0/0/1
[ASBR-PE1-GigabitEthernet0/0/1]ip binding vpn-instance bbb
[ASBR-PE1-GigabitEthernet0/0/1]ip address 45.1.1.4 24

任务3:在VPN实例的视图下与对端建立EBGP邻居关系
[ASBR-PE1]bgp 200
[ASBR-PE1-bgp]ipv4-family vpn-instance bbb
[ASBR-PE1-bgp-bbb]peer 45.1.1.5 as 300

ASBR-PE2:
任务1:建立VPN实例:
[Huawei]ip vpn-instance ccc
[Huawei-vpn-instance-ccc]route-distinguisher 2:2
[Huawei-vpn-instance-ccc]vpn-target 200:1 export-extcommunity
[Huawei-vpn-instance-ccc]vpn-target 200:1 import-extcommunity

任务2:将VPN实例绑定到接口
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip binding vpn-instance ccc
[Huawei-GigabitEthernet0/0/0]ip address 45.1.1.5 24

任务3:在VPN实例的视图下与对端建立EBGP邻居关系
[Huawei]bgp 300
[Huawei-bgp]ipv4-family vpn-instance ccc
[Huawei-bgp-ccc]peer 45.1.1.4 as 200

最终实验现象及验证

在CE2的路由表中学习到了CE1设备的1.1.1.1条目。
在这里插入图片描述
使用ping进行测试连通性,查看是否可以进行通信:
在这里插入图片描述
至此Option A正式完成。

无法通信

如果无法进行通信,则可以从以下几个方面进行排查:

  • MPLS的LSP是否建立成功,可以使用display mpls ldp peer或者display mpls lsp进行排查;
  • PE设备与ASBR-PE设备之间的VPNv4邻居是否建立,可以使用display bgp vpnv4 all peer进行排查;
  • ASBR-PE设备之间是否在VPN实例下建立了BGP的邻居关系;
  • CE是否将路由条目传递到PE设备上。
    如果以上问题都排除仍然无法通信,可以对比上述命令进行排查。

纯命令版

CE1:

interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0

interface LoopBack0
ip address 1.1.1.1 255.255.255.255

bgp 100
peer 12.1.1.2 as-number 200

ipv4-family unicast
undo synchronization
network 1.1.1.1 255.255.255.255
peer 12.1.1.2 enable

PE1:

ip vpn-instance aaa
ipv4-family
route-distinguisher 1:1
vpn-target 100:1 export-extcommunity
vpn-target 100:1 import-extcommunity

mpls lsr-id 2.2.2.2
mpls

mpls ldp

interface GigabitEthernet0/0/0
ip binding vpn-instance aaa
ip address 12.1.1.2 255.255.255.0

interface GigabitEthernet0/0/1
ip address 23.1.1.2 255.255.255.0
mpls
mpls ldp

interface LoopBack0
ip address 2.2.2.2 255.255.255.255

bgp 200
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0

ipv4-family unicast
undo synchronization
peer 4.4.4.4 enable

ipv4-family vpnv4
policy vpn-target
peer 4.4.4.4 enable

ipv4-family vpn-instance aaa
peer 12.1.1.1 as-number 100

ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 23.1.1.0 0.0.0.255

P1:

mpls lsr-id 3.3.3.3
mpls

mpls ldp

interface GigabitEthernet0/0/0
ip address 23.1.1.3 255.255.255.0
mpls
mpls ldp

interface GigabitEthernet0/0/1
ip address 34.1.1.3 255.255.255.0
mpls
mpls ldp

interface LoopBack0
ip address 3.3.3.3 255.255.255.255

ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 23.1.1.0 0.0.0.255
network 34.1.1.0 0.0.0.255

ASBR-PE1

ip vpn-instance bbb
ipv4-family
route-distinguisher 1:1
vpn-target 100:1 export-extcommunity
vpn-target 100:1 import-extcommunity

mpls lsr-id 4.4.4.4
mpls

mpls ldp

interface GigabitEthernet0/0/0
ip address 34.1.1.4 255.255.255.0
mpls
mpls ldp

interface GigabitEthernet0/0/1
ip binding vpn-instance bbb
ip address 45.1.1.4 255.255.255.0

interface LoopBack0
ip address 4.4.4.4 255.255.255.255

bgp 200
peer 2.2.2.2 as-number 200
peer 2.2.2.2 connect-interface LoopBack0

ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable

ipv4-family vpnv4
policy vpn-target
peer 2.2.2.2 enable

ipv4-family vpn-instance bbb
peer 45.1.1.5 as-number 300

ospf 1
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 34.1.1.0 0.0.0.255

ASBR-PE2:

ip vpn-instance ccc
ipv4-family
route-distinguisher 2:2
vpn-target 200:1 export-extcommunity
vpn-target 200:1 import-extcommunity

mpls lsr-id 5.5.5.5
mpls

mpls ldp

interface GigabitEthernet0/0/0
ip binding vpn-instance ccc
ip address 45.1.1.5 255.255.255.0

interface GigabitEthernet0/0/1
ip address 56.1.1.5 255.255.255.0
mpls
mpls ldp

interface LoopBack0
ip address 5.5.5.5 255.255.255.255

bgp 300
peer 7.7.7.7 as-number 300
peer 7.7.7.7 connect-interface LoopBack0

ipv4-family unicast
undo synchronization
peer 7.7.7.7 enable

ipv4-family vpnv4
policy vpn-target
peer 7.7.7.7 enable

ipv4-family vpn-instance ccc
peer 45.1.1.4 as-number 200

ospf 1
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 56.1.1.0 0.0.0.255

P2:

mpls lsr-id 6.6.6.6
mpls

mpls ldp

interface GigabitEthernet0/0/0
ip address 56.1.1.6 255.255.255.0
mpls
mpls ldp

interface GigabitEthernet0/0/1
ip address 67.1.1.6 255.255.255.0
mpls
mpls ldp

interface GigabitEthernet0/0/2

interface LoopBack0
ip address 6.6.6.6 255.255.255.255

ospf 1
area 0.0.0.0
network 6.6.6.6 0.0.0.0
network 56.1.1.0 0.0.0.255
network 67.1.1.0 0.0.0.255

PE2:

ip vpn-instance ddd
ipv4-family
route-distinguisher 2:2
vpn-target 200:1 export-extcommunity
vpn-target 200:1 import-extcommunity

mpls lsr-id 7.7.7.7
mpls

mpls ldp

interface GigabitEthernet0/0/0
ip address 67.1.1.7 255.255.255.0
mpls
mpls ldp

interface GigabitEthernet0/0/1
ip binding vpn-instance ddd
ip address 78.1.1.7 255.255.255.0

interface LoopBack0
ip address 7.7.7.7 255.255.255.255

bgp 300
peer 5.5.5.5 as-number 300
peer 5.5.5.5 connect-interface LoopBack0

ipv4-family unicast
undo synchronization
peer 5.5.5.5 enable

ipv4-family vpnv4
policy vpn-target
peer 5.5.5.5 enable

ipv4-family vpn-instance ddd
peer 78.1.1.8 as-number 400

ospf 1
area 0.0.0.0
network 7.7.7.7 0.0.0.0
network 67.1.1.0 0.0.0.255

CE2:

interface GigabitEthernet0/0/0
ip address 78.1.1.8 255.255.255.0

interface LoopBack0
ip address 8.8.8.8 255.255.255.255
bgp 400
peer 78.1.1.7 as-number 300

ipv4-family unicast
undo synchronization
network 8.8.8.8 255.255.255.255
peer 78.1.1.7 enable

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小刘不忙!

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值