• ospf sr


    root@mpls4:~# cat /etc/frr/frr.conf
    # default to using syslog. /etc/rsyslog.d/45-frr.conf places the log
    # in /var/log/frr/frr.log

    frr version 7.3.1
    frr defaults traditional
    hostname mpls3
    log file /var/log/frr/ospfd.log
    log syslog informational
    service integrated-vtysh-config
    !
    interface enp1s0
    ip address 172.16.0.10/30
    ip ospf area 0.0.0.0
    !
    interface enp7s0
    ip address 172.16.0.14/30
    ip ospf area 0.0.0.0
    !
    interface enp8s0
    ip address 172.16.0.18/30
    ip ospf area 0.0.0.0
    !
    interface lo
    ip address 192.168.0.4/32
    ip ospf area 0.0.0.0
    !
    router ospf
    ospf router-id 192.168.0.4
    passive-interface lo
    capability opaque
    mpls-te on
    mpls-te router-address 192.168.0.4
    segment-routing on
    segment-routing global-block 16000 19999
    segment-routing node-msd 11
    segment-routing prefix 192.168.0.4/32 index 1004
    router-info area
    !
    line vty
    !
    root@mpls4:~#

     段路由全局块SRGB

     

    mpls4# show ip ospf database 
    
           OSPF Router with ID (192.168.0.4)
    
                    Router Link States (Area 0.0.0.0)
    
    Link ID         ADV Router      Age  Seq#       CkSum  Link count
    192.168.0.1     192.168.0.1      699 0x8000003b 0x1d55 3
    192.168.0.2     192.168.0.2      712 0x80000073 0xd5ef 4
    192.168.0.3     192.168.0.3      722 0x80000041 0xc9ac 5
    192.168.0.4     192.168.0.4     1657 0x80000060 0x338f 5
    
                    Net Link States (Area 0.0.0.0)
    
    Link ID         ADV Router      Age  Seq#       CkSum
    172.16.0.6      192.168.0.3       42 0x80000007 0x7cd3
    172.16.0.10     192.168.0.4     1557 0x80000009 0x4efa
    172.16.0.14     192.168.0.4     1407 0x80000008 0x3213
    172.16.0.18     192.168.0.4     1637 0x80000004 0x1c28
    192.168.122.35  192.168.0.3      732 0x80000004 0xfd0e
    
                    Area-Local Opaque-LSA (Area 0.0.0.0)
    
    Opaque-Type/Id  ADV Router      Age  Seq#       CkSum
    4.0.0.0         192.168.0.1     1469 0x8000000d 0x536a
    4.0.0.0         192.168.0.2      742 0x8000000c 0x7745
    4.0.0.0         192.168.0.3      712 0x80000013 0x8b28
    4.0.0.0         192.168.0.4     1647 0x80000018 0xa309
    7.0.0.1         192.168.0.1     1469 0x8000000e 0xd6d7
    7.0.0.1         192.168.0.2     1652 0x8000000e 0xf8b2
    7.0.0.1         192.168.0.3     1452 0x8000000e 0x1b8d
    7.0.0.1         192.168.0.4     1367 0x8000000c 0x4166
    8.0.0.3         192.168.0.1     1569 0x80000003 0xc08d
    8.0.0.4         192.168.0.2       32 0x80000006 0x2a27
    
    
    mpls4# show ip ospf database segment-routing adv-router 192.168.0.1
    
                    OSPF Segment Routing database for ID 192.168.0.4
    
    SR-Node: 192.168.0.1    SRGB (Size/Label): 4000/16000   Algorithm(s): SPF       MSD: 8
    
        Prefix or Link  Label In  Label Out       Node or Adj. SID  Interface          Nexthop
    ------------------  --------  ---------  ---------------------  ---------  ---------------
        192.168.0.1/32     17001        pop      SR Pfx (idx 1001)     enp1s0       172.16.0.9
    
    mpls4# 
    mpls4# show ip ospf database opaque-area  segment-routing adv-router 192.168.0.1
    % Unknown command: show ip ospf database opaque-area  segment-routing adv-router 192.168.0.1
    mpls4# show ip ospf database opaque-area   adv-router 192.168.0.1
    
           OSPF Router with ID (192.168.0.4)
    
    
                    Area-Local Opaque-LSA (Area 0.0.0.0)
    
      LS age: 1659
      Options: 0x42 : *|O|-|-|-|-|E|-
      LS Flags: 0x6  
      LS Type: Area-Local Opaque-LSA
      Link State ID: 4.0.0.0 (Area-Local Opaque-Type/ID)
      Advertising Router: 192.168.0.1
      LS Seq Number: 8000000d
      Checksum: 0x536a
      Length: 60
    
      Opaque-Type 4 (Router Information LSA)
      Opaque-ID   0x0
      Opaque-Info: 40 octets of data
      Router Capabilities: 0x10000000
      Segment Routing Algorithm TLV:
        Algorithm 0: SPF
      Segment Routing Range TLV:
        Range Size = 4000
        SID Label = 16000
    
      Segment Routing MSD TLV:
        Node Maximum Stack Depth = 8
    
      LS age: 1659
      Options: 0x42 : *|O|-|-|-|-|E|-
      LS Flags: 0x6  
      LS Type: Area-Local Opaque-LSA
      Link State ID: 7.0.0.1 (Area-Local Opaque-Type/ID)
      Advertising Router: 192.168.0.1
      LS Seq Number: 8000000e
      Checksum: 0xd6d7
      Length: 44
    
      Opaque-Type 7 (Extended Prefix Opaque LSA)
      Opaque-ID   0x1
      Opaque-Info: 24 octets of data
      Extended Prefix TLV: Length 20
            Route Type: 1
            Address Family: 0x0
            Flags: 0x40
            Address: 192.168.0.1/32
      Prefix SID Sub-TLV: Length 8
            Algorithm: 0
            Flags: 0x0
            MT-ID:0x0
            Index: 1001
    
      LS age: 19
      Options: 0x42 : *|O|-|-|-|-|E|-
      LS Flags: 0x6  
      LS Type: Area-Local Opaque-LSA
      Link State ID: 8.0.0.3 (Area-Local Opaque-Type/ID)
      Advertising Router: 192.168.0.1
      LS Seq Number: 80000004
      Checksum: 0xbe8e
      Length: 60
    
      Opaque-Type 8 (Extended Link Opaque LSA)
      Opaque-ID   0x3
      Opaque-Info: 40 octets of data
      Extended Link TLV: Length 36
            Link Type: 0x2
            Link ID: 172.16.0.10
            Link data: 172.16.0.9
      Adj-SID Sub-TLV: Length 7
            Flags: 0xe0
            MT-ID:0x0
            Weight: 0x0
            Label: 50000
      Adj-SID Sub-TLV: Length 7
            Flags: 0x60
            MT-ID:0x0
            Weight: 0x0
            Label: 50001
    
    mpls4# 

    First, the MPLS modules aren’t loaded by default, so you’ll need to load them yourself:

    modprobe mpls_router
    modprobe mpls_gso
    modprobe mpls_iptunnel
    

    Then, you must activate MPLS on the interface you would used:

    sysctl -w net.mpls.conf.enp0s9.input=1
    sysctl -w net.mpls.conf.lo.input=1
    sysctl -w net.mpls.platform_labels=1048575
    

    The last line fix the maximum MPLS label value.

    Once OSPFd start with Segment Routing, you could check that MPLS routes are enable with:

    ip -M route
    ip route
    

    The first command show the MPLS LFIB table while the second show the FIB table which contains route with MPLS label encapsulation.

    If you disable Penultimate Hop Popping with the no-php-flag (see below), you MUST check that RP filter is not enable for the interface you intend to use, especially the lo one. For that purpose, disable RP filtering with:

    systcl -w net.ipv4.conf.all.rp_filter=0
    sysctl -w net.ipv4.conf.lo.rp_filter=0
    

    OSPFd

    Here it is a simple example of configuration to enable Segment Routing. Note that opaque capability and router information must be set to activate Opaque LSA prior to Segment Routing.

    router ospf
     ospf router-id 192.168.1.11
     capability opaque
      mpls-te on
      mpls-te router-address 192.168.1.11
     router-info area 0.0.0.0
     segment-routing on
     segment-routing global-block 10000 19999
     segment-routing node-msd 8
     segment-routing prefix 192.168.1.11/32 index 1100
    

    The first segment-routing statement enable it.

     mpls-te on

    The Second one set the SRGB,

    segment-routing global-block 10000 19999

    third line the MSD

    segment-routing node-msd 8

    and finally, set the Prefix SID index for a given prefix(1100).

    segment-routing prefix 192.168.1.11/32 index 1100

    Note that only prefix of Loopback interface could be configured with a Prefix SID. It is possible to add no-php-flag at the end of the prefix command to disable Penultimate Hop Popping. This advertises to peers that they MUST NOT pop the MPLS label prior to sending the packet.

    Prefix SID

     
    mpls4# show ip ospf database segment-routing 
    
                    OSPF Segment Routing database for ID 192.168.0.4
    
    SR-Node: 192.168.0.4    SRGB (Size/Label): 4000/16000   Algorithm(s): SPF       MSD: 11
    
        Prefix or Link  Label In  Label Out       Node or Adj. SID  Interface          Nexthop
    ------------------  --------  ---------  ---------------------  ---------  ---------------
        192.168.0.4/32         0          0      SR Pfx (idx 1004)         lo      192.168.0.4
        172.16.0.14/32     50001        pop    SR Adj. (lbl 50001)     enp7s0      172.16.0.13
        172.16.0.14/32     50000        pop    SR Adj. (lbl 50000)     enp7s0      172.16.0.13
        172.16.0.10/32     50003        pop    SR Adj. (lbl 50003)     enp1s0       172.16.0.9
        172.16.0.10/32     50002        pop    SR Adj. (lbl 50002)     enp1s0       172.16.0.9
        172.16.0.18/32     50005        pop    SR Adj. (lbl 50005)     enp8s0      172.16.0.17
        172.16.0.18/32     50004        pop    SR Adj. (lbl 50004)     enp8s0      172.16.0.17
    
    SR-Node: 192.168.0.2    SRGB (Size/Label): 4000/16000   Algorithm(s): SPF       MSD: 9
    
        Prefix or Link  Label In  Label Out       Node or Adj. SID  Interface          Nexthop
    ------------------  --------  ---------  ---------------------  ---------  ---------------
        192.168.0.2/32     17002        pop      SR Pfx (idx 1002)     enp7s0      172.16.0.13
    
    SR-Node: 192.168.0.1    SRGB (Size/Label): 4000/16000   Algorithm(s): SPF       MSD: 8
    
        Prefix or Link  Label In  Label Out       Node or Adj. SID  Interface          Nexthop
    ------------------  --------  ---------  ---------------------  ---------  ---------------
        192.168.0.1/32     17001        pop      SR Pfx (idx 1001)     enp1s0       172.16.0.9
    
    SR-Node: 192.168.0.3    SRGB (Size/Label): 4000/16000   Algorithm(s): SPF       MSD: 10
    
        Prefix or Link  Label In  Label Out       Node or Adj. SID  Interface          Nexthop
    ------------------  --------  ---------  ---------------------  ---------  ---------------
        192.168.0.3/32     17003        pop      SR Pfx (idx 1003)     enp8s0      172.16.0.17
    17003=16000 + 1003
    
    
    17001=16000 + 1001
    
    
    
    17002=16000 + 1002

     Adjacency SID

     

  • 相关阅读:
    mysql慢查询日志功能的使用
    回顾JavsScript对象的克隆
    JavaScript的几种继承方式
    再谈JavaScript中的闭包
    重温JavaScript预编译的四个步骤
    PHP常用设计模式
    编译 php-memcache 扩展时提示Cannot find autoconf
    CentOS 7 下编译安装lnmp之PHP篇详解
    CentOS 7 下编译安装lnmp之MySQL篇详解
    MySQL的转义符 ` 作用
  • 原文地址:https://www.cnblogs.com/dream397/p/13530003.html
Copyright © 2020-2023  润新知