katorea memo

いろいろ

MPLS-TE Bandwidth Reservation

今回はMPLS-TEのBandwidth Reservationの挙動を確認する。
構成は前回と同じ。
f:id:gemunopedy:20170611135652p:plain

r2(PEルータ)のconfig

r2#sh run
!
hostname r2
!
vrf definition a
 rd 1:1
 !
 address-family ipv4
  route-target export 1:1
  route-target import 1:1
 exit-address-family
!
ip cef
no ipv6 cef
!
mpls traffic-eng tunnels
!
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.255
 ip ospf 1 area 0
!
interface Tunnel0
 ip unnumbered Loopback0
 tunnel mode mpls traffic-eng
 tunnel destination 7.7.7.7
 tunnel mpls traffic-eng autoroute announce
 tunnel mpls traffic-eng priority 7 7
 tunnel mpls traffic-eng bandwidth 5000
 tunnel mpls traffic-eng path-option 1 dynamic
 no routing dynamic
!
interface Ethernet0/0
 vrf forwarding a
 ip address 192.168.12.2 255.255.255.0
!
interface Ethernet0/1
 ip address 192.168.23.2 255.255.255.0
 ip ospf 1 area 0
 mpls traffic-eng tunnels
 ip rsvp bandwidth
!
interface Ethernet0/2
 ip address 172.16.0.2 255.255.255.0
 shutdown
!
interface Ethernet0/3
 ip address 192.168.25.2 255.255.255.0
 ip ospf 1 area 0
 mpls traffic-eng tunnels
 ip rsvp bandwidth
!
router ospf 1
 mpls traffic-eng router-id Loopback0
 mpls traffic-eng area 0
!
router bgp 2
 bgp log-neighbor-changes
 no bgp default ipv4-unicast
 neighbor 7.7.7.7 remote-as 2
 neighbor 7.7.7.7 update-source Loopback0
 !
 address-family ipv4
 exit-address-family
 !
 address-family vpnv4
  neighbor 7.7.7.7 activate
  neighbor 7.7.7.7 send-community extended
 exit-address-family
 !
 address-family ipv4 vrf a
  neighbor 192.168.12.1 remote-as 1
  neighbor 192.168.12.1 activate
 exit-address-family
!
end

赤文字がBandwidth Reservationで必要なconfigとなる。

xrv7(PEルータ)のconfig

RP/0/0/CPU0:xrv7#sh run
!
hostname xrv7
!
vrf a
 address-family ipv4 unicast
  import route-target
   1:1
  !
  export route-target
   1:1
  !
 !
!
interface Loopback0
 ipv4 address 7.7.7.7 255.255.255.255
!
interface tunnel-te0
 ipv4 unnumbered Loopback0
 signalled-bandwidth 3000
 autoroute announce
 !
 destination 2.2.2.2
 path-option 1 dynamic
!
interface MgmtEth0/0/CPU0/0
 shutdown
!
interface GigabitEthernet0/0/0/0
 vrf a
 ipv4 address 192.168.78.7 255.255.255.0
!
interface GigabitEthernet0/0/0/1
 ipv4 address 192.168.67.7 255.255.255.0
!
interface GigabitEthernet0/0/0/2
 shutdown
!
interface GigabitEthernet0/0/0/3
 ipv4 address 192.168.47.7 255.255.255.0
!
route-policy pass
  pass
end-policy
!
router ospf 1
 router-id 7.7.7.7
 address-family ipv4 unicast
 area 0
  mpls traffic-eng
  interface Loopback0
  !
  interface GigabitEthernet0/0/0/1
  !
  interface GigabitEthernet0/0/0/3
  !
 !
 mpls traffic-eng router-id Loopback0
!
router bgp 2
 bgp router-id 7.7.7.7
 address-family ipv4 unicast
 !
 address-family vpnv4 unicast
 !
 neighbor 2.2.2.2
  remote-as 2
  update-source Loopback0
  address-family vpnv4 unicast
  !
 !
 vrf a
  rd 1:1
  address-family ipv4 unicast
  !
  neighbor 192.168.78.8
   remote-as 3
   address-family ipv4 unicast
    route-policy pass in
    route-policy pass out
   !
  !
 !
!
rsvp
 interface GigabitEthernet0/0/0/1
  bandwidth
 !
 interface GigabitEthernet0/0/0/3
  bandwidth
 !
!
mpls traffic-eng
 interface GigabitEthernet0/0/0/1
 !
 interface GigabitEthernet0/0/0/3
 !
!
mpls ldp
!
end

XRはIOSと似たようなconfigとなる。
rsvp bandwidthはPルータにも設定する。

r3(Pルータ)のconfig

r3#sh run
Building configuration...
!
hostname r3
!
ip cef
no ipv6 cef
!
mpls traffic-eng tunnels
!
!
interface Loopback0
 ip address 3.3.3.3 255.255.255.255
 ip ospf 1 area 0
!
interface Ethernet0/0
 ip address 192.168.34.3 255.255.255.0
 ip ospf 1 area 0
 mpls traffic-eng tunnels
 ip rsvp bandwidth
!
interface Ethernet0/1
 ip address 192.168.23.3 255.255.255.0
 ip ospf 1 area 0
 mpls traffic-eng tunnels
 ip rsvp bandwidth
!
interface Ethernet0/2
 ip address 192.168.35.3 255.255.255.0
 ip ospf 1 area 0
 mpls traffic-eng tunnels
 ip rsvp bandwidth
!
interface Ethernet0/3
 ip address 192.168.36.3 255.255.255.0
 ip ospf 1 area 0
 mpls traffic-eng tunnels
 ip rsvp bandwidth
!
router ospf 1
 mpls traffic-eng router-id Loopback0
 mpls traffic-eng area 0
!
end

reservation状況を確認してみる。

r2#sh ip rsvp interface
interface    rsvp  allocated  i/f max  flow max sub max  VRF
Et0/1        ena   5M         7500K    7500K    0
Et0/3        ena   0          7500K    7500K    0

「ip rsvp bandwidth」だけで帯域を指定しない場合はデフォルトで75%の値が設定される。
ethなので10M x 0.75 = 7.5Mとなり、i/f max、flow maxは7500Kとなる。
allocatedはtun0配下の「tunnel mpls traffic-eng bandwidth 5000」コマンドで指定した値となる。

XRも同様。

RP/0/0/CPU0:xrv7#sh rsvp interface
Thu Jun 22 11:40:31.347 UTC

*: RDM: Default I/F B/W % : 75% [default] (max resv/bc0), 0% [default] (bc1)

Interface   MaxBW (bps)  MaxFlow (bps) Allocated (bps)      MaxSub (bps)
----------- ------------ ------------- -------------------- -------------
Gi0/0/0/1          750M*          750M            3M (  0%)            0*
Gi0/0/0/3          750M*          750M             0 (  0%)            0*

pathを確認していく。
r2からのtunnelはe0/1(r3)向けとなっている。
なのでr3でも同様の確認。

r3#sh ip rsvp interface
interface    rsvp  allocated  i/f max  flow max sub max  VRF
Et0/0        ena   0          7500K    7500K    0
Et0/1        ena   0          7500K    7500K    0
Et0/2        ena   0          7500K    7500K    0
Et0/3        ena   5M         7500K    7500K    0

e0/3の先はr6

r6#sh ip rsvp interface
interface    rsvp  allocated  i/f max  flow max sub max  VRF
Et0/0        ena   3M         7500K    7500K    0
Et0/1        ena   5M         7500K    7500K    0
Et0/2        ena   0          7500K    7500K    0
Et0/3        ena   0          7500K    7500K    0

r2からのtunnelは、r2→r3→r6→xrv7となっている。
ちなみに、e0/0の3Mはxrv7からのtunnelのやつ。

以下コマンドからもpathは確認できる。

r2#sho mpls traffic-eng tunnels

Name: r2_t0                               (Tunnel0) Destination: 7.7.7.7
  Status:
    Admin: up         Oper: up     Path: valid       Signalling: connected
    path option 1, type dynamic (Basis for Setup, path weight 30)

  Config Parameters:
    Bandwidth: 5000     kbps (Global)  Priority: 7  7   Affinity: 0x0/0xFFFF
    Metric Type: TE (default)
    AutoRoute:  enabled   LockDown: disabled  Loadshare: 5000     bw-based
    auto-bw: disabled
  Active Path Option Parameters:
    State: dynamic path option 1 is active
    BandwidthOverride: disabled  LockDown: disabled  Verbatim: disabled


  InLabel  :  -
  OutLabel : Ethernet0/1, 16
  RSVP Signalling Info:
       Src 2.2.2.2, Dst 7.7.7.7, Tun_Id 0, Tun_Instance 66
    RSVP Path Info:
      My Address: 192.168.23.2
      Explicit Route: 192.168.23.3 192.168.36.3 192.168.36.6 192.168.67.6
                      192.168.67.7 7.7.7.7
      Record   Route:   NONE
      Tspec: ave rate=5000 kbits, burst=1000 bytes, peak rate=5000 kbits
    RSVP Resv Info:
      Record   Route:   NONE
      Fspec: ave rate=5000 kbits, burst=1000 bytes, peak rate=5000 kbits
  History:
    Tunnel:
      Time since created: 1 hours, 1 minutes
      Time since path change: 52 minutes, 7 seconds
      Number of LSP IDs (Tun_Instances) used: 66
    Current LSP:
      Uptime: 52 minutes, 7 seconds
    Prior LSP:
      ID: path option 1 [65]
      Removal Trigger: path error

予約状況は以下のコマンドでも。

r2#sh mpls traffic-eng topology 2.2.2.2

IGP Id: 2.2.2.2, MPLS TE Id:2.2.2.2 Router Node  (ospf 1  area 0) id 1
      link[0]: Broadcast, DR: 192.168.23.3, nbr_node_id:13, gen:37
          frag_id 2, Intf Address:192.168.23.2
          TE metric:10, IGP metric:10, attribute flags:0x0
          SRLGs: None
          physical_bw: 10000 (kbps), max_reservable_bw_global: 7500 (kbps)
          max_reservable_bw_sub: 0 (kbps)

                                 Global Pool       Sub Pool
               Total Allocated   Reservable        Reservable
               BW (kbps)         BW (kbps)         BW (kbps)
               ---------------   -----------       ----------
        bw[0]:            0             7500                0
        bw[1]:            0             7500                0
        bw[2]:            0             7500                0
        bw[3]:            0             7500                0
        bw[4]:            0             7500                0
        bw[5]:            0             7500                0
        bw[6]:            0             7500                0
        bw[7]:         5000             2500                0

このコマンドの意味はよく分からない。表示結果はわかるけど、traffic-engにおけるlink-managementとadmission-controlが何を示すのわからない。今度調べる。

r2#show mpls traffic-eng link-management admission-control
System Information::
    Tunnels Count:        2
    GMPLS Tunnels Count:  0
    Tunnels Selected:     2
TUNNEL ID              UP IF     DOWN IF  PRIORITY STATE           BW (kbps)
2.2.2.2 0_66           -         Et0/1    7/7      Resv Admitted   5000       RG
7.7.7.7 0_20           Et0/3     -        7/7      Resv Admitted   0          U

続いて「ip rsvp bandwidth」の値を変更させることで、pathを変更させる。
現在はこのルート。

r1#traceroute 8.8.8.8 so 1.1.1.1
Type escape sequence to abort.
Tracing the route to 8.8.8.8
VRF info: (vrf in name/id, vrf out name/id)
  1 192.168.12.2 2 msec 1 msec 1 msec
  2 192.168.23.3 [MPLS: Labels 16/24014 Exp 0] 20 msec 17 msec 8 msec
  3 192.168.36.6 [MPLS: Labels 16/24014 Exp 0] 5 msec 19 msec 11 msec
  4 192.168.67.7 [MPLS: Label 24014 Exp 0] 11 msec 18 msec 10 msec
  5 192.168.78.8 5 msec 25 msec *

と、その前にpath途中のinterfaceをshutdownしたらどうなるんだろうと思い、r3 e0/3をshutdown。(r3→r6)
そうすると、r2でのpathが変わった。

r2#sh ip rsvp interface
interface    rsvp  allocated  i/f max  flow max sub max  VRF
Et0/1        ena   0          7500K    7500K    0
Et0/3        ena   5M         7500K    7500K    0

r1からのtracerouteも以下の通り。

r1#traceroute 8.8.8.8 so 1.1.1.1
Type escape sequence to abort.
Tracing the route to 8.8.8.8
VRF info: (vrf in name/id, vrf out name/id)
  1 192.168.12.2 3 msec 4 msec 2 msec
  2 192.168.25.5 [MPLS: Labels 17/24014 Exp 0] 24 msec 18 msec 12 msec
  3 192.168.56.6 [MPLS: Labels 18/24014 Exp 0] 7 msec 30 msec 18 msec
  4 192.168.67.7 [MPLS: Label 24014 Exp 0] 11 msec 17 msec 12 msec
  5 192.168.78.8 8 msec 19 msec *

r2→r3→r6→xrv7からr2→r5→r6→xrv7に変わってる。
ここらへんは、CSPFで再計算されてパケットのやりとりしているんだろうけど、
そういった細かい確認は全部二週目に。

コスト等の余計な設定はいれていないため、r3 e0/3をno shutしてもルートはr2→r5→r6→xrv7のまま。
なので、このルートがr2→r3→r4→xrv7となるように設定を試みる。
以下configを設定。

r2(config)#int e0/3
r2(config-if)#ip rsvp bandwidth 1000

設定後、以下のようになる。

r2#sh ip rsvp interface
interface    rsvp  allocated  i/f max  flow max sub max  VRF
Et0/1        ena   5M         7500K    7500K    0
Et0/3        ena   0          1M       1M       0
r2#sh mpls traffic-eng tunnels

Name: r2_t0                               (Tunnel0) Destination: 7.7.7.7
  Status:
    Admin: up         Oper: up     Path: valid       Signalling: connected
    path option 1, type dynamic (Basis for Setup, path weight 30)

  Config Parameters:
    Bandwidth: 5000     kbps (Global)  Priority: 7  7   Affinity: 0x0/0xFFFF
    Metric Type: TE (default)
    AutoRoute:  enabled   LockDown: disabled  Loadshare: 5000     bw-based
    auto-bw: disabled
  Active Path Option Parameters:
    State: dynamic path option 1 is active
    BandwidthOverride: disabled  LockDown: disabled  Verbatim: disabled


  InLabel  :  -
  OutLabel : Ethernet0/1, 17
  RSVP Signalling Info:
       Src 2.2.2.2, Dst 7.7.7.7, Tun_Id 0, Tun_Instance 71
    RSVP Path Info:
      My Address: 192.168.23.2
      Explicit Route: 192.168.23.3 192.168.34.3 192.168.34.4 192.168.47.4
                      192.168.47.7 7.7.7.7
      Record   Route:   NONE
      Tspec: ave rate=5000 kbits, burst=1000 bytes, peak rate=5000 kbits
    RSVP Resv Info:
      Record   Route:   NONE
      Fspec: ave rate=5000 kbits, burst=1000 bytes, peak rate=5000 kbits
  History:
    Tunnel:
      Time since created: 1 hours, 29 minutes
      Time since path change: 3 minutes, 17 seconds
      Number of LSP IDs (Tun_Instances) used: 71
    Current LSP:
      Uptime: 3 minutes, 17 seconds
    Prior LSP:
      ID: path option 1 [70]
      Removal Trigger: path error
r1#traceroute 8.8.8.8 so 1.1.1.1
Type escape sequence to abort.
Tracing the route to 8.8.8.8
VRF info: (vrf in name/id, vrf out name/id)
  1 192.168.12.2 3 msec 1 msec 1 msec
  2 192.168.23.3 [MPLS: Labels 17/24014 Exp 0] 17 msec 22 msec 18 msec
  3 192.168.34.4 [MPLS: Labels 16/24014 Exp 0] 8 msec 18 msec 14 msec
  4 192.168.47.7 [MPLS: Label 24014 Exp 0] 18 msec 12 msec 12 msec
  5 192.168.78.8 10 msec 19 msec *

いい感じ。
今度はr3向けのip rsvp bandwidthも1000kbpsで設定。

r2#sh ip rsvp interface
interface    rsvp  allocated  i/f max  flow max sub max  VRF
Et0/1        ena   0          1M       1M       0
Et0/3        ena   0          1M       1M       0
r2#
*Jun 22 12:19:05.144: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to down

すると、tunnel0がdown状態となる。これは「tunnel mpls traffic-eng bandwidth 5000」で設定した5Mbpsが確保できないためdownとなる。
なので、5Mbps以上の設定に戻すと

r2(config)#int e0/1
r2(config-if)#ip rsvp bandwidth 7500
r2(config-if)#
*Jun 22 12:22:06.788: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to up

up状態に戻る。

こんな便利な確認コマンドもある。

r2#show mpls traffic-eng topology path destination 7.7.7.7 bandwidth 7500
Query Parameters:
  Destination: 7.7.7.7
    Bandwidth: 7500
   Priorities: 0 (setup), 0 (hold)
     Affinity: 0x0 (value), 0xFFFFFFFF (mask)
Query Results:
  Min Bandwidth Along Path: 7500 (kbps)
  Max Bandwidth Along Path: 750000 (kbps)
  Hop  0: 192.168.23.2        : affinity 00000000, bandwidth 7500 (kbps)
  Hop  1: 192.168.23.3        : affinity 00000000, bandwidth 7500 (kbps)
  Hop  2: 192.168.34.3        : affinity 00000000, bandwidth 7500 (kbps)
  Hop  3: 192.168.34.4        : affinity 00000000, bandwidth 7500 (kbps)
  Hop  4: 192.168.47.4        : affinity 00000000, bandwidth 7500 (kbps)
  Hop  5: 192.168.47.7        : affinity 00000000, bandwidth 750000 (kbps)
  Hop  6: 7.7.7.7
r2#show mpls traffic-eng topology path destination 7.7.7.7 bandwidth 7501
Query Parameters:
  Destination: 7.7.7.7
    Bandwidth: 7501
   Priorities: 0 (setup), 0 (hold)
     Affinity: 0x0 (value), 0xFFFFFFFF (mask)
Query Results:
% No matching path to destination, 7.7.7.7

という感じに今回はここまで。
TEはまだ全然調べきれていないので、すでにある機能だと思うけど、
使用帯域率によってダイナミックにパスを変更する仕組みを作ってみたい。
netflow/sflowコレクタと連携させてansibleで自動的に設定みたいな。
サーバー系は全く知識がないので、いろいろと無駄に無意味に機能を連携させて自動化させる仕組みを構築させて知識を身につけたい。
今は構成図上でまったく意味をなしていないPCを使って。

サーバーとネットワークを絡めた構成でいろいろ自分で構築してみたいものがある。
looking glassとか、RPKIとか、bgpflowspecによるmitigateDDoSとか

この環境が自分で構築できるようになったらまた一段とネットワークやらが楽しくなるんだろうなと。
早くCCIE SP範囲を一周終わらせて、息抜きとしてここらへんに挑戦したい。

次回はFast Rerouteあたり。