H3C BGP配置7大规模BGP网络典型配置举例1BGP团体配置

1.组网需求  

  Switch B分别与Switch A、Switch C之间建立EBGP连接。

  通过在Switch A上配置NO_EXPORT团体属性,使得AS 10发布到AS 20中的路由,不会再被AS 20发布到其他AS。

   

2.配置步骤

  1)配置EBGP  

SWA
[SwitchA] bgp 10
[SwitchA-bgp-default] router-id 1.1.1.1
[SwitchA-bgp-default] peer 200.1.2.2 as-number 20
[SwitchA-bgp-default] address-family ipv4 unicast
[SwitchA-bgp-default-ipv4] peer 200.1.2.2 enable
[SwitchA-bgp-default-ipv4] network 9.1.1.0 255.255.255.0

SWB
[SwitchB] bgp 20
[SwitchB-bgp-default] router-id 2.2.2.2
[SwitchB-bgp-default] peer 200.1.2.1 as-number 10
[SwitchB-bgp-default] peer 200.1.3.2 as-number 30
[SwitchB-bgp-default] address-family ipv4 unicast
[SwitchB-bgp-default-ipv4] peer 200.1.2.1 enable
[SwitchB-bgp-default-ipv4] peer 200.1.3.2 enable

SWC
[SwitchC] bgp 30
[SwitchC-bgp-default] router-id 3.3.3.3
[SwitchC-bgp-default] peer 200.1.3.1 as-number 20
[SwitchC-bgp-default] address-family ipv4 unicast
[SwitchC-bgp-default-ipv4] peer 200.1.3.1 enable
# 查看Switch B的路由表。
[SwitchB] display bgp routing-table ipv4 9.1.1.0
 BGP local router ID: 2.2.2.2
 Local AS number: 20
 Paths:   1 available, 1 best
 BGP routing table information of 9.1.1.0/24:
 From            : 200.1.2.1 (1.1.1.1)
 Rely nexthop    : 200.1.2.1
 Original nexthop: 200.1.2.1
 OutLabel        : NULL
 RxPathID        : 0x0
 TxPathID        : 0x0
 AS-path         : 10
 Origin          : igp
 Attribute value : pref-val 0
 State           : valid, external, best
 IP precedence   : N/A
 QoS local ID    : N/A
 Traffic index   : N/A

# 查看Switch B的路由发送信息。
[SwitchB] display bgp routing-table ipv4 9.1.1.0 advertise-info
 BGP local router ID: 2.2.2.2
 Local AS number: 20
 Paths:   1 best
 BGP routing table information of 9.1.1.0/24(TxPathID:0):
 Advertised to peers (1 in total):
    200.1.3.2
可以看出,Switch B能够把到达目的地址9.1.1.0/24的路由通过BGP发布出去。

# 查看Switch C的BGP路由表。
[SwitchC] display bgp routing-table ipv4
 Total number of routes: 1
 BGP local router ID is 3.3.3.3
 Status codes: * - valid, > - best, d - dampened, h - history,
               s - suppressed, S - stale, i - internal, e - external
               a – additional-path
       Origin: i - IGP, e - EGP, ? - incomplete
     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn
* >e 9.1.1.0/24         200.1.3.1                             0       20 10i
可以看出,Switch C从Switch B那里学到了目的地址为9.1.1.0/24的路由。

  2)配置BGP团体属性

# 配置路由策略。
[SwitchA] route-policy comm_policy permit node 0
[SwitchA-route-policy-comm_policy-0] apply community no-export
[SwitchA-route-policy-comm_policy-0] quit

# 应用路由策略。
[SwitchA] bgp 10
[SwitchA-bgp-default] address-family ipv4 unicast
[SwitchA-bgp-default-ipv4] peer 200.1.2.2 route-policy comm_policy export
[SwitchA-bgp-default-ipv4] peer 200.1.2.2 advertise-community

3.验证配置  

# 查看Switch B的路由表。
[SwitchB] display bgp routing-table ipv4 9.1.1.0
 BGP local router ID: 2.2.2.2
 Local AS number: 20
 Paths:   1 available, 1 best
 BGP routing table information of 9.1.1.0/24:
 From            : 200.1.2.1 (1.1.1.1)
 Rely nexthop    : 200.1.2.1
 Original nexthop: 200.1.2.1
 OutLabel        : NULL
 RxPathID        : 0x0
 TxPathID        : 0x0
 Community       : No-Export
 AS-path         : 10
 Origin          : igp
 Attribute value : pref-val 0
 State           : valid, external, best
 IP precedence   : N/A
 QoS local ID    : N/A
 Traffic index   : N/A

# 查看Switch B的路由发送信息。
[SwitchB] display bgp routing-table ipv4 9.1.1.0 advertise-info
 BGP local router ID: 2.2.2.2
 Local AS number: 20
 Paths:   1 best
 BGP routing table information of 9.1.1.0/24(TxPathID:0):
 Not advertised to any peers yet

# 查看Switch C的BGP路由表。
[SwitchC] display bgp routing-table ipv4
 Total number of routes: 0

  在Switch B的BGP路由表中可以看到配置的团体属性,Switch B不会通过BGP将到达目的地址9.1.1.0/24的路由发布出去。

看看天上,于是我去了满是风雪的地方
原文地址:https://www.cnblogs.com/xinghen1216/p/15739369.html