1.组网需求

  所有交换机运行BGP协议,Switch A与Switch B建立EBGP连接,Switch C与Switch B和Switch D之间建立IBGP连接。

  Switch C作为路由反射器,Switch B和Switch D为Switch C的客户机。

  Switch D能够通过Switch C学到路由20.0.0.0/8。

   

2.配置步骤

  1)配置各接口的IP地址,并在AS 200内配置OSPF

  2)配置BGP连接

SWA
[SwitchA] bgp 100
[SwitchA-bgp-default] router-id 1.1.1.1
[SwitchA-bgp-default] peer 192.1.1.2 as-number 200
[SwitchA-bgp-default] address-family ipv4 unicast
[SwitchA-bgp-default-ipv4] peer 192.1.1.2 enable
[SwitchA-bgp-default-ipv4] network 20.0.0.0  # 通告20.0.0.0/8网段路由到BGP路由表中。

SWB
[SwitchB] bgp 200
[SwitchB-bgp-default] router-id 2.2.2.2
[SwitchB-bgp-default] peer 192.1.1.1 as-number 100
[SwitchB-bgp-default] peer 193.1.1.1 as-number 200
[SwitchB-bgp-default] address-family ipv4 unicast
[SwitchB-bgp-default-ipv4] peer 192.1.1.1 enable
[SwitchB-bgp-default-ipv4] peer 193.1.1.1 enable
[SwitchB-bgp-default-ipv4] peer 193.1.1.1 next-hop-local

SWC
[SwitchC] bgp 200
[SwitchC-bgp-default] router-id 3.3.3.3
[SwitchC-bgp-default] peer 193.1.1.2 as-number 200
[SwitchC-bgp-default] peer 194.1.1.2 as-number 200
[SwitchC-bgp-default] address-family ipv4 unicast
[SwitchC-bgp-default-ipv4] peer 193.1.1.2 enable
[SwitchC-bgp-default-ipv4] peer 194.1.1.2 enable

SWD
[SwitchD] bgp 200
[SwitchD-bgp-default] router-id 4.4.4.4
[SwitchD-bgp-default] peer 194.1.1.1 as-number 200
[SwitchD-bgp-default] address-family ipv4 unicast
[SwitchD-bgp-default-ipv4] peer 194.1.1.1 enable

  3)配置路由反射器

SWC
[SwitchC] bgp 200
[SwitchC-bgp-default] address-family ipv4 unicast
[SwitchC-bgp-default-ipv4] peer 193.1.1.2 reflect-client
[SwitchC-bgp-default-ipv4] peer 194.1.1.2 reflect-client

3.验证配置  

# 查看Switch B的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
* >e 20.0.0.0           192.1.1.1       0                     0       100i

# 查看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 20.0.0.0           193.1.1.2       0          100        0       100i

可以看出,Switch D从Switch C已经学到了20.0.0.0/8路由。

 

posted on 2021-12-28 15:47  星痕1216  阅读(613)  评论(0编辑  收藏  举报