1.组网需求

  公司A的所有设备在AS 65008内,公司B的所有设备在AS 65009内,AS 65008和AS 65009通过设备Switch A和Switch B相连。

  现要求实现Switch A能够访问AS 65009内的网段9.1.2.0/24,Switch C能够访问AS 65008内的网段8.1.1.0/24。

   

2.配置步骤

  1)配置各接口的IP地址

  2)配置OSPF:在AS 65009内配置OSPF,使得Switch B能获取到到9.1.2.0/24网段的路由。  

SW B
[SwitchB] ospf 1
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0
[SwitchB-ospf-1-area-0.0.0.0] network 9.1.1.0 0.0.0.255

SW C
[SwitchC] ospf 1
[SwitchC-ospf-1] import-route direct
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 9.1.1.0 0.0.0.255

  3)配置BGP连接

  配置EBGP连接,并在Switch A上将8.1.1.0/24网段通告到BGP路由表中,以便Switch B获取到网段8.1.1.0/24的路由。

SW A
[SwitchA] bgp 65008
[SwitchA-bgp-default] router-id 1.1.1.1
[SwitchA-bgp-default] peer 3.1.1.1 as-number 65009
[SwitchA-bgp-default] address-family ipv4 unicast
[SwitchA-bgp-default-ipv4] peer 3.1.1.1 enable
[SwitchA-bgp-default-ipv4] network 8.1.1.0 24

SW B
[SwitchB] bgp 65009
[SwitchB-bgp-default] router-id 2.2.2.2
[SwitchB-bgp-default] peer 3.1.1.2 as-number 65008
[SwitchB-bgp-default] address-family ipv4 unicast
[SwitchB-bgp-default-ipv4] peer 3.1.1.2 enable

  4)配置BGP与IGP交互  

  在Switch B上配置BGP引入OSPF路由,以便Switch A能够获取到到9.1.2.0/24网段的路由。

  在Switch B上配置OSPF引入BGP路由,以便Switch C能够获取到到8.1.1.0/24网段的路由。

# 在Switch B上配置BGP和OSPF互相引入路由

[SwitchB] bgp 65009
[SwitchB-bgp-default] address-family ipv4 unicast
[SwitchB-bgp-default-ipv4] import-route ospf 1
[SwitchB] ospf 1
[SwitchB-ospf-1] import-route bgp

  5)查看路由表

# 查看Switch A的BGP路由表。
[SwitchA] display bgp routing-table ipv4
 Total number of routes: 3
 BGP local router ID is 1.1.1.1
 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 3.3.3.3/32         3.1.1.1         1                     0       65009?
* >  8.1.1.0/24         8.1.1.1         0                     32768   i
* >e 9.1.2.0/24         3.1.1.1         1                     0       65009?
# 查看SwitchC的OSPF路由表。
[SwitchC] display ospf routing
          OSPF Process 1 with Router ID 3.3.3.3
                   Routing Table
 Routing for Network
 Destination        Cost     Type    NextHop         AdvRouter       Area
 9.1.1.0/24         1        Transit 9.1.1.2         3.3.3.3         0.0.0.0
 2.2.2.2/32         1        Stub    9.1.1.1         2.2.2.2         0.0.0.0
 Routing for ASEs
 Destination        Cost     Type    Tag         NextHop         AdvRouter
 8.1.1.0/24         1        Type2   1           9.1.1.1         2.2.2.2
 Total Nets: 3
 Intra Area: 2  Inter Area: 0  ASE: 1  NSSA: 0

 

posted on 2021-12-21 17:30  星痕1216  阅读(183)  评论(0编辑  收藏  举报