HUB——Spoke组网

目标:

  1. 实现MPLS配置
  2. 实现MPLS LDP配置
  3. 实现MPLS VPN配置
  4. 实现采用不同的方式完成CE-PE间的路由交换
  5. 实现通过RT值控制CE间的路由学习

配置步骤

互联网段IP地址,loop back0接口配置。

PE1
interface GigabitEthernet0/0/0
 ip address 10.0.12.1 255.255.255.0
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255

PE2
interface GigabitEthernet0/0/0
 ip address 10.0.25.2 255.255.255.0 
interface GigabitEthernet0/0/1
 ip address 10.0.12.2 255.255.255.0 
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255 

PE3
interface GigabitEthernet0/0/0
 ip address 10.0.35.3 255.255.255.0
interface GigabitEthernet0/0/1
 ip address 10.0.34.3 255.255.255.0
interface LoopBack0
 ip address 3.3.3.3 255.255.255.255

PE4
interface GigabitEthernet0/0/0
 ip address 10.0.34.4 255.255.255.0
interface LoopBack0
 ip address 4.4.4.4 255.255.255.255

P5
interface GigabitEthernet0/0/0.1
 ip address 10.0.56.5 255.255.255.0 
interface GigabitEthernet0/0/0.2
 ip address 10.0.65.5 255.255.255.0 
interface GigabitEthernet0/0/1
 ip address 10.0.25.5 255.255.255.0 
interface GigabitEthernet0/0/2
 ip address 10.0.35.5 255.255.255.0 
interface LoopBack0
 ip address 5.5.5.5 255.255.255.255 

P6
interface GigabitEthernet0/0/0.1
 ip address 10.0.56.6 255.255.255.0 
interface GigabitEthernet0/0/0.2
 ip address 10.0.65.6 255.255.255.0 
interface LoopBack0
 ip address 6.6.6.6 255.255.255.255 

配置IS-IS,进程号为 1,区域为10,所有设备均为L2。

PE2
isis 1
 is-level level-2
 cost-style wide
 network-entity 10.0000.0000.0002.00

P5
isis 1
 is-level level-2
 cost-style wide
 network-entity 10.0000.0000.0005.00

PE3
isis 1
 is-level level-2
 cost-style wide
 network-entity 10.0000.0000.0003.00



接口开启ISIS,其余略
interface GigabitEthernet0/0/0 
 isis enable 1

注意此时要配置cost-style为wide,用于支持IS-IS扩展特性。

查看IS-IS邻居正常

进行下一步

 配置MPLS

 在所有设备上开启MPLS,配置MPLS LSR ID(使用Loopback0接口IP),在互联接口上开启MPLS和MPLS LDP。

以PE2示例
mpls lsr-id 2.2.2.2
mpls
mpls ldp

interface GigabitEthernet0/0/0
 mpls
 mpls ldp

在P5检查MPLS LDP会话状态。

 L3VPN配置

完成AS 100内的MP-BGP对等体配置,使用Loopback0接口地址作为Router ID以及建立BGP对等体的连接源地址,其中P5配置为RR,通过P5实现VPNv4路由的传递。

P5
bgp 100
 router-id 5.5.5.5
 peer 2.2.2.2 as-number 100 
 peer 2.2.2.2 connect-interface LoopBack0
 peer 3.3.3.3 as-number 100 
 peer 3.3.3.3 connect-interface LoopBack0
ipv4-family vpnv4
  undo policy vpn-target
  peer 2.2.2.2 enable
  peer 2.2.2.2 reflect-client
  peer 3.3.3.3 enable
  peer 3.3.3.3 reflect-client


PE2
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 vpnv4
 policy vpn-target
 peer 5.5.5.5 enable


PE3
bgp 100
 router-id 3.3.3.3
 peer 5.5.5.5 as-number 100 
 peer 5.5.5.5 connect-interface LoopBack0
ipv4-family vpnv4
 policy vpn-target
 peer 5.5.5.5 enable

以上表示邻居建立成功

 完成CE-PE间配置

从此步骤开始,我们将会配置CE-PE之间的路由协议,

我们需要在P5、P6之间划分两个VPN实例,分别用于接收、发送路由,因此除了物理接口之外,还需要创建一个子接口。

配置子接口

P5
interface GigabitEthernet0/0/0.1
 dot1q termination vid 10
 ip address 10.0.56.5 255.255.255.0 
 arp broadcast enable

interface GigabitEthernet0/0/0.2
 dot1q termination vid 20
 ip address 10.0.65.5 255.255.255.0 
 arp broadcast enable

P6
interface GigabitEthernet0/0/0.1
 dot1q termination vid 10
 ip address 10.0.56.6 255.255.255.0 
 arp broadcast enable

interface GigabitEthernet0/0/0.2
 dot1q termination vid 20
 ip address 10.0.65.6 255.255.255.0 
 arp broadcast enable

完成BGP配置,使用Loopback0接口作为Router ID,使用直连接口建立EBGP对等体关系

P5
bgp 100
 router-id 5.5.5.5
 peer 10.0.56.6 as-number 1 
 peer 10.0.65.6 as-number 1

P6
bgp 1
 router-id 6.6.6.6
 peer 10.0.56.5 as-number 100 
 peer 10.0.65.5 as-number 100

PE3
bgp 100
 router-id 3.3.3.3
 peer 10.0.34.4 as-number 1 


PE4
bgp 1
 router-id 4.4.4.4
 peer 10.0.34.3 as-number 100 

创建VPN实例:in、out、A,分别用于接受路由以及发送路由。

P5
ip vpn-instance in
 ipv4-family
  route-distinguisher 1:1
  vpn-target 10:26 10:36 import-extcommunity
ip vpn-instance out
 ipv4-family
  route-distinguisher 2:2
  vpn-target 10:253 export-extcommunity


PE2
ip vpn-instance A
 ipv4-family
  route-distinguisher 4:4
  apply-label per-instance 
  vpn-target 10:26 export-extcommunity
  vpn-target 10:253 import-extcommunity


PE3
ip vpn-instance A
 ipv4-family
  route-distinguisher 3:3
  vpn-target 10:36 export-extcommunity
  vpn-target 10:253 import-extcommunity

完成VPN-Instance的配置后,需要将对应接口划分到对应的VPN-Instance中

P5
interface GigabitEthernet0/0/0.1
 ip binding vpn-instance in
 ip address 10.0.56.5 255.255.255.0 

interface GigabitEthernet0/0/0.2
 ip binding vpn-instance out
 ip address 10.0.65.5 255.255.255.0 


PE3
interface GigabitEthernet0/0/1
 ip binding vpn-instance A
 ip address 10.0.34.3 255.255.255.0


PE2
interface GigabitEthernet0/0/1
 ip binding vpn-instance A
 ip address 10.0.12.2 255.255.255.0 

请注意重新配置接口的IP地址

完成EBGP配置

P5
ipv4-family vpn-instance in 
  peer 10.0.56.6 as-number 1 
  peer 10.0.56.6 substitute-as
 
 ipv4-family vpn-instance out 
  peer 10.0.65.6 as-number 1 
  peer 10.0.65.6 allow-as-loop 10


PE3
 ipv4-family vpn-instance A 
  peer 10.0.34.4 as-number 1 
  peer 10.0.34.4 substitute-as

in这个VPN实例中接收的BGP VPNv4路由在AS_Path属性中会携带AS 1,P6会因为防环机制丢弃路由,为此需要配置substitute-as参数,将AS替换。

in中学习到的分支路由,会经由AS 1的P6 ,再以BGP路由的形式传递到out实例中,但P5因存在自身AS,不会学习该路由,为此需配置allow-as-loop参数。

P6和PE4 宣告loop back网段

PE4
[PE4-bgp]network 4.4.4.4 255.255.255.255


P6
[P6-bgp]network 6.6.6.6 255.255.255.255

配置OSPF

PE2
ospf 1 router-id 2.2.2.2 vpn-instance A
 import-route bgp
 area 0.0.0.0 
  network 10.0.12.2 0.0.0.0

PE1
ospf 1 router-id 1.1.1.1 
 area 0.0.0.0 
  network 1.1.1.1 0.0.0.0 
  network 10.0.12.1 0.0.0.0 

通过IP前缀列表以及Route-Policy限制引入BGP的OSPF路由

PE2
ip ip-prefix 1 index 10 permit 1.1.1.1 32

route-policy O-B permit node 10 
 if-match ip-prefix 1 

bgp 100
  ipv4-family vpn-instance A 
  import-route ospf 1 route-policy O-B

分别查看分支与总部的CE、PE的BGP VPNv4路由以及对应的IGP协议、BGP协议路由表

 

 在In 和 out 中,都学习到了 1.1.1.1 和 4.4.4.4 的路由。

查看PE2、PE3的BGP VPNv4路由表

 

PE2已经学习到前往另外一个分支以及总部的业务路由,并且下一跳都为总部的PE。

PE4已经学习到前往另外一个分支以及总部的业务路由,并且下一跳都为总部的PE。

查看PE1、PE4的IGP协议路由表

 PE1的OSPF路由表正常学习到了前往总部以及分支的路由

PE4的BGP路由表中已经学习到了前往总部以及分支的路由 

 可以正常进行通信,注意源地址需要为本地的业务网段地址

 可以看到流量经由总部的P6进行了转发。

  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值