1.组网需求

  AS 200中有多台BGP交换机,为了减少IBGP的连接数,现将他们划分为3个子自治系统:AS 65001、AS 65002和AS 65003。其中AS 65001内的三台交换机建立IBGP全连接。

     

2.配置步骤

  1)配置各接口IP

  2)配置BGP联盟

SWA
[SwitchA] bgp 65001
[SwitchA-bgp-default] router-id 1.1.1.1
[SwitchA-bgp-default] confederation id 200
[SwitchA-bgp-default] confederation peer-as 65002 65003
[SwitchA-bgp-default] peer 10.1.1.2 as-number 65002
[SwitchA-bgp-default] peer 10.1.2.2 as-number 65003
[SwitchA-bgp-default] address-family ipv4 unicast
[SwitchA-bgp-default-ipv4] peer 10.1.1.2 enable
[SwitchA-bgp-default-ipv4] peer 10.1.2.2 enable
[SwitchA-bgp-default-ipv4] peer 10.1.1.2 next-hop-local
[SwitchA-bgp-default-ipv4] peer 10.1.2.2 next-hop-local

SWB
[SwitchB] bgp 65002
[SwitchB-bgp-default] router-id 2.2.2.2
[SwitchB-bgp-default] confederation id 200
[SwitchB-bgp-default] confederation peer-as 65001 65003
[SwitchB-bgp-default] peer 10.1.1.1 as-number 65001
[SwitchB-bgp-default] address-family ipv4 unicast
[SwitchB-bgp-default-ipv4] peer 10.1.1.1 enable

SWC
[SwitchC] bgp 65003
[SwitchC-bgp-default] router-id 3.3.3.3
[SwitchC-bgp-default] confederation id 200
[SwitchC-bgp-default] confederation peer-as 65001 65002
[SwitchC-bgp-default] peer 10.1.2.1 as-number 65001
[SwitchC-bgp-default] address-family ipv4 unicast
[SwitchC-bgp-default-ipv4] peer 10.1.2.1 enable

  3)配置AS 65001内的IBGP连接

SWA
[SwitchA] bgp 65001
[SwitchA-bgp-default] peer 10.1.3.2 as-number 65001
[SwitchA-bgp-default] peer 10.1.4.2 as-number 65001
[SwitchA-bgp-default] address-family ipv4 unicast
[SwitchA-bgp-default-ipv4] peer 10.1.3.2 enable
[SwitchA-bgp-default-ipv4] peer 10.1.4.2 enable
[SwitchA-bgp-default-ipv4] peer 10.1.3.2 next-hop-local
[SwitchA-bgp-default-ipv4] peer 10.1.4.2 next-hop-local

SWD
[SwitchD] bgp 65001
[SwitchD-bgp-default] router-id 4.4.4.4
[SwitchD-bgp-default] confederation id 200
[SwitchD-bgp-default] peer 10.1.3.1 as-number 65001
[SwitchD-bgp-default] peer 10.1.5.2 as-number 65001
[SwitchD-bgp-default] address-family ipv4 unicast
[SwitchD-bgp-default-ipv4] peer 10.1.3.1 enable
[SwitchD-bgp-default-ipv4] peer 10.1.5.2 enable

SWE
[SwitchE] bgp 65001
[SwitchE-bgp-default] router-id 5.5.5.5
[SwitchE-bgp-default] confederation id 200
[SwitchE-bgp-default] peer 10.1.4.1 as-number 65001
[SwitchE-bgp-default] peer 10.1.5.1 as-number 65001
[SwitchE-bgp-default] address-family ipv4 unicast
[SwitchE-bgp-default-ipv4] peer 10.1.4.1 enable
[SwitchE-bgp-default-ipv4] peer 10.1.5.1 enable

  4)配置AS 100和AS 200之间的EBGP连接

SWA
[SwitchA] bgp 65001
[SwitchA-bgp-default] peer 200.1.1.2 as-number 100
[SwitchA-bgp-default] address-family ipv4 unicast
[SwitchA-bgp-default-ipv4] peer 200.1.1.2 enable

SWF
[SwitchF] bgp 100
[SwitchF-bgp-default] router-id 6.6.6.6
[SwitchF-bgp-default] peer 200.1.1.1 as-number 200
[SwitchF-bgp-default] address-family ipv4 unicast
[SwitchF-bgp-default-ipv4] peer 200.1.1.1 enable
[SwitchF-bgp-default-ipv4] network 9.1.1.0 255.255.255.0

3.验证配置

# 查看Switch B的BGP路由表。Switch C的BGP路由表与此类似。
[SwitchB] display bgp routing-table ipv4
 Total number of routes: 1
 BGP local router ID is 2.2.2.2
 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
* >i 9.1.1.0/24         10.1.1.1        0          100        0       (65001)
                                                                      100i
[SwitchB] display bgp routing-table ipv4 9.1.1.0
 BGP local router ID: 2.2.2.2
 Local AS number: 65002
 Paths:   1 available, 1 best
 BGP routing table information of 9.1.1.0/24:
 From            : 10.1.1.1 (1.1.1.1)
 Rely nexthop    : 10.1.1.1
 Original nexthop: 10.1.1.1
 OutLabel        : NULL
 RxPathID        : 0x0
 TxPathID        : 0x0
 AS-path         : (65001) 100
 Origin          : igp
 Attribute value : MED 0, localpref 100, pref-val 0, pre 255
 State           : valid, external-confed, best
 IP precedence   : N/A
 QoS local ID    : N/A
 Traffic index   : N/A

# 查看Switch D的BGP路由表。
[SwitchD] display bgp routing-table ipv4
 Total number of routes: 1
 BGP local router ID is 4.4.4.4
 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
* >i 9.1.1.0/24         10.1.3.1        0          100        0       100i
[SwitchD] display bgp routing-table ipv4 9.1.1.0
 BGP local router ID: 4.4.4.4
 Local AS number: 65001
 Paths:   1 available, 1 best
 BGP routing table information of 9.1.1.0/24:
 From            : 10.1.3.1 (1.1.1.1)
 Rely nexthop    : 10.1.3.1
 Original nexthop: 10.1.3.1
 OutLabel        : NULL
 RxPathID        : 0x0
 TxPathID        : 0x0
 AS-path         : 100
 Origin          : igp
 Attribute value : MED 0, localpref 100, pref-val 0, pre 255
 State           : valid, internal-confed, best
 IP precedence   : N/A
 QoS local ID    : N/A
 Traffic index   : N/A

  通过以上显示信息可以看出:

  Switch F只需要和Switch A建立EBGP连接,而不需要和Switch B、Switch C建立连接,同样可以通过联盟将路由信息传递给Switch B和Switch C。

  Switch B和Switch D在同一个联盟里,但是属于不同的子自治系统,它们都是通过Switch A来获取外部路由信息,生成的BGP路由表项也是一致的,等效于在同一个自治系统内,但是又不需要物理上全连接。

 

posted on 2021-12-28 16:01  星痕1216  阅读(229)  评论(0编辑  收藏  举报