BGP and IGP route redistribution configuration example
Network requirements
As shown in Figure 64, all devices of company A belong to AS 65008, and all devices of company B belong to AS 65009.
Configure BGP and IGP route redistribution to allow Switch A to access network 9.1.2.0/24 in AS 65009, and Switch C to access network 8.1.1.0/24 in AS 65008.
Figure 64: Network diagram
Requirements analysis
Configure BGP to redistribute routes from OSPF on Switch B, so Switch A can obtain the route to 9.1.2.0/24. Configure OSPF to redistribute routes from BGP on Switch B, so Switch C can obtain the route to 8.1.1.0/24.
Configuration procedure
Configure IP addresses for interfaces. (Details not shown.)
Configure OSPF:
Enable OSPF in AS 65009, so Switch B can obtain the route to 9.1.2.0/24.
# Configure Switch B.
<SwitchB> system-view [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 [SwitchB-ospf-1-area-0.0.0.0] quit [SwitchB-ospf-1] quit
# Configure Switch C.
<SwitchC> system-view [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 [SwitchC-ospf-1-area-0.0.0.0] quit [SwitchC-ospf-1] quit
Configure the EBGP connection:
Configure the EBGP connection and inject network 8.1.1.0/24 to the BGP routing table of Switch A, so that Switch B can obtain the route to 8.1.1.0/24.
# Configure Switch A.
<SwitchA> system-view [SwitchA] bgp 65008 [SwitchA-bgp] router-id 1.1.1.1 [SwitchA-bgp] peer 3.1.1.1 as-number 65009 [SwitchA-bgp] address-family ipv4 unicast [SwitchA-bgp-ipv4] peer 3.1.1.1 enable [SwitchA-bgp-ipv4] network 8.1.1.0 24 [SwitchA-bgp-ipv4] quit [SwitchA-bgp] quit
# Configure Switch B.
[SwitchB] bgp 65009 [SwitchB-bgp] router-id 2.2.2.2 [SwitchB-bgp] peer 3.1.1.2 as-number 65008 [SwitchB-bgp] address-family ipv4 unicast [SwitchB-bgp-ipv4] peer 3.1.1.2 enable
Configure BGP and IGP route redistribution:
# Configure route redistribution between BGP and OSPF on Switch B.
[SwitchB-bgp-ipv4] import-route ospf 1 [SwitchB-bgp-ipv4] quit [SwitchB-bgp] quit [SwitchB] ospf 1 [SwitchB-ospf-1] import-route bgp [SwitchB-ospf-1] quit
# Display the BGP routing table on Switch A.
[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 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?
# Display the OSPF routing table on Switch C.
[SwitchC] display ospf routing OSPF Process 1 with Router ID 3.3.3.3 Routing Tables 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
Verifying the configuration
# Use ping to test connectivity.
[SwitchA] ping -a 8.1.1.1 9.1.2.1 Ping 9.1.2.1 (9.1.2.1) from 8.1.1.1: 56 data bytes, press CTRL_C to break 56 bytes from 9.1.2.1: icmp_seq=0 ttl=254 time=10.000 ms 56 bytes from 9.1.2.1: icmp_seq=1 ttl=254 time=12.000 ms 56 bytes from 9.1.2.1: icmp_seq=2 ttl=254 time=2.000 ms 56 bytes from 9.1.2.1: icmp_seq=3 ttl=254 time=7.000 ms 56 bytes from 9.1.2.1: icmp_seq=4 ttl=254 time=9.000 ms --- Ping statistics for 9.1.2.1 --- 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss round-trip min/avg/max/std-dev = 2.000/8.000/12.000/3.406 ms [SwitchC] ping -a 9.1.2.1 8.1.1.1 Ping 8.1.1.1 (8.1.1.1) from 9.1.2.1: 56 data bytes, press CTRL_C to break 56 bytes from 8.1.1.1: icmp_seq=0 ttl=254 time=9.000 ms 56 bytes from 8.1.1.1: icmp_seq=1 ttl=254 time=4.000 ms 56 bytes from 8.1.1.1: icmp_seq=2 ttl=254 time=3.000 ms 56 bytes from 8.1.1.1: icmp_seq=3 ttl=254 time=3.000 ms 56 bytes from 8.1.1.1: icmp_seq=4 ttl=254 time=3.000 ms --- Ping statistics for 8.1.1.1 --- 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss round-trip min/avg/max/std-dev = 3.000/4.400/9.000/2.332 ms