H3C OSPF配置2发布聚合路由配置举例

1.组网需求

·     Switch A和Switch B位于AS 200内,AS 200内使用OSPF作为IGP协议。

·     Switch C、Switch D和Switch E位于AS 100内,AS 100内使用OSPF作为IGP协议。

·     Switch B和Switch C之间建立EBGP连接,配置BGP引入OSPF和直连路由,配置OSPF进程引入BGP路由。

·     为了减小Switch A的路由表规模,在Switch B上配置路由聚合,只发布聚合后的路由10.0.0.0/8。

   

2.配置步骤

  1)配置OSPF

  SW A  

[SwitchA] router id 11.2.1.2
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255

  SW B  

[SwitchB] router id 11.2.1.1
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255

  SW C  

[SwitchC] router id 11.1.1.2
[SwitchC] ospf
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255

  SW D  

[SwitchD] router id 10.3.1.1
[SwitchD] ospf
[SwitchD-ospf-1] area 0
[SwitchD-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] network 10.3.1.0 0.0.0.255

  SW E  

[SwitchE] router id 10.4.1.1
[SwitchE] ospf
[SwitchE-ospf-1] area 0
[SwitchE-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255
[SwitchE-ospf-1-area-0.0.0.0] network 10.4.1.0 0.0.0.255

  2)配置BGP,引入OSPF和直连路由

  SW B  

[SwitchB] bgp 200
[SwitchB-bgp-default] peer 11.1.1.2 as 100
[SwitchB-bgp-default] address-family ipv4 unicast
[SwitchB-bgp-default-ipv4] peer 11.1.1.2 enable
[SwitchB-bgp-default-ipv4] import-route ospf
[SwitchB-bgp-default-ipv4] import-route direct

  SW C  

[SwitchC] bgp 100
[SwitchC-bgp-default] peer 11.1.1.1 as 200
[SwitchC-bgp-default] address-family ipv4 unicast
[SwitchC-bgp-default] peer 11.1.1.1 enable
[SwitchC-bgp-default-ipv4] import-route ospf
[SwitchC-bgp-default-ipv4] import-route direct

  3)在Switch B和Switch C上配置OSPF引入BGP路由  

[SwitchB] ospf
[SwitchB-ospf-1] import-route bgp  # 在Switch B上配置OSPF引入BGP路由。  
[SwitchC] ospf
[SwitchC-ospf-1] import-route bgp  # 在Switch C上配置OSPF引入BGP路由。

  查看SW A的路由信息  

[SwitchA] display ip routing-table
Destinations : 16        Routes : 16
Destination/Mask    Proto  Pre  Cost         NextHop         Interface

0.0.0.0/32          Direct 0    0            127.0.0.1       InLoop0
10.1.1.0/24         O_ASE2 150  1            11.2.1.1        Vlan100
10.2.1.0/24         O_ASE2 150  1            11.2.1.1        Vlan100
10.3.1.0/24         O_ASE2 150  1            11.2.1.1        Vlan100
10.4.1.0/24         O_ASE2 150  1            11.2.1.1        Vlan100
11.2.1.0/24         Direct 0    0            11.2.1.2        Vlan100
11.2.1.0/32         Direct 0    0            11.2.1.2        Vlan100
11.2.1.2/32         Direct 0    0            127.0.0.1       InLoop0
11.2.1.255/32       Direct 0    0            11.2.1.2        Vlan100
127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0
127.0.0.0/32        Direct 0    0            127.0.0.1       InLoop0
127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0
127.255.255.255/32  Direct 0    0            127.0.0.1       InLoop0
224.0.0.0/4         Direct 0    0            0.0.0.0         NULL0
224.0.0.0/24        Direct 0    0            0.0.0.0         NULL0
255.255.255.255/32  Direct 0    0            127.0.0.1       InLoop0

  4)在Switch B上配置路由聚合,只发布聚合路由10.0.0.0/8。

  [SwitchB-ospf-1] asbr-summary 10.0.0.0 8

  查看Switch A的路由表信息  

[SwitchA] display ip routing-table
Destinations : 13        Routes : 13
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
0.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0 10.0.0.0/8 O_ASE2 150 1 11.2.1.1 Vlan100 11.2.1.0/24 Direct 0 0 11.2.1.2 Vlan100 11.2.1.0/32 Direct 0 0 11.2.1.2 Vlan100 11.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0 11.2.1.255/32 Direct 0 0 11.2.1.2 Vlan100 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.0/32 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0 127.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0 224.0.0.0/4 Direct 0 0 0.0.0.0 NULL0 224.0.0.0/24 Direct 0 0 0.0.0.0 NULL0 255.255.255.255/32 Direct 0 0 127.0.0.1 InLoop0

  可以看出,路由10.1.1.0/24、10.2.1.0/24、10.3.1.0/24、10.4.1.0/24已经聚合为一条路由10.0.0.0/8。

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