BGP MPLS 基本配置

R1

#
sysname R1
#
ip vpn-instance vpna
 ipv4-family
  route-distinguisher 300:1
  vpn-target 100:1 export-extcommunity
  vpn-target 100:1 import-extcommunity
#
ip vpn-instance vpnb
 ipv4-family
  route-distinguisher 300:2
  vpn-target 100:2 export-extcommunity
  vpn-target 100:2 import-extcommunity
#
mpls lsr-id 10.0.1.1
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 10.0.12.1 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip binding vpn-instance vpna
 ip address 10.0.14.1 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip binding vpn-instance vpnb
 ip address 10.0.15.1 255.255.255.0 
#
interface LoopBack0
 ip address 10.0.1.1 255.255.255.255 
#
bgp 100
 peer 10.0.3.3 as-number 100 
 peer 10.0.3.3 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 10.0.3.3 enable
  peer 10.0.3.3 next-hop-local 
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 10.0.3.3 enable
  peer 10.0.3.3 advertise-community
 #
 ipv4-family vpn-instance vpna 
  peer 10.0.14.4 as-number 10 
 #
 ipv4-family vpn-instance vpnb 
  import-route static
#
ospf 1 router-id 10.0.1.1 
 area 0.0.0.0 
  network 10.0.12.0 0.0.0.255 
  network 10.0.1.1 0.0.0.0 
#
ip route-static vpn-instance vpnb 10.0.5.5 255.255.255.255 10.0.15.5
#

R2


#
sysname R2
#
mpls lsr-id 10.0.2.2
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 10.0.12.2 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip address 10.0.23.2 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip address 10.0.2.2 255.255.255.255 
#
bgp 100
 #
 ipv4-family unicast
  undo synchronization
#
ospf 1 router-id 10.0.2.2 
 area 0.0.0.0 
  network 10.0.12.0 0.0.0.255 
  network 10.0.23.0 0.0.0.255 
  network 10.0.2.2 0.0.0.0 
#

R3


#
sysname R3
#
ip vpn-instance vpna
 ipv4-family
  route-distinguisher 300:1
  vpn-target 100:1 export-extcommunity
  vpn-target 100:1 import-extcommunity
#
ip vpn-instance vpnb
 ipv4-family
  route-distinguisher 300:2
  vpn-target 100:2 export-extcommunity
  vpn-target 100:2 import-extcommunity
#
mpls lsr-id 10.0.3.3
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip binding vpn-instance vpna
 ip address 10.0.36.3 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 10.0.23.3 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/2
 ip binding vpn-instance vpnb
 ip address 10.0.37.3 255.255.255.0 
#
interface GigabitEthernet0/0/3
#
interface LoopBack0
 ip address 10.0.3.3 255.255.255.255 
#
bgp 100
 peer 10.0.1.1 as-number 100 
 peer 10.0.1.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  peer 10.0.1.1 enable
  peer 10.0.1.1 next-hop-local 
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 10.0.1.1 enable
  peer 10.0.1.1 advertise-community
 #
 ipv4-family vpn-instance vpna 
  peer 10.0.36.6 as-number 20 
 #
 ipv4-family vpn-instance vpnb
  import-route ospf 2 route-policy 10
#
ospf 1 router-id 10.0.3.3 
 area 0.0.0.0 
  network 10.0.23.0 0.0.0.255 
  network 10.0.3.3 0.0.0.0 
#
ospf 2 vpn-instance vpnb
 import-route bgp
 area 0.0.0.0 
  network 10.0.37.0 0.0.0.255 
#
route-policy 10 permit node 10 
 if-match ip-prefix 1 
#
ip ip-prefix 1 index 10 deny 10.0.37.0 24
ip ip-prefix 1 index 20 permit 0.0.0.0 32
#

R4

#
sysname R4
#
interface GigabitEthernet0/0/0
 ip address 10.0.14.4 255.255.255.0 
#
interface LoopBack0
 ip address 10.0.4.4 255.255.255.255 
#
bgp 10
 peer 10.0.14.1 as-number 100 
 #
 ipv4-family unicast
  undo synchronization
  network 10.0.4.4 255.255.255.255 
  peer 10.0.14.1 enable
#

R5

#
sysname R5
#
interface GigabitEthernet0/0/0
 ip address 10.0.15.5 255.255.255.0 
#
interface LoopBack0
 ip address 10.0.5.5 255.255.255.255 
#
ip route-static 0.0.0.0 0.0.0.0 10.0.15.1
#

R6

#
sysname R6
#
interface GigabitEthernet0/0/0
 ip address 10.0.36.6 255.255.255.0 
#
interface LoopBack0
 ip address 10.0.6.6 255.255.255.255 
#
bgp 20
 peer 10.0.36.3 as-number 100 
 #
 ipv4-family unicast
  undo synchronization
  network 10.0.6.6 255.255.255.255 
  peer 10.0.36.3 enable
#

R7


#
sysname R7
#
interface GigabitEthernet0/0/0
 ip address 10.0.37.7 255.255.255.0 
#
interface LoopBack0
 ip address 10.0.7.7 255.255.255.255 
#
ospf 2 router-id 10.0.7.7 
 area 0.0.0.0 
  network 10.0.37.0 0.0.0.255 
  network 10.0.7.7 0.0.0.0 
#

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

*蜡笔小金刚*

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

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

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

打赏作者

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

抵扣说明:

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

余额充值