BGP基于前缀的ORF示例

组网需求

  1. 如图PE1与PE2分别属于AS 100和AS 200
  2. 要求PE2 的出口路由只发送符合PE1 入口策略的路由

组网拓扑

BGP基于前缀的ORF

配置思路

  1. 在PE1上配置基于前缀的ORF功能

配置命令

  1. 配置路由器基本功能以及各接口IP地址

    • PE 1配置

      1
      2
      3
      4
      5
      6
      sys
      sys PE 1
      int g0/0/0
      ip add 111.1.1.1 30
      int LoopBack 0
      ip add 1.1.1.1 32
  • PE 2配置

    1
    2
    3
    4
    5
    6
    sys
    sys PE 2
    int g0/0/0
    ip add 111.1.1.2 30
    int LoopBack 0
    ip ad d 2.2.2. 32
  1. 配置EBGP连接

    • PE 1

      1
      2
      3
      4
      sys
      bgp 10
      router-id 1.1.1.1
      peer 111.1.1.2 as-number 20
  • PE 2配置

    1
    2
    3
    4
    sys
    bgp 20
    router-id 2.2.2.2
    peer 111.1.1.1 as-numebr 10
  1. 宣告路由

    • PE 2配置

      1
      2
      3
      4
      5
      6
      7
      sys
      ip route-static 3.3.3.3 32 NULL0
      ip route-static 4.4.4.4 32 NULL0
      ip route-static 5.5.5.5 32 NULL0

      bgp 20
      import-route static
  1. 配置IP前缀过滤

    • PE 1配置前缀过滤

      1
      2
      3
      4
      5
      sys
      ip ip-prefix BGP_ORF_List permit 4.4.4.0 24 greater-equal 32

      bgp 10
      peer 111.1.1.2 ip-prefix BGP_ORF_List import
  1. 配置BGP ORF

    • PE 1配置

      1
      2
      3
      sys
      bgp 10
      peer 111.1.1.2 capability-advertise orf ip-prefix both
  • PE 2配置

    1
    2
    3
    sys
    bgo 20
    peer 111.1.1.1 capability-advertise orf ip-prefix both

查看结果

  1. 没有配置ORF之前的路由表

    • PE 2上宣告的路由

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      dispaly bgp routing peer 111.1.1.1 advertised-routers

      <PE2>display bgp routing peer 111.1.1.1 advertised-routes

      BGP Local router ID is 2.2.2.2
      Status codes: * - valid, > - best, d - damped,
      h - history, i - internal, s - suppressed, S - Stale
      Origin : i - IGP, e - EGP, ? - incomplete


      Total Number of Routes: 3
      Network NextHop MED LocPrf PrefVal Path/Ogn

      *> 3.3.3.3/32 111.1.1.2 0 0 20?
      *> 4.4.4.4/32 111.1.1.2 0 0 20?
      *> 5.5.5.5/32 111.1.1.2 0 0 20?
  • PE1 上接收到路由

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    display bgp routing-table peer 111.1.1.2 received-routers

    <PE1>display bgp routing-table peer 111.1.1.2 received-routes

    BGP Local router ID is 1.1.1.1
    Status codes: * - valid, > - best, d - damped,
    h - history, i - internal, s - suppressed, S - Stale
    Origin : i - IGP, e - EGP, ? - incomplete


    Total Number of Routes: 1
    Network NextHop MED LocPrf PrefVal Path/Ogn

    *> 4.4.4.4/32 111.1.1.2 0 0
  1. 配置ORF之后的路由表

    • PE 2上宣告的路由

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      display bgp routing peer 111.1.1.1 advertised-routers

      <PE2>dis bgp routing-table peer 111.1.1.1 advertised-routes

      BGP Local router ID is 2.2.2.2
      Status codes: * - valid, > - best, d - damped,
      h - history, i - internal, s - suppressed, S - Stale
      Origin : i - IGP, e - EGP, ? - incomplete


      Total Number of Routes: 1
      Network NextHop MED LocPrf PrefVal Path/Ogn

      *> 4.4.4.4/32 111.1.1.2 0 0 20?
  • PE1 上接收到路由

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    dispaly bgp routing-table peer 111.1.1.2 received-routers

    <PE1>dis bgp routing-table peer 111.1.1.2 received-routes

    BGP Local router ID is 1.1.1.1
    Status codes: * - valid, > - best, d - damped,
    h - history, i - internal, s - suppressed, S - Stale
    Origin : i - IGP, e - EGP, ? - incomplete


    Total Number of Routes: 1
    Network NextHop MED LocPrf PrefVal Path/Ogn

    *> 4.4.4.4/32 111.1.1.2 0 0 20?
  1. PE1 上查看邻居信息

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    display bgp peer verbose

    <PE1>dis bgp peer 111.1.1.2 verbose

    BGP Peer is 111.1.1.2, remote AS 20
    Type: EBGP link
    BGP version 4, Remote router ID 2.2.2.2
    Update-group ID: 0
    BGP current state: Established, Up for 00h03m48s
    BGP current event: RecvKeepalive
    BGP last state: OpenConfirm
    BGP Peer Up count: 3
    Received total routes: 1
    Received active routes total: 1
    Advertised total routes: 0
    Port: Local - 179 Remote - 50000
    Configured: Connect-retry Time: 32 sec
    Configured: Active Hold Time: 180 sec Keepalive Time:60 sec
    Received : Active Hold Time: 180 sec
    Negotiated: Active Hold Time: 180 sec Keepalive Time:60 sec
    Peer optional capabilities:
    Peer supports bgp multi-protocol extension
    Peer supports bgp route refresh capability
    Peer supports bgp outbound route filter capability

    // 基于前缀的BGP ORF协商信息
    Support Address-Prefix: IPv4-UNC address-family, rfc-compatible, both
    Peer supports bgp 4-byte-as capability
    Address family IPv4 Unicast: advertised and received
    Received: Total 7 messages
    Update messages 1
    Open messages 1
    KeepAlive messages 4
    Notification messages 0
    Refresh messages 1
    Sent: Total 7 messages
    Update messages 0
    Open messages 2
    KeepAlive messages 4
    Notification messages 0
    Refresh messages 1
    Authentication type configured: None
    Last keepalive received: 2022/03/28 21:54:05 UTC-08:00
    Last keepalive sent : 2022/03/28 21:54:04 UTC-08:00
    Last update received: 2022/03/28 21:51:05 UTC-08:00
    Minimum route advertisement interval is 30 seconds
    Optional capabilities:
    Route refresh capability has been enabled
    Outbound route filter capability has been enabled

    // 基于前缀的BGP ORF协商信息
    Enable Address-Prefix: IPv4-UNC address-family, rfc-compatible, both
    4-byte-as capability has been enabled
    Peer Preferred Value: 0
    Routing policy configured:
    No import update filter list
    No export update filter list
    Import prefix list is: BGP_ORF_List
    No export prefix list
    No import route policy
    No export route policy
    No import distribute policy
    No export distribute policy
吴超 wechat
subscribe to my blog by scanning my public wechat account