Cisco IOS MPLS PE-CE static routingの設定方法

スポンサーリンク

MPLS VPNについて、PE-CE間のルーティングとしてstatic routeを用いる方法についてまとめます。疎通可能にするためには、BGP VPNv4によってstatic routeを伝播させる必要があります。

概要

BGPが伝搬できるのはIPv4ルートだけではありません。BGPはVPNv4, multicast, IPv6などの様々なアドレス形式をサポートします。VPNv4はIPv4とlabelをセットにしたアドレス形式で、この情報を伝搬される事でMPLS VPNを実現される事ができます。

まず、このページでは一番基本となるstatic routeの伝搬のさせ方についてまとめます。

MPLS static routing

必須設定

以下のコマンドでroute targetを設定する事ができます。route targetはVPNを識別するIDで、rdと同じ形式で指定します。route-target exportで指定したIDをIPv4 prefixとセットにしてBPG neihgborに伝え、BGP neihgborから受け取ったルートはroute-target importで指定されたVRFにimportされます。

Router(config)# ip vrf <vrf_name>
Router(config-vrf)# rd <ASN:nn>
Router(config-vrf)# route-target export <ASN:nn>
Router(config-vrf)# route-target import <ASN:nn>

以下の要領で、BPG vpnv4のneighborを確立する事ができます。

Router(config)# router bgp <as>
Router(config-router)# neighbor <addr> remote-as <as>
Router(config-router)# neighbor <addr> update-source <interface> 
Router(config-router)# 
Router(config-router)# address-family vpnv4
Router(config-router-af)# neighbor <addr> activate

以下の要領で、伝搬させるprefixを定義します。BPG ipv4と同様に、network, redistributeなどのコマンドを使用する事ができます。

Router(config)# router bgp <as>
Router(config-router)# address-family ipv4 vrf <vrf_name>
Router(config-router-af)# network <addr> mask <mask>
Router(config-router-af)# redistribute connected
Router(config-router-af)# redistribute static

構成概要

以下の環境で動作確認を行います。

CE1 Loopback0                                          CE4 Loopback1(VPN_A)
172.16.1.1/24                                          172.16.5.5/24

         172.16.13.0/24                     172.16.45.0/24
   +------+e0/0
   |      |.1     VPN_A                     VPN_A      VPN_A
   | CE1  +----┐  e0/0                      e0/0      e0/0
   |      |    │  .3+------+e0/2  e0/2+------+.4      .5+------+
   +------+    └----+      |.3      .4|      +----------+      |
                     | PE3  +----------+ PE4  |          | CE5  |
   +------+    ┌----+      |          |      +----------+      |
   |      |    │  .3+------+          +------+.4      .5+------+
   | CE2  +----┘  e0/1                      e0/1      e0/1
   |      |.2     VPN_B                     VPN_B      VPN_B
   +------+e0/0
         192.168.23.0/24    200.0.34.0/24   192.168.45.0/24
      
CE2 Loopback0      PE3 Loopback0      PE4 Loopback0     CE4 Loopback2(VPN_B)
192.168.2.2/24     200.3.3.3/24       200.4.4.4/24      192.168.5.5/24
 [CE1]
interface Loopback0
 ip address 172.16.1.1 255.255.255.0
!
interface Ethernet0/0
 ip address 172.16.13.1 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 172.16.13.3

 [CE2]
interface Loopback0
 ip address 192.168.2.2 255.255.255.0
!
interface Ethernet0/0
 ip address 192.168.23.2 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.23.3

 [PE3]
ip vrf VPN_A
 rd 100:1
 route-target export 100:1
 route-target import 100:1
!
ip vrf VPN_B
 rd 100:2
 route-target export 100:2
 route-target import 100:2
!
interface Loopback0
 ip address 200.3.3.3 255.255.255.0
!
interface Ethernet0/0
 ip vrf forwarding VPN_A
 ip address 172.16.13.3 255.255.255.0
!
interface Ethernet0/1
 ip vrf forwarding VPN_B
 ip address 192.168.23.3 255.255.255.0
!
interface Ethernet0/2
 ip address 200.0.34.3 255.255.255.0
 mpls ip
!
router rip
 version 2
 network 200.0.34.0
 network 200.3.3.0
 no auto-summary
!
router bgp 100
 no synchronization
 neighbor 200.4.4.4 remote-as 100
 neighbor 200.4.4.4 update-source Loopback0
 no auto-summary
 !
 address-family vpnv4
  neighbor 200.4.4.4 activate
  neighbor 200.4.4.4 send-community extended
 exit-address-family
 !
 address-family ipv4 vrf VPN_A
  no synchronization
  network 172.16.1.0 mask 255.255.255.0
  network 172.16.13.0 mask 255.255.255.0
 exit-address-family
 !
 address-family ipv4 vrf VPN_B
  redistribute connected
  redistribute static
  no synchronization
 exit-address-family
!
ip route vrf VPN_A 172.16.1.0 255.255.255.0 172.16.13.1
ip route vrf VPN_B 192.168.2.0 255.255.255.0 192.168.23.2
!
mpls ldp router-id Loopback0 force


 [PE4]
ip vrf VPN_A
 rd 100:1
 route-target export 100:1
 route-target import 100:1
!
ip vrf VPN_B
 rd 100:2
 route-target export 100:2
 route-target import 100:2
!
interface Loopback0
 ip address 200.4.4.4 255.255.255.0
!
interface Ethernet0/0
 ip vrf forwarding VPN_A
 ip address 172.16.45.4 255.255.255.0
!
interface Ethernet0/1
 ip vrf forwarding VPN_B
 ip address 192.168.45.4 255.255.255.0
!
interface Ethernet0/2
 ip address 200.0.34.4 255.255.255.0
 mpls ip
router rip
 version 2
 network 200.0.34.0
 network 200.4.4.0
 no auto-summary
!
router bgp 100
 no synchronization
 neighbor 200.3.3.3 remote-as 100
 neighbor 200.3.3.3 update-source Loopback0
 no auto-summary
 !
 address-family vpnv4
  neighbor 200.3.3.3 activate
  neighbor 200.3.3.3 send-community extended
 exit-address-family
 !
 address-family ipv4 vrf VPN_A
  no synchronization
  network 172.16.5.0 mask 255.255.255.0
  network 172.16.45.0 mask 255.255.255.0
 exit-address-family
 address-family ipv4 vrf VPN_B
  redistribute connected
  redistribute static
  no synchronization
 exit-address-family
!
ip route vrf VPN_A 172.16.5.0 255.255.255.0 172.16.45.5
ip route vrf VPN_B 192.168.5.0 255.255.255.0 192.168.45.5
!
mpls ldp router-id Loopback0 force

 [CE5]
ip vrf VPN_A
 rd 100:1
!
ip vrf VPN_B
 rd 100:2
!
interface Loopback1
 ip vrf forwarding VPN_A
 ip address 172.16.5.5 255.255.255.0
!
interface Loopback2
 ip vrf forwarding VPN_B
 ip address 192.168.5.5 255.255.255.0
!
interface Ethernet0/0
 ip vrf forwarding VPN_A
 ip address 172.16.45.5 255.255.255.0
!
interface Ethernet0/1
 ip vrf forwarding VPN_B
 ip address 192.168.45.5 255.255.255.0
!
ip route vrf VPN_A 0.0.0.0 0.0.0.0 172.16.45.4
ip route vrf VPN_B 0.0.0.0 0.0.0.0 192.168.45.4

なお、設定全文はファイルです。

CE1
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname CE1
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 172.16.1.1 255.255.255.0
!
interface Ethernet0/0
 ip address 172.16.13.1 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
ip http server
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 172.16.13.3
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
CE2
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname CE2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 192.168.2.2 255.255.255.0
!
interface Ethernet0/0
 ip address 192.168.23.2 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
ip http server
ip forward-protocol nd
ip route 0.0.0.0 0.0.0.0 192.168.23.3
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
PE3
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname PE3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
ip vrf VPN_A
 rd 100:1
 route-target export 100:1
 route-target import 100:1
!
ip vrf VPN_B
 rd 100:2
 route-target export 100:2
 route-target import 100:2
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 200.3.3.3 255.255.255.0
!
interface Ethernet0/0
 ip vrf forwarding VPN_A
 ip address 172.16.13.3 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip vrf forwarding VPN_B
 ip address 192.168.23.3 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 ip address 200.0.34.3 255.255.255.0
 half-duplex
 mpls ip
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router rip
 version 2
 network 200.0.34.0
 network 200.3.3.0
 no auto-summary
!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 200.4.4.4 remote-as 100
 neighbor 200.4.4.4 update-source Loopback0
 no auto-summary
 !
 address-family vpnv4
  neighbor 200.4.4.4 activate
  neighbor 200.4.4.4 send-community extended
 exit-address-family
 !
 address-family ipv4 vrf VPN_B
  redistribute connected
  redistribute static
  no synchronization
 exit-address-family
 !
 address-family ipv4 vrf VPN_A
  no synchronization
  network 172.16.1.0 mask 255.255.255.0
  network 172.16.13.0 mask 255.255.255.0
 exit-address-family
!
ip http server
ip forward-protocol nd
ip route vrf VPN_A 172.16.1.0 255.255.255.0 172.16.13.1
ip route vrf VPN_B 192.168.2.0 255.255.255.0 192.168.23.2
!
!
!
!
!
mpls ldp router-id Loopback0 force
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
PE4
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname PE4
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
ip vrf VPN_A
 rd 100:1
 route-target export 100:1
 route-target import 100:1
!
ip vrf VPN_B
 rd 100:2
 route-target export 100:2
 route-target import 100:2
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
 ip address 200.4.4.4 255.255.255.0
!
interface Ethernet0/0
 ip vrf forwarding VPN_A
 ip address 172.16.45.4 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip vrf forwarding VPN_B
 ip address 192.168.45.4 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 ip address 200.0.34.4 255.255.255.0
 half-duplex
 mpls ip
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
router rip
 version 2
 network 200.0.34.0
 network 200.4.4.0
 no auto-summary
!
router bgp 100
 no synchronization
 bgp log-neighbor-changes
 neighbor 200.3.3.3 remote-as 100
 neighbor 200.3.3.3 update-source Loopback0
 no auto-summary
 !
 address-family vpnv4
  neighbor 200.3.3.3 activate
  neighbor 200.3.3.3 send-community extended
 exit-address-family
 !
 address-family ipv4 vrf VPN_B
  redistribute connected
  redistribute static
  no synchronization
 exit-address-family
 !
 address-family ipv4 vrf VPN_A
  no synchronization
  network 172.16.5.0 mask 255.255.255.0
  network 172.16.45.0 mask 255.255.255.0
 exit-address-family
!
ip http server
ip forward-protocol nd
ip route vrf VPN_A 172.16.5.0 255.255.255.0 172.16.45.5
ip route vrf VPN_B 192.168.5.0 255.255.255.0 192.168.45.5
!
!
!
!
!
mpls ldp router-id Loopback0 force
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end
CE5
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname CE5
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
ip vrf VPN_A
 rd 100:1
!
ip vrf VPN_B
 rd 100:2
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback1
 ip vrf forwarding VPN_A
 ip address 172.16.5.5 255.255.255.0
!
interface Loopback2
 ip vrf forwarding VPN_B
 ip address 192.168.5.5 255.255.255.0
!
interface Ethernet0/0
 ip vrf forwarding VPN_A
 ip address 172.16.45.5 255.255.255.0
 half-duplex
!
interface Ethernet0/1
 ip vrf forwarding VPN_B
 ip address 192.168.45.5 255.255.255.0
 half-duplex
!
interface Ethernet0/2
 no ip address
 shutdown
 half-duplex
!
interface Ethernet0/3
 no ip address
 shutdown
 half-duplex
!
!
ip http server
ip forward-protocol nd
ip route vrf VPN_A 0.0.0.0 0.0.0.0 172.16.45.4
ip route vrf VPN_B 0.0.0.0 0.0.0.0 192.168.45.4
!
!
!
!
!
!
control-plane
!
!
!
!
mgcp behavior g729-variants static-pt
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
 login
!
!
end

設定説明

互いに疎通可能になるようにstatic routeを定義します。

 [CE1]
ip route 0.0.0.0 0.0.0.0 172.16.13.3

 [CE2]
ip route 0.0.0.0 0.0.0.0 192.168.23.3

 [PE3]
ip route vrf VPN_A 172.16.1.0 255.255.255.0 172.16.13.1
ip route vrf VPN_B 192.168.2.0 255.255.255.0 192.168.23.2

 [PE4]
ip route vrf VPN_A 172.16.5.0 255.255.255.0 172.16.45.5
ip route vrf VPN_B 192.168.5.0 255.255.255.0 192.168.45.5

 [CE5]
ip route vrf VPN_A 0.0.0.0 0.0.0.0 172.16.45.4
ip route vrf VPN_B 0.0.0.0 0.0.0.0 192.168.45.4

MPLS VPNはlabelに基づくルーティングですので、PE間でlabelに基づくルーティングが可能なよう設定します。

 [PE3]
interface Ethernet0/2
 mpls ip
!
router rip
 version 2
 network 200.0.34.0
 network 200.3.3.0
 no auto-summary
!
mpls ldp router-id Loopback0 force

 [PE4]
interface Ethernet0/2
 mpls ip
!
router rip
 version 2
 network 200.0.34.0
 network 200.4.4.0
 no auto-summary
!
mpls ldp router-id Loopback0 force

BGP vpnv4によるneighborが確立できるように設定します。なお、BGP vpnv4によるneighborはLoopback interface間で確立しないとエラーメッセージが表示されます。

 [PE3]
router bgp 100
 no synchronization
 neighbor 200.4.4.4 remote-as 100
 neighbor 200.4.4.4 update-source Loopback0
 no auto-summary
 !
 address-family vpnv4
  neighbor 200.4.4.4 activate

 [PE4]
router bgp 100
 no synchronization
 neighbor 200.3.3.3 remote-as 100
 neighbor 200.3.3.3 update-source Loopback0
 no auto-summary
 !
 address-family vpnv4
  neighbor 200.3.3.3 activate

route-targetを定義します。

 [PE3]
ip vrf VPN_A
 rd 100:1
 route-target export 100:1
 route-target import 100:1
!
ip vrf VPN_B
 rd 100:2
 route-target export 100:2
 route-target import 100:2

 [PE4]
ip vrf VPN_A
 rd 100:1
 route-target export 100:1
 route-target import 100:1
!
ip vrf VPN_B
 rd 100:2
 route-target export 100:2
 route-target import 100:2

BGP neighborに伝搬させたいprefixを定義します。BGP ipv4の設定と同様に、network, redistributeコマンドなどが使用可能です。

 [PE3]
router bgp 100
 no synchronization
 neighbor 200.4.4.4 remote-as 100
 neighbor 200.4.4.4 update-source Loopback0
 no auto-summary
 !
 address-family ipv4 vrf VPN_A
  network 172.16.1.0 mask 255.255.255.0
  network 172.16.13.0 mask 255.255.255.0
 !
 address-family ipv4 vrf VPN_B
  redistribute connected
  redistribute static

 [PE4]
router bgp 100
 no synchronization
 neighbor 200.3.3.3 remote-as 100
 neighbor 200.3.3.3 update-source Loopback0
 no auto-summary
 !
 address-family ipv4 vrf VPN_A
  network 172.16.5.0 mask 255.255.255.0
  network 172.16.45.0 mask 255.255.255.0
 !
 address-family ipv4 vrf VPN_B
  redistribute connected
  redistribute static

動作確認

以下のコマンドでVRFのforwarding tableを確認する事ができます。例えば172.16.5.0/24ならば、17番のタグを付けて送信してもらうよう他のneighbor(この例の場合はPE3)にお願いします。

PE4#show mpls forwarding-table vrf VPN_A
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop
tag    tag or VC   or Tunnel Id      switched   interface
17     Untagged    172.16.5.0/24[V]  0          Et0/0      172.16.45.5
18     Aggregate   172.16.45.0/24[V] 0
PE4#

以下のコマンドでPE間で公開したlabel情報を確認できます。例えば172.16.5.0/24ならば、17番のタグを付けて200.4.4.4に送信されます。

PE3#show bgp vpnv4 unicast all labels
   Network          Next Hop      In label/Out label
Route Distinguisher: 100:1 (VPN_A)
   172.16.1.0/24    172.16.13.1     17/nolabel
   172.16.5.0/24    200.4.4.4       nolabel/17
   172.16.13.0/24   0.0.0.0         18/aggregate(VPN_A)
   172.16.45.0/24   200.4.4.4       nolabel/18
Route Distinguisher: 100:2 (VPN_B)
   192.168.2.0      192.168.23.2    19/nolabel
   192.168.5.0      200.4.4.4       nolabel/19
   192.168.23.0     0.0.0.0         20/aggregate(VPN_B)
   192.168.45.0     200.4.4.4       nolabel/20

PE3#

BGP vpnv4によって、どのような情報が交換されるかを観察します。パケットを観察すると、ipv4 prefix, Route Distinguisher, labelが交換されているのが分かります。

MPLS VPNはIPアドレスが重複していても問題なくルーティングできると言われているのは、このようにlabelに基づくルーティングがなされているからです。ipv4 prefix, Route Distinguisher毎に一意なlabelが付与されるので、仮にIPアドレスが重複していたとしてもlabelを見ればどのVRFに転送すべきかの判断ができます。

Ethernet II, Src: cc:03:17:00:00:02 (cc:03:17:00:00:02), Dst: cc:02:17:00:00:02 (cc:02:17:00:00:02)
Internet Protocol, Src: 200.4.4.4 (200.4.4.4), Dst: 200.3.3.3 (200.3.3.3)
Transmission Control Protocol, Src Port: 23273 (23273), Dst Port: bgp (179), Seq: 92, Ack: 92, Len: 210
Border Gateway Protocol
    UPDATE Message
        Marker: 16 bytes
        Length: 105 bytes
        Type: UPDATE Message (2)
        Unfeasible routes length: 0 bytes
        Total path attribute length: 82 bytes
        Path attributes
            ORIGIN: IGP (4 bytes)
            AS_PATH: empty (3 bytes)
            MULTI_EXIT_DISC: 0 (7 bytes)
            LOCAL_PREF: 100 (7 bytes)
            EXTENDED_COMMUNITIES: (11 bytes)
            MP_REACH_NLRI (50 bytes)
                Flags: 0x80 (Optional, Non-transitive, Complete)
                Type code: MP_REACH_NLRI (14)
                Length: 47 bytes
                Address family: IPv4 (1)
                Subsequent address family identifier: Labeled VPN Unicast (128)
                Next hop network address (12 bytes)
                Subnetwork points of attachment: 0
                Network layer reachability information (30 bytes)
                    Label Stack=18 (bottom) RD=100:1, IPv4=172.16.45.0/24
                        MP Reach NLRI Prefix length: 112
                        MP Reach NLRI Label Stack: 18 (bottom)
                        MP Reach NLRI Route Distinguisher: 100:1
                        MP Reach NLRI IPv4 prefix: 172.16.45.0 (172.16.45.0)
                    Label Stack=17 (bottom) RD=100:1, IPv4=172.16.5.0/24
                        MP Reach NLRI Prefix length: 112
                        MP Reach NLRI Label Stack: 17 (bottom)
                        MP Reach NLRI Route Distinguisher: 100:1
                        MP Reach NLRI IPv4 prefix: 172.16.5.0 (172.16.5.0)

Border Gateway Protocol
                
                <omitted>
                
                Network layer reachability information (30 bytes)
                    Label Stack=20 (bottom) RD=100:2, IPv4=192.168.45.0/24
                        MP Reach NLRI Prefix length: 112
                        MP Reach NLRI Label Stack: 20 (bottom)
                        MP Reach NLRI Route Distinguisher: 100:2
                        MP Reach NLRI IPv4 prefix: 192.168.45.0 (192.168.45.0)
                    Label Stack=19 (bottom) RD=100:2, IPv4=192.168.5.0/24
                        MP Reach NLRI Prefix length: 112
                        MP Reach NLRI Label Stack: 19 (bottom)
                        MP Reach NLRI Route Distinguisher: 100:2
                        MP Reach NLRI IPv4 prefix: 192.168.5.0 (192.168.5.0)

以下のコマンドでBGP vpnv4 neighborに関する情報を確認する事ができます。おそらく、このコマンドが一番素早く動作確認できると思います。

show bgp vpnv4 unicast allを実行した結果、neighborが確立されているのにも関わらずprefixが想定通りに交換されないと判明した場合は、上記forwarding tableを表示させるなどのより詳しい情報を調べると良いと思います。

PE3#show bgp vpnv4 unicast all
BGP table version is 20, local router ID is 200.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 100:1 (default for vrf VPN_A)
*> 172.16.1.0/24    172.16.13.1              0         32768 i
*>i172.16.5.0/24    200.4.4.4                0    100      0 i
*> 172.16.13.0/24   0.0.0.0                  0         32768 i
*>i172.16.45.0/24   200.4.4.4                0    100      0 i
Route Distinguisher: 100:2 (default for vrf VPN_B)
*> 192.168.2.0      192.168.23.2             0         32768 ?
*>i192.168.5.0      200.4.4.4                0    100      0 ?
*> 192.168.23.0     0.0.0.0                  0         32768 ?
*>i192.168.45.0     200.4.4.4                0    100      0 ?
PE3#

CE間で疎通可能である事を確認します。

CE5#ping vrf VPN_A 172.16.1.1 source Loopback 1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
Packet sent with a source address of 172.16.5.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/52/120 ms
CE5#
CE5#
CE5#
CE5#ping vrf VPN_B 192.168.2.2 source Loopback 2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
Packet sent with a source address of 192.168.5.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/51/128 ms
CE5#

route-tagetの操作

複数 route-target

複雑な要件がない場合は、Route Distinguisherとroute targetは同じ値を設定します。しかし、route targetを操作する事によってより柔軟なルーティングが可能です。

例えば、PE VPN_Bに対して100:1のprefixをimportするように設定します。

 [PE4]
ip vrf VPN_B
 rd 100:2
 route-target export 100:2
 route-target import 100:1
 route-target import 100:2

すると、PE4 VPN_BにCE1とCE2からの両方のルートがimportされるようになります。

なお、この設定だけでは、CE5 VPN_BからCE1へのpingによる疎通はできません。
疎通可能にするためには、PE3 VPN_Aに対して戻りのルートも定義する必要があります。

PE4#show bgp vpnv4 unicast vrf VPN_B
BGP table version is 21, local router ID is 200.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 100:2 (default for vrf VPN_B)
*>i172.16.1.0/24    200.3.3.3                0    100      0 i
*> 172.16.5.0/24    172.16.45.5              0         32768 i
*>i172.16.13.0/24   200.3.3.3                0    100      0 i
*> 172.16.45.0/24   0.0.0.0                  0         32768 i
*>i192.168.2.0      200.3.3.3                0    100      0 ?
*> 192.168.5.0      192.168.45.5             0         32768 ?
*>i192.168.23.0     200.3.3.3                0    100      0 ?
*> 192.168.45.0     0.0.0.0                  0         32768 ?
PE4#

route-mapの使用

route-mapを使ったより柔軟な制御も可能です。例えば以下のような設定を投入すると、192.168.2.0/24のみRoute Distinguisher 100:1が付与され、それ以外のprefixには100:2が付与されてBGP neighborに伝搬されます。

 [PE3]
ip vrf VPN_B
 rd 100:2
 export map RMAP_EXPORT
 route-target import 100:2
!
ip prefix-list PREFIX_CE2_LOOPBACK0 seq 10 permit 192.168.2.0/24
!
route-map RMAP_EXPORT permit 10
 match ip address prefix-list PREFIX_CE2_LOOPBACK0
 set extcommunity rt  100:1
!
route-map RMAP_EXPORT permit 99
 set extcommunity rt  100:2

新たに192.168.2.0/24のみがPE4 VPN_Aにimportされた事が確認できます。

PE4#show bgp vpnv4 unicast vrf VPN_A
BGP table version is 29, local router ID is 200.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 100:1 (default for vrf VPN_A)
*>i172.16.1.0/24    200.3.3.3                0    100      0 i
*> 172.16.5.0/24    172.16.45.5              0         32768 i
*>i172.16.13.0/24   200.3.3.3                0    100      0 i
*> 172.16.45.0/24   0.0.0.0                  0         32768 i
*>i192.168.2.0      200.3.3.3                0    100      0 ?
PE4#

その他 機能

ipv4無効化

BGPはneighborを定義すると、自動的にipv4 neighborが有効になります。

以下のコマンドを入力すると、自動的にipv4 neighborが有効になる機能を打ち消す事ができます。vpnv4 neighborのみを有効にしたい時などに有用な設定です。

Router(config-router)#no bgp default ipv4-unicast

vpnv4 読込間隔

以下のコマンドで、VRF上のルーティングテーブルをvpnv4 routing tableにimportする間隔を定義する事ができます。なお、デフォルトは15秒間隔です。

Router(config-router)#address-family vpnv4
Router(config-router-af)#bgp scan-time import 5
タイトルとURLをコピーしました