Configuring OSPF to advertise a summary route
Network requirements
As shown in Figure 40:
Switch A and Switch B are in AS 200, which runs OSPF.
Switch C, Switch D, and Switch E are in AS 100, which runs OSPF.
An EBGP connection is established between Switch B and Switch C. Switch B and Switch C are configured to redistribute OSPF routes and direct routes into BGP and BGP routes into OSPF.
Switch B is configured with route summarization and advertises only the summary route 10.0.0.0/8 to reduce Switch A's routing table size.
Figure 40: Network diagram
Configuration procedure
Configure IP addresses for interfaces. (Details not shown.)
Configure OSPF basic functions:
# Configure Switch A.
<SwitchA> system-view [SwitchA] ospf [SwitchA-ospf-1] area 0 [SwitchA-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255 [SwitchA-ospf-1-area-0.0.0.0] quit [SwitchA-ospf-1] quit
# Configure Switch B.
<SwitchB> system-view [SwitchB] ospf [SwitchB-ospf-1] area 0 [SwitchB-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255 [SwitchB-ospf-1-area-0.0.0.0] quit [SwitchB-ospf-1] quit
# Configure Switch C.
<SwitchC> system-view [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 [SwitchC-ospf-1-area-0.0.0.0] quit [SwitchC-ospf-1] quit
# Configure Switch D.
<SwitchD> system-view [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 [SwitchD-ospf-1-area-0.0.0.0] quit
# Configure Switch E.
<SwitchE> system-view [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 [SwitchE-ospf-1-area-0.0.0.0] quit [SwitchE-ospf-1] quit
Configure BGP to redistribute OSPF routes and direct routes:
# Configure Switch B.
[SwitchB] bgp 200 [SwitchB-bgp] peer 11.1.1.2 as 100 [SwitchB-bgp] import-route ospf [SwitchB-bgp] import-route direct [SwitchB-bgp] quit
# Configure Switch C.
[SwitchC] bgp 100 [SwitchC-bgp] peer 11.1.1.1 as 200 [SwitchC-bgp] import-route ospf [SwitchC-bgp] import-route direct [SwitchC-bgp] quit
Configure Switch B and Switch C to redistribute BGP routes into OSPF:
# Configure OSPF to redistribute routes from BGP on Switch B.
[SwitchB] ospf [SwitchB-ospf-1] import-route bgp
# Configure OSPF to redistribute routes from BGP on Switch C.
[SwitchC] ospf [SwitchC-ospf-1] import-route bgp
# Display the OSPF routing table of Switch A.
[SwitchA] display ip routing-table Routing Tables: Public Destinations : 8 Routes : 8 Destination/Mask Proto Pre Cost NextHop Interface 10.1.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100 10.2.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100 10.3.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100 10.4.1.0/24 O_ASE 150 1 11.2.1.1 Vlan100 11.2.1.0/24 Direct 0 0 11.2.1.2 Vlan100 11.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
Configure summary route 10.0.0.0/8 on Switch B and advertise it:
[SwitchB-ospf-1] asbr-summary 10.0.0.0 8
# Display the OSPF routing table of Switch A.
[SwitchA] display ip routing-table Routing Tables: Public Destinations : 5 Routes : 5 Destination/Mask Proto Pre Cost NextHop Interface 10.0.0.0/8 O_ASE 150 2 11.2.1.1 Vlan100 11.2.1.0/24 Direct 0 0 11.2.1.2 Vlan100 11.2.1.2/32 Direct 0 0 127.0.0.1 InLoop0 127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0 127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
The output shows that routes 10.1.1.0/24, 10.2.1.0/24, 10.3.1.0/24 and 10.4.1.0/24 are summarized into one route 10.0.0.0/8.