帮助我们改善您的体验。

让我们了解您的想法。

您是否能抽出两分钟的时间完成一份问卷调查?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
list Table of Contents
keyboard_arrow_right

机器翻译对您有帮助吗?

starstarstarstarstar
Go to English page
免责声明:

我们将使用第三方机器翻译软件翻译本页面。瞻博网络虽已做出相当大的努力提供高质量译文,但无法保证其准确性。如果对译文信息的准确性有任何疑问,请参阅英文版本. 可下载的 PDF 仅提供英文版.

示例:在路由策略中配置社区

date_range 18-Jan-25

社区是 BGP 用于对具有类似属性的路由进行管理分组的路由属性。

要求

配置此示例之前,不需要除设备初始化之外的特殊配置。

  • 在 Junos OS 21.1R1 版上使用 vMX 进行更新和重新验证。

概述

社区属性的一个主要作用是作为用于将路由关联在一起的管理标记值。通常,这些路由共享一些通用属性,但这不是必需的。社区是 BGP 中的一个灵活工具。可以将单个社区值分配给单个路径或多个路径。可以为路由分配单个社区值或多个值。网络使用社区属性来帮助实施管理路由策略。路由的分配值允许将其接受到网络中,或拒绝从网络中拒绝,或者允许其修改属性。

图 1 将设备 R1、设备 R2 和设备 R3 显示为自治系统 (AS) 64510 中的内部 BGP (IBGP) 对等方。设备 R4 正在播发来自 AS 64511 的 172.16.0.0/21 地址空间。

拓扑学

图 1: 常规 BGP 社区的拓扑常规 BGP 社区的拓扑

设备 R1 从设备 R4 接收的具体路由如下:

content_copy zoom_out_map
user@R1> show route receive-protocol bgp 10.0.0.13

inet.0: 24 destinations, 28 routes (24 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
* 172.16.0.0/24           10.0.0.13                               64511 I
* 172.16.1.0/24           10.0.0.13                               64511 I
* 172.16.2.0/24           10.0.0.13                               64511 I
* 172.16.3.0/24           10.0.0.13                               64511 I
  172.16.4.0/24           10.0.0.13                               64511 I
  172.16.5.0/24           10.0.0.13                               64511 I
  172.16.6.0/24           10.0.0.13                               64511 I
  172.16.7.0/24           10.0.0.13                               64511 I

AS 64511 的管理员希望接收来自设备 R1 的某些用户流量,以及来自设备 R3 的其他用户流量。为了实现此管理目标,设备 R4 将社区值 64511:1 附加到它发送的某些路由,并将社区值 64511:3 附加到它发送的其他路由。AS 64510 中的路由策略使用社区匹配标准进行配置,以将收到的路由的本地优先级更改为更改 BGP 路由选择算法的新值。首选具有最高本地优先级值的路由。

在设备 R1 上,为具有 64511:1 社区值的路由分配的本地优先级为 200,为具有 64511:3 社区值的路由分配的本地优先级为 50。在设备 R3 上,将执行相反的操作,以便为具有 64511:3 社区值的路由分配本地优先级 200,为具有 64511:1 社区值的路由分配本地优先级 50。然后,此信息通过 IBGP 由设备 R1 和设备 R3 传送到设备 R2。

CLI 快速配置 显示了 中 图 1所有设备的配置。

分步配置部分介绍了设备 R1 和 R4 上的配置步骤。

配置

CLI 快速配置

要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改与您的网络配置匹配所需的任何详细信息,然后将命令复制并粘贴到层次结构级别的 CLI [edit] 中。

设备 R1

content_copy zoom_out_map
set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.1/30
set interfaces ge-0/0/1 unit 0 family inet address 10.1.0.5/30
set interfaces ge-0/0/2 unit 0 family inet address 10.0.0.14/30
set interfaces lo0 unit 0 family inet address 192.168.0.1/32
set policy-options policy-statement change-local-preference term find-R1-routes from community R1_PREFERRED
set policy-options policy-statement change-local-preference term find-R1-routes then local-preference 200
set policy-options policy-statement change-local-preference term find-R3-routes from community R3_PREFERRED
set policy-options policy-statement change-local-preference term find-R3-routes then local-preference 50
set policy-options policy-statement send-direct term 1 from protocol direct
set policy-options policy-statement send-direct term 1 from route-filter 10.0.0.12/30 exact
set policy-options policy-statement send-direct term 1 then accept
set policy-options community R3_PREFERRED members 64511:3
set policy-options community R1_PREFERRED members 64511:1
set protocols bgp group int type internal
set protocols bgp group int local-address 192.168.0.1
set protocols bgp group int export send-direct
set protocols bgp group int neighbor 192.168.0.2
set protocols bgp group int neighbor 192.168.0.3
set protocols bgp group ext type external
set protocols bgp group ext import change-local-preference
set protocols bgp group ext peer-as 64511
set protocols bgp group ext neighbor 10.0.0.13
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set routing-options router-id 192.168.0.1
set routing-options autonomous-system 64510

设备 R2

content_copy zoom_out_map
set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.2/30
set interfaces ge-0/0/1 unit 0 family inet address 10.1.0.1/30
set interfaces lo0 unit 0 family inet address 192.168.0.2/32
set protocols bgp group int type internal
set protocols bgp group int local-address 192.168.0.2
set protocols bgp group int neighbor 192.168.0.1
set protocols bgp group int neighbor 192.168.0.3
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set routing-options router-id 192.168.0.2
set routing-options autonomous-system 64510

设备 R3

content_copy zoom_out_map
set interfaces ge-0/0/0 unit 0 family inet address 10.1.0.6/30
set interfaces ge-0/0/1 unit 0 family inet address 10.1.0.2/30
set interfaces ge-0/0/2 unit 0 family inet address 10.0.0.10/30
set interfaces lo0 unit 0 family inet address 192.168.0.3/32
set policy-options policy-statement change-local-preference term find-R3-routes from community R3_PREFERRED
set policy-options policy-statement change-local-preference term find-R3-routes then local-preference 200
set policy-options policy-statement change-local-preference term find-R1-routes from community R1_PREFERRED
set policy-options policy-statement change-local-preference term find-R1-routes then local-preference 50
set policy-options policy-statement send-direct term 1 from protocol direct
set policy-options policy-statement send-direct term 1 from route-filter 10.0.0.8/30 exact
set policy-options policy-statement send-direct term 1 then accept
set policy-options community R1_PREFERRED members 64511:1
set policy-options community R3_PREFERRED members 64511:3
set protocols bgp group int type internal
set protocols bgp group int local-address 192.168.0.3
set protocols bgp group int export send-direct
set protocols bgp group int neighbor 192.168.0.1
set protocols bgp group int neighbor 192.168.0.2
set protocols bgp group ext type external
set protocols bgp group ext import change-local-preference
set protocols bgp group ext peer-as 64511
set protocols bgp group ext neighbor 10.0.0.9
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0
set protocols ospf area 0.0.0.0 interface lo0.0 passive
set routing-options router-id 192.168.0.3
set routing-options autonomous-system 64510

设备 R4

content_copy zoom_out_map
set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.13/30
set interfaces ge-0/0/1 unit 0 family inet address 10.0.0.9/30
set interfaces lo0 unit 0 family inet address 192.168.0.4/32
set policy-options policy-statement send-static term 1 from protocol static
set policy-options policy-statement send-static term 1 from route-filter 172.16.0.0/24 exact
set policy-options policy-statement send-static term 1 from route-filter 172.16.1.0/24 exact
set policy-options policy-statement send-static term 1 from route-filter 172.16.2.0/24 exact
set policy-options policy-statement send-static term 1 from route-filter 172.16.3.0/24 exact
set policy-options policy-statement send-static term 1 then community add R1_PREFERRED
set policy-options policy-statement send-static term 1 then accept
set policy-options policy-statement send-static term 2 from protocol static
set policy-options policy-statement send-static term 2 from route-filter 172.16.4.0/24 exact
set policy-options policy-statement send-static term 2 from route-filter 172.16.5.0/24 exact
set policy-options policy-statement send-static term 2 from route-filter 172.16.6.0/24 exact
set policy-options policy-statement send-static term 2 from route-filter 172.16.7.0/24 exact
set policy-options policy-statement send-static term 2 then community add R3_PREFERRED
set policy-options policy-statement send-static term 2 then accept
set policy-options policy-statement send-static term 3 then reject
set policy-options community R3_PREFERRED members 64511:3
set policy-options community R1_PREFERRED members 64511:1
set protocols bgp group to-R1 type external
set protocols bgp group to-R1 export send-static
set protocols bgp group to-R1 peer-as 64510
set protocols bgp group to-R1 neighbor 10.0.0.14
set protocols bgp group to-R3 type external
set protocols bgp group to-R3 export send-static
set protocols bgp group to-R3 peer-as 64510
set protocols bgp group to-R3 neighbor 10.0.0.10
set routing-options router-id 192.168.0.4
set routing-options autonomous-system 64511
set routing-options static route 172.16.0.0/24 reject
set routing-options static route 172.16.1.0/24 reject
set routing-options static route 172.16.2.0/24 reject
set routing-options static route 172.16.3.0/24 reject
set routing-options static route 172.16.4.0/24 reject
set routing-options static route 172.16.5.0/24 reject
set routing-options static route 172.16.6.0/24 reject
set routing-options static route 172.16.7.0/24 reject

分步过程

以下示例要求您在配置层次结构中导航各个级别。有关导航 CLI 的信息,请参阅 在配置模式下使用 CLI 编辑器Junos OS CLI 用户指南

要配置设备 R1:

  1. 配置接口。

    content_copy zoom_out_map
    [edit interfaces]
    user@R1# set ge-0/0/0 unit 0 family inet address 10.0.0.1/30
    user@R1# set ge-0/0/1 unit 0 family inet address 10.1.0.5/30
    user@R1# set ge-0/0/2 unit 0 family inet address 10.0.0.14/30
    user@R1# set lo0 unit 0 family inet address 192.168.0.1/32
    
  2. 配置与设备 R2 和 R3 的内部网关协议 (IGP) 连接。

    content_copy zoom_out_map
    [edit protocols ospf area 0.0.0.0]
    user@R1# set interface ge-0/0/0.0
    user@R1# set interface ge-0/0/1.0
    user@R1# set interface lo0.0 passive
    
  3. 配置与设备 R2 和 R3 的 IBGP 连接。

    content_copy zoom_out_map
    [edit protocols bgp group int]
    user@R1# set type internal
    user@R1# set local-address 192.168.0.1
    user@R1# set export send-direct
    user@R1# set neighbor 192.168.0.2
    user@R1# set neighbor 192.168.0.3
    
  4. 配置与设备 R4 的 EBGP 连接。

    content_copy zoom_out_map
    [edit protocols bgp group ext]
    user@R1# set type external
    user@R1# set import change-local-preference
    user@R1# set peer-as 64511
    user@R1# set neighbor 10.0.0.13
    
  5. 配置策略 send-direct

    此策略在 IBGP 配置中引用,并使设备 R2 具有外部可访问性。另一种方法是在设备 R1 和设备 R3 上配置 next-hop self 策略。

    content_copy zoom_out_map
    [edit policy-options policy-statement send-direct term 1]
    user@R1# set from protocol direct
    user@R1# set from route-filter 10.0.0.12/30 exact
    user@R1# set then accept
    
  6. 配置用于更改具有指定社区标记的路由的本地首选项的策略。

    content_copy zoom_out_map
    [edit policy-options ]
    user@R1# set policy-statement change-local-preference term find-R1-routes from community R1_PREFERRED
    user@R1# set policy-statement change-local-preference term find-R1-routes then local-preference 200
    user@R1# set policy-statement change-local-preference term find-R3-routes from community R3_PREFERRED
    user@R1# set policy-statement change-local-preference term find-R3-routes then local-preference 50
    user@R1# set community R3_PREFERRED members 64511:3
    user@R1# set community R1_PREFERRED members 64511:1
    
  7. 配置自治系统 (AS) 编号和路由器 ID。

    content_copy zoom_out_map
    [edit routing-options]
    user@R1# set router-id 192.168.0.1
    user@R1# set autonomous-system 64510
    

要配置设备 R4:

  1. 配置接口。

    content_copy zoom_out_map
    [edit interfaces]
    user@R4# set ge-0/0/0 unit 0 family inet address 10.0.0.13/30
    user@R4# set ge-0/0/1 unit 0 family inet address 10.0.0.9/30
    user@R4# set lo0 unit 0 family inet address 192.168.0.4/32
    
  2. 配置与设备 R1 和设备 R3 的 EBGP 连接。

    content_copy zoom_out_map
    [edit protocols bgp]
    user@R4# set group to-R1 type external
    user@R4# set group to-R1 export send-static
    user@R4# set group to-R1 peer-as 64510
    user@R4# set group to-R1 neighbor 10.0.0.14
    user@R4# set group to-R3 type external
    user@R4# set group to-R3 export send-static
    user@R4# set group to-R3 peer-as 64510
    user@R4# set group to-R3 neighbor 10.0.0.10
    
  3. 配置社区标记。

    content_copy zoom_out_map
    [edit policy-options ]
    user@R4# set community R3_PREFERRED members 64511:3
    user@R4# set community R1_PREFERRED members 64511:1
    
  4. 配置策略 send-static

    与设备 R1 和设备 R3 的 EBGP 连接中引用此策略。该策略将 64511:1 (首选) 社区附加到某些路由,将 64511:3 (NOT_PREFERRED) 社区附加到其他路由。

    content_copy zoom_out_map
    [edit policy-options]
    user@R4# set policy-statement send-static term 1 from protocol static
    user@R4# set policy-statement send-static term 1 from route-filter 172.16.0.0/24 exact
    user@R4# set policy-statement send-static term 1 from route-filter 172.16.1.0/24 exact
    user@R4# set policy-statement send-static term 1 from route-filter 172.16.2.0/24 exact
    user@R4# set policy-statement send-static term 1 from route-filter 172.16.3.0/24 exact
    user@R4# set policy-statement send-static term 1 then community add R1_PREFERRED
    user@R4# set policy-statement send-static term 1 then accept
    user@R4# set policy-statement send-static term 2 from protocol static
    user@R4# set policy-statement send-static term 2 from route-filter 172.16.4.0/24 exact
    user@R4# set policy-statement send-static term 2 from route-filter 172.16.5.0/24 exact
    user@R4# set policy-statement send-static term 2 from route-filter 172.16.6.0/24 exact
    user@R4# set policy-statement send-static term 2 from route-filter 172.16.7.0/24 exact
    user@R4# set policy-statement send-static term 2 then community add R3_PREFERRED
    user@R4# set policy-statement send-static term 2 then accept
    user@R4# set policy-statement send-static term 3 then reject
    
  5. 配置静态路由。

    content_copy zoom_out_map
    [edit routing-options static]
    user@R4# set route 172.16.0.0/24 reject
    user@R4# set route 172.16.1.0/24 reject
    user@R4# set route 172.16.2.0/24 reject
    user@R4# set route 172.16.3.0/24 reject
    user@R4# set route 172.16.4.0/24 reject
    user@R4# set route 172.16.5.0/24 reject
    user@R4# set route 172.16.6.0/24 reject
    user@R4# set route 172.16.7.0/24 reject
    
  6. 配置自治系统 (AS) 编号和路由器 ID。

    content_copy zoom_out_map
    [edit routing-options]
    user@R4# set router-id 192.168.0.4
    user@R4# set autonomous-system 64511
    

结果

在配置模式下,输入 show interfacesshow protocolsshow policy-optionsshow routing-options 命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的说明,以便进行更正。

设备 R1

content_copy zoom_out_map
user@R1# show interfaces
ge-0/0/0 {
    unit 0 {
        family inet {
            address 10.0.0.1/30;
        }
    }
}
ge-0/0/1 {
    unit 0 {
        family inet {
            address 10.1.0.5/30;
        }
    }
}
ge-0/0/2 {
    unit 0 {
        family inet {
            address 10.0.0.14/30;
        }
    }
}
lo0 {
    unit 0 {
        family inet {
            address 192.168.0.1/32;
        }
    }
}
content_copy zoom_out_map
user@R1# show protocols
bgp {
    group int {
        type internal;
        local-address 192.168.0.1;
        export send-direct;
        neighbor 192.168.0.2;
        neighbor 192.168.0.3;
    }
    group ext {
        type external;
        import change-local-preference;
        peer-as 64511;
        neighbor 10.0.0.13;
    }
}
ospf {
    area 0.0.0.0 {
        interface ge-0/0/0.0;
        interface ge-0/0/1.0;
        interface lo0.0 {
            passive;
        }
    }
}
content_copy zoom_out_map
user@R1# show policy-options
policy-statement change-local-preference {
    term find-R1-routes {
        from community R1_PREFERRED;
        then {
            local-preference 200;
        }
    }
    term find-R3-routes {
        from community R3_PREFERRED;
        then {
            local-preference 50;
        }
    }
}
policy-statement send-direct {
    term 1 {
        from {
            protocol direct;
            route-filter 10.0.0.12/30 exact;
        }
        then accept;
    }
}
community R3_PREFERRED members 64511:3;
community R1_PREFERRED members 64511:1;
content_copy zoom_out_map
user@R1# show routing-options
router-id 192.168.0.1;
autonomous-system 64510;

设备 R4

content_copy zoom_out_map
user@R4# show interfaces
ge-0/0/0 {
    unit 0 {
        family inet {
            address 10.0.0.13/30;
        }
    }
}
ge-0/0/1 {
    unit 0 {
        family inet {
            address 10.0.0.9/30;
        }
    }
}
lo0 {
    unit 0 {
        family inet {
            address 192.168.0.4/32;
        }
    }
}
content_copy zoom_out_map
user@R4# show protocols
bgp {
    group to-R1 {
        type external;
        export send-static;
        peer-as 64510;
        neighbor 10.0.0.14;
    }
    group to-R3 {
        type external;
        export send-static;
        peer-as 64510;
        neighbor 10.0.0.10;
    }
}
content_copy zoom_out_map
user@R4# show policy-options
policy-statement send-static {
    term 1 {
        from {
            protocol static;
            route-filter 172.16.0.0/24 exact;
            route-filter 172.16.1.0/24 exact;
            route-filter 172.16.2.0/24 exact;
            route-filter 172.16.3.0/24 exact;
        }
        then {
            community add R1_PREFERRED;
            accept;
        }
    }
    term 2 {
        from {
            protocol static;
            route-filter 172.16.4.0/24 exact;
            route-filter 172.16.5.0/24 exact;
            route-filter 172.16.6.0/24 exact;
            route-filter 172.16.7.0/24 exact;
        }
        then {
            community add R3_PREFERRED;
            accept;
        }
    }
    term 3 {
        then reject;
    }
}
community R3_PREFERRED members 64511:3;
community R1_PREFERRED members 64511:1;
content_copy zoom_out_map
user@R4# show routing-options
router-id 192.168.0.4;
autonomous-system 64511;
static {
    route 172.16.0.0/24 reject;
    route 172.16.1.0/24 reject;
    route 172.16.2.0/24 reject;
    route 172.16.3.0/24 reject;
    route 172.16.4.0/24 reject;
    route 172.16.5.0/24 reject;
    route 172.16.6.0/24 reject;
    route 172.16.7.0/24 reject;
}

如果完成设备配置,请从配置模式输入 commit

验证

确认配置工作正常。

验证设备 R4 上发送的路由

目的

在设备 R4 上,检查发送到设备 R1 和设备 R3 的路由。

操作

content_copy zoom_out_map
user@R4> show route advertising-protocol bgp 10.0.0.14 extensive

inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden)
* 172.16.0.0/24 (1 entry, 1 announced)
 BGP group to-R1 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:1

* 172.16.1.0/24 (1 entry, 1 announced)
 BGP group to-R1 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:1

* 172.16.2.0/24 (1 entry, 1 announced)
 BGP group to-R1 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:1

* 172.16.3.0/24 (1 entry, 1 announced)
 BGP group to-R1 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:1

* 172.16.4.0/24 (1 entry, 1 announced)
 BGP group to-R1 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:3

* 172.16.5.0/24 (1 entry, 1 announced)
 BGP group to-R1 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:3

* 172.16.6.0/24 (1 entry, 1 announced)
 BGP group to-R1 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:3

* 172.16.7.0/24 (1 entry, 1 announced)
 BGP group to-R1 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:3

content_copy zoom_out_map
user@R4> show route advertising-protocol bgp 10.0.0.10 extensive

inet.0: 13 destinations, 13 routes (13 active, 0 holddown, 0 hidden)
* 172.16.0.0/24 (1 entry, 1 announced)
 BGP group to-R3 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:1

* 172.16.1.0/24 (1 entry, 1 announced)
 BGP group to-R3 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:1

* 172.16.2.0/24 (1 entry, 1 announced)
 BGP group to-R3 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:1

* 172.16.3.0/24 (1 entry, 1 announced)
 BGP group to-R3 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:1

* 172.16.4.0/24 (1 entry, 1 announced)
 BGP group to-R3 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:3

* 172.16.5.0/24 (1 entry, 1 announced)
 BGP group to-R3 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:3

* 172.16.6.0/24 (1 entry, 1 announced)
 BGP group to-R3 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:3

* 172.16.7.0/24 (1 entry, 1 announced)
 BGP group to-R3 type External
     Nexthop: Self
     AS path: [64511] I
     Communities: 64511:3

意义

设备 R4 已使用社区 64511:1 和 64511:3 标记路由,并将其发送到设备 R1 和 R3。

验证设备 R2 上收到的路由

目的

在设备 R2 上,检查从设备 R1 和设备 R3 收到的路由。

操作

content_copy zoom_out_map
user@R2> show route receive-protocol bgp 192.168.0.1

inet.0: 25 destinations, 25 routes (25 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
* 10.0.0.12/30            192.168.0.1                  100        I
* 172.16.0.0/24           10.0.0.13                    200        64511 I
* 172.16.1.0/24           10.0.0.13                    200        64511 I
* 172.16.2.0/24           10.0.0.13                    200        64511 I
* 172.16.3.0/24           10.0.0.13                    200        64511 I
content_copy zoom_out_map
user@R2> show route receive-protocol bgp 192.168.0.3

inet.0: 25 destinations, 25 routes (25 active, 0 holddown, 0 hidden)
  Prefix                  Nexthop              MED     Lclpref    AS path
* 10.0.0.8/30             192.168.0.3                  100        I
* 172.16.4.0/24           10.0.0.9                     200        64511 I
* 172.16.5.0/24           10.0.0.9                     200        64511 I
* 172.16.6.0/24           10.0.0.9                     200        64511 I
* 172.16.7.0/24           10.0.0.9                     200        64511 I
content_copy zoom_out_map
user@R2> show route match-prefix 172.16.*

inet.0: 25 destinations, 25 routes (25 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

172.16.0.0/24      *[BGP/170] 1w3d 00:02:11, localpref 200, from 192.168.0.1
                      AS path: 64511 I, validation-state: unverified
                    >  to 10.0.0.1 via ge-0/0/0.0
172.16.1.0/24      *[BGP/170] 1w3d 00:02:11, localpref 200, from 192.168.0.1
                      AS path: 64511 I, validation-state: unverified
                    >  to 10.0.0.1 via ge-0/0/0.0
172.16.2.0/24      *[BGP/170] 1w3d 00:02:11, localpref 200, from 192.168.0.1
                      AS path: 64511 I, validation-state: unverified
                    >  to 10.0.0.1 via ge-0/0/0.0
172.16.3.0/24      *[BGP/170] 1w3d 00:02:11, localpref 200, from 192.168.0.1
                      AS path: 64511 I, validation-state: unverified
                    >  to 10.0.0.1 via ge-0/0/0.0
172.16.4.0/24      *[BGP/170] 1w3d 00:01:50, localpref 200, from 192.168.0.3
                      AS path: 64511 I, validation-state: unverified
                    >  to 10.1.0.2 via ge-0/0/1.0
172.16.5.0/24      *[BGP/170] 1w3d 00:01:50, localpref 200, from 192.168.0.3
                      AS path: 64511 I, validation-state: unverified
                    >  to 10.1.0.2 via ge-0/0/1.0
172.16.6.0/24      *[BGP/170] 1w3d 00:01:50, localpref 200, from 192.168.0.3
                      AS path: 64511 I, validation-state: unverified
                    >  to 10.1.0.2 via ge-0/0/1.0
172.16.7.0/24      *[BGP/170] 1w3d 00:01:50, localpref 200, from 192.168.0.3
                      AS path: 64511 I, validation-state: unverified
                    >  to 10.1.0.2 via ge-0/0/1.0

意义

设备 R2 具有具有预期本地首选项的路由和由星号 (*) 指定的预期活动路由。

示例:根据 BGP 社区数量配置路由策略
footer-navigation