🏡

FRR実践⑤ Segment Routing(OSPF)基本 Config編

に公開

IGPにOSPFを使ったSegment Routingを構成してみる


Segment RoutingのTraffic Engineeringの動作まで確認したいので6台のラダー構成を作成します。

Config

事前設定(Linux側)

FRR側に設定する前にMPLSを動作させるにはいくつかLinux側に設定を入れる必要があります。
MPLSのモジュール読み込みとインターフェースへの有効化、ラベル上限値の設定
設定後に再起動を実施します。

/etc/modules-load.d/modules.conf
mpls_router
mpls_gso
mpls_iptunnel
sysctl -w net.mpls.conf.eth0.input=1 >> /etc/sysctl.conf
sysctl -w net.mpls.conf.eth1.input=1 >> /etc/sysctl.conf
sysctl -w net.mpls.conf.eth2.input=1 >> /etc/sysctl.conf
sysctl -w net.mpls.conf.eth3.input=1 >> /etc/sysctl.conf
sysctl -w net.mpls.conf.eth4.input=1 >> /etc/sysctl.conf
sysctl -w net.mpls.conf.eth5.input=1 >> /etc/sysctl.conf
sysctl -w net.mpls.conf.eth6.input=1 >> /etc/sysctl.conf
sysctl -w net.mpls.conf.eth7.input=1 >> /etc/sysctl.conf
sysctl -w net.mpls.conf.lo.input=1 >> /etc/sysctl.conf

sysctl -w net.mpls.platform_labels=1000000 >> /etc/sysctl.conf
sysctl -w net.ipv4.conf.all.rp_filter=0 >> /etc/sysctl.conf
sysctl -w net.ipv4.conf.lo.rp_filter=0 >> /etc/sysctl.conf

Router_A

Router_A# show running-config
Building configuration...

Current configuration:
!
frr version 8.2.2
frr defaults traditional
hostname frr
hostname Router_A
service integrated-vtysh-config
!
interface eth1
 ip address 172.16.1.1/30
 ip ospf 1 area 0
 ip ospf network point-to-point
exit
!
interface eth6
 ip address 172.16.5.1/30
 ip ospf 1 area 0
 ip ospf network point-to-point
exit
!
interface eth7
 ip address 192.168.1.254/24
 ip ospf 1 area 0
 ip ospf passive
exit
!
interface lo
 ip address 10.0.0.1/32
 ip ospf 1 area 0
 ip ospf passive
exit
!
router ospf 1
 ospf router-id 10.0.0.1
 capability opaque
 mpls-te on
 mpls-te router-address 10.0.0.1
 mpls-te export
 segment-routing on
 segment-routing global-block 16000 16999
 segment-routing node-msd 8
 segment-routing prefix 10.0.0.1/32 index 10
 router-info area
exit
!
segment-routing
 traffic-eng
 exit
exit
!
end
Router_B

Router_B# show running-config
Building configuration...

Current configuration:
!
frr version 8.2.2
frr defaults traditional
hostname frr
hostname Router_B
service integrated-vtysh-config
!
interface eth1
ip address 172.16.1.2/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface eth2
ip address 172.16.2.1/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface eth6
ip address 172.16.6.1/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface lo
ip address 10.0.0.2/32
ip ospf 1 area 0
ip ospf passive
exit
!
router ospf 1
ospf router-id 10.0.0.2
capability opaque
mpls-te on
mpls-te router-address 10.0.0.2
segment-routing on
segment-routing global-block 16000 16999
segment-routing node-msd 8
segment-routing prefix 10.0.0.2/32 index 20
router-info area
exit
!
segment-routing
traffic-eng
exit
exit
!
end

Router_C

Router_C# show running-config
Building configuration...

Current configuration:
!
frr version 8.2.2
frr defaults traditional
hostname frr
hostname Router_C
service integrated-vtysh-config
!
interface eth2
ip address 172.16.2.2/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface eth6
ip address 172.16.7.1/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface lo
ip address 10.0.0.3/32
ip ospf 1 area 0
ip ospf passive
exit
!
interface eth7
exit
!
router ospf 1
ospf router-id 10.0.0.3
capability opaque
mpls-te on
mpls-te router-address 10.0.0.3
segment-routing on
segment-routing global-block 16000 16999
segment-routing node-msd 8
segment-routing prefix 10.0.0.3/32 index 30
router-info area
exit
!
segment-routing
traffic-eng
exit
exit
!
end

Router_D

Router_D# show running-config
Building configuration...

Current configuration:
!
frr version 8.2.2
frr defaults traditional
hostname frr
hostname Router_D
service integrated-vtysh-config
!
interface eth1
ip address 172.16.3.1/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface eth6
ip address 172.16.5.2/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface lo
ip address 10.0.0.4/32
ip ospf 1 area 0
ip ospf passive
exit
!
interface eth7
exit
!
router ospf 1
ospf router-id 10.0.0.4
capability opaque
mpls-te on
mpls-te router-address 10.0.0.4
segment-routing on
segment-routing global-block 16000 16999
segment-routing node-msd 8
segment-routing prefix 10.0.0.4/32 index 40
router-info area
exit
!
segment-routing
traffic-eng
exit
exit
!
end

Router_E

Router_E# show running-config
Building configuration...

Current configuration:
!
frr version 8.2.2
frr defaults traditional
hostname frr
hostname Router_E
service integrated-vtysh-config
!
interface eth1
ip address 172.16.3.2/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface eth2
ip address 172.16.4.1/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface eth6
ip address 172.16.6.2/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface lo
ip address 10.0.0.5/32
ip ospf 1 area 0
ip ospf passive
exit
!
router ospf 1
ospf router-id 10.0.0.5
capability opaque
mpls-te on
mpls-te router-address 10.0.0.5
segment-routing on
segment-routing global-block 16000 16999
segment-routing node-msd 8
segment-routing prefix 10.0.0.5/32 index 50
router-info area
exit
!
segment-routing
traffic-eng
exit
exit
!
end

Router_F

Router_F# show running-config
Building configuration...

Current configuration:
!
frr version 8.2.2
frr defaults traditional
hostname frr
hostname Router_F
service integrated-vtysh-config
!
interface eth2
ip address 172.16.4.2/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface eth6
ip address 172.16.7.2/30
ip ospf 1 area 0
ip ospf network point-to-point
exit
!
interface eth7
ip address 192.168.4.254/24
ip ospf 1 area 0
ip ospf passive
exit
!
interface lo
ip address 10.0.0.6/32
ip ospf 1 area 0
ip ospf passive
exit
!
router ospf 1
ospf router-id 10.0.0.6
capability opaque
mpls-te on
mpls-te router-address 10.0.0.6
mpls-te export
segment-routing on
segment-routing global-block 16000 16999
segment-routing node-msd 8
segment-routing prefix 10.0.0.6/32 index 60
router-info area
exit
!
segment-routing
traffic-eng
exit
exit
!
end

Config解説

まずはシングルエリアのOSPFを作成しています。OSPFの説明はこれまでの記事を参照ください。
https://zenn.dev/labathome/articles/2aab5a7fbd0b11
OSPFは特に変わった設定していません。そこにSegment Routingを追加設定していきます。
Configのポイント説明

経路情報の見え方

Router_A

Router_A# show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

O[1]   10.0.0.1/32 [110/0] is directly connected, lo, weight 1, 05:41:34
C>* 10.0.0.1/32 is directly connected, lo, 05:41:34
O[1]>* 10.0.0.2/32 [110/10] via 172.16.1.2, eth1, weight 1, 05:37:24
O[1]>* 10.0.0.3/32 [110/20] via 172.16.1.2, eth1, weight 1, 05:36:34
O[1]>* 10.0.0.4/32 [110/10] via 172.16.5.2, eth6, weight 1, 05:35:04
O[1]>* 10.0.0.5/32 [110/20] via 172.16.1.2, eth1, weight 1, 05:33:34
  *                         via 172.16.5.2, eth6, weight 1, 05:33:34
O[1]>* 10.0.0.6/32 [110/30] via 172.16.1.2, eth1, weight 1, 05:32:15
  *                         via 172.16.5.2, eth6, weight 1, 05:32:15
O[1]   172.16.1.0/30 [110/10] is directly connected, eth1, weight 1, 05:39:50
C>* 172.16.1.0/30 is directly connected, eth1, 05:41:34
O[1]>* 172.16.2.0/30 [110/20] via 172.16.1.2, eth1, weight 1, 05:37:24
O[1]>* 172.16.3.0/30 [110/20] via 172.16.5.2, eth6, weight 1, 05:35:04
O[1]>* 172.16.4.0/30 [110/30] via 172.16.1.2, eth1, weight 1, 05:33:34
  *                           via 172.16.5.2, eth6, weight 1, 05:33:34
O[1]   172.16.5.0/30 [110/10] is directly connected, eth6, weight 1, 05:41:34
C>* 172.16.5.0/30 is directly connected, eth6, 05:41:34
O[1]>* 172.16.6.0/30 [110/20] via 172.16.1.2, eth1, weight 1, 05:37:24
O[1]>* 172.16.7.0/30 [110/30] via 172.16.1.2, eth1, weight 1, 05:36:34
O[1]   192.168.1.0/24 [110/10] is directly connected, eth7, weight 1, 05:41:34
C>* 192.168.1.0/24 is directly connected, eth7, 05:41:34
K>* 192.168.4.0/24 [0/0] via 172.16.5.2, eth6, label 16050/16060, 00:34:50
O[1]   192.168.4.0/24 [110/40] via 172.16.1.2, eth1, weight 1, 05:32:15
                               via 172.16.5.2, eth6, weight 1, 05:32:15
Router_A# show ip ospf database segment-routing

                OSPF Segment Routing database for ID 10.0.0.1

SR-Node: 10.0.0.1       SRGB: [16000/16999]     SRLB: [15000/15999]     Algo.(s): SPF   MSD: 8

    Prefix or Link       Node or Adj. SID       Label Operation  Interface          Nexthop
------------------  ---------------------  --------------------  ---------  ---------------
       10.0.0.1/32        SR Pfx (idx 10)                no-op.         lo          0.0.0.0
     172.16.1.1/32    SR Adj. (lbl 15001)            Pop(15001)       eth1       172.16.1.2
     172.16.1.1/32    SR Adj. (lbl 15000)            Pop(15000)       eth1       172.16.1.2
     172.16.5.1/32    SR Adj. (lbl 15003)            Pop(15003)       eth6       172.16.5.2
     172.16.5.1/32    SR Adj. (lbl 15002)            Pop(15002)       eth6       172.16.5.2
     172.16.1.1/32    SR Adj. (lbl 15011)            Pop(15011)       eth1       172.16.1.2
 172.16.1.2
     172.16.5.1/32    SR Adj. (lbl 15015)            Pop(15015)       eth6       172.16.5.2
     172.16.5.1/32    SR Adj. (lbl 15014)            Pop(15014)       eth6       172.16.5.2

SR-Node: 10.0.0.3       SRGB: [16000/16999]     SRLB: [15000/15999]     Algo.(s): SPF   MSD: 8

    Prefix or Link       Node or Adj. SID       Label Operation  Interface          Nexthop
------------------  ---------------------  --------------------  ---------  ---------------
       10.0.0.3/32        SR Pfx (idx 30)    Swap(16030, 16030)       eth1       172.16.1.2
     172.16.2.2/32    SR Adj. (lbl 15007)                no-op.          -         10.0.0.2
     172.16.2.2/32    SR Adj. (lbl 15006)                no-op.          -         10.0.0.2
     172.16.2.2/32    SR Adj. (lbl 15011)                no-op.          -       172.16.2.1
     172.16.2.2/32    SR Adj. (lbl 15010)                no-op.          -       172.16.2.1
 172.16.7.2
     172.16.7.1/32    SR Adj. (lbl 15014)                no-op.          -       172.16.7.2

SR-Node: 10.0.0.6       SRGB: [16000/16999]     SRLB: [15000/15999]     Algo.(s): SPF   MSD: 8

    Prefix or Link       Node or Adj. SID       Label Operation  Interface          Nexthop
------------------  ---------------------  --------------------  ---------  ---------------
       10.0.0.6/32        SR Pfx (idx 60)    Swap(16060, 16060)       eth1       172.16.1.2
                                             Swap(16060, 16060)       eth6       172.16.5.2
     172.16.7.2/32    SR Adj. (lbl 15007)                no-op.          -         10.0.0.3
     172.16.7.2/32    SR Adj. (lbl 15006)                no-op.          -         10.0.0.3
     172.16.4.2/32    SR Adj. (lbl 15011)                no-op.          -         10.0.0.5
     172.16.4.2/32    SR Adj. (lbl 15010)                no-op.          -         10.0.0.5
     172.16.4.2/32    SR Adj. (lbl 15013)                no-op.          -       172.16.4.1
     172.16.4.2/32    SR Adj. (lbl 15012)                no-op.          -       172.16.4.1
     172.16.7.2/32    SR Adj. (lbl 15015)                no-op.          -       172.16.7.1
     172.16.7.2/32    SR Adj. (lbl 15014)                no-op.          -       172.16.7.1

SR-Node: 10.0.0.2       SRGB: [16000/16999]     SRLB: [15000/15999]     Algo.(s): SPF   MSD: 8

    Prefix or Link       Node or Adj. SID       Label Operation  Interface          Nexthop
------------------  ---------------------  --------------------  ---------  ---------------
       10.0.0.2/32        SR Pfx (idx 20)            Pop(16020)       eth1       172.16.1.2
     172.16.1.2/32    SR Adj. (lbl 15009)                no-op.          -         10.0.0.1
     172.16.1.2/32    SR Adj. (lbl 15008)                no-op.          -         10.0.0.1
 172.16.1.1
     172.16.1.2/32    SR Adj. (lbl 15010)                no-op.          -       172.16.1.1
     172.16.2.1/32    SR Adj. (lbl 15019)                no-op.          -       172.16.2.2
     172.16.2.1/32    SR Adj. (lbl 15018)                no-op.          -       172.16.2.2
     172.16.6.1/32    SR Adj. (lbl 15023)                no-op.          -       172.16.6.2
     172.16.6.1/32    SR Adj. (lbl 15022)                no-op.          -       172.16.6.2

SR-Node: 10.0.0.5       SRGB: [16000/16999]     SRLB: [15000/15999]     Algo.(s): SPF   MSD: 8

    Prefix or Link       Node or Adj. SID       Label Operation  Interface          Nexthop
------------------  ---------------------  --------------------  ---------  ---------------
       10.0.0.5/32        SR Pfx (idx 50)    Swap(16050, 16050)       eth1       172.16.1.2
                                             Swap(16050, 16050)       eth6       172.16.5.2
     172.16.6.2/32    SR Adj. (lbl 15009)                no-op.          -         10.0.0.2
     172.16.6.2/32    SR Adj. (lbl 15008)                no-op.          -         10.0.0.2
     172.16.3.2/32    SR Adj. (lbl 15013)                no-op.          -         10.0.0.4
     172.16.3.2/32    SR Adj. (lbl 15012)                no-op.          -         10.0.0.4
     172.16.3.2/32    SR Adj. (lbl 15015)                no-op.          -       172.16.3.1
     172.16.3.2/32    SR Adj. (lbl 15014)                no-op.          -       172.16.3.1
     172.16.6.2/32    SR Adj. (lbl 15017)                no-op.          -       172.16.6.1
     172.16.6.2/32    SR Adj. (lbl 15016)                no-op.          -       172.16.6.1
     172.16.4.1/32    SR Adj. (lbl 15023)                no-op.          -       172.16.4.2
     172.16.4.1/32    SR Adj. (lbl 15022)                no-op.          -       172.16.4.2

SR-Node: 10.0.0.4       SRGB: [16000/16999]     SRLB: [15000/15999]     Algo.(s): SPF   MSD: 8

    Prefix or Link       Node or Adj. SID       Label Operation  Interface          Nexthop
------------------  ---------------------  --------------------  ---------  ---------------
       10.0.0.4/32        SR Pfx (idx 40)            Pop(16040)       eth6       172.16.5.2
     172.16.5.2/32    SR Adj. (lbl 15011)                no-op.          -       172.16.5.1
     172.16.5.2/32    SR Adj. (lbl 15010)                no-op.          -       172.16.5.1
     172.16.3.1/32    SR Adj. (lbl 15015)                no-op.          -       172.16.3.2
     172.16.3.1/32    SR Adj. (lbl 15014)                no-op.          -       172.16.3.2

show ospf databaseを確認すると各ルーターのSIDを受け取っていることが分かります。
Segment Routingはこのラベルを頼りに転送制御できることがひとつの特徴となります。
次項ではSR-TEの動作について解説したいと思います。

Discussion