Configuration procedure

Procedure
  1. Configure IP addresses for interfaces (omitted.)
  2. Configure iBGP.
    1. To prevent route flapping caused by port state changes, this example uses loopback interfaces to establish iBGP connections.
    2. Because loopback interfaces are virtual interfaces, you need to use the
      peer connect-interface

      command to specify the loopback interface as the source interface for establishing BGP connections.

    3. Enable OSPF in AS 65009 to ensure that Switch B can communicate with Switch C through loopback interfaces.
  3. # Configure Switch B
    switch(config)# router bgp 65009
    switch(bgp)# bgp router-id 2.2.2.2
    switch(bgp)# neighbor 3.3.3.3 remote-as 65009
    switch(bgp)# exit
    switch(config)# router ospf
    switch(ospf)# enable
    switch(ospf)# area 0
    switch(ospf)# network 2.2.2.2/32
    switch(ospf)# network 9.1.1.1/24
    switch(ospf)# exit
    switch(config)# vlan 300
    switch(vlan-300)# ip ospf
    
  4. # Configure Switch C
    switch(config)# router bgp 65009
    switch(bgp)# bgp router-id 3.3.3.3
    switch(bgp)# neighbor 2.2.2.2 remote-as 65009
    switch(bgp)# neighbor 2.2.2.2 connect-interface loopback 0
    switch(bgp)# exit
    switch(config)# router ospf
    switch(ospf)# enable
    switch(ospf)# area 0
    switch(ospf)# network 3.3.3.3/32
    switch(ospf)# network 9.1.1.0/24
    switch(ospf)# exit
    switch(config)# vlan 300
    switch(vlan-300)# ip ospf
    switch(vlan-300)# show ip bgp summary
    
    Peer Information
    
    Remote Address Remote-AS Local-AS State Admin  Status
    -------------- --------- -------- ------------ -----
    2.2.2.2        65009     65009    Established  Start
    
  5. The output information shows that Switch C has established an iBGP peer relationship with Switch B.
  6. Configure eBGP.
    1. The eBGP peers, Switch A and Switch B (usually belonging to different carriers), are located in different ASs. Their loopback interfaces are not reachable to each other, so directly connected interfaces are used for establishing BGP sessions.
    2. To enable Switch C to access the network 8.1.1.0/24 that is connected directly to Switch A, add network 8.1.1.0/24 to the BGP routing table of Switch A.
  7. # Configure Switch A.
    switch(config)# router bgp 65008
    switch(bgp)# bgp router-id 1.1.1.1
    switch(bgp)# neighbor 3.1.1.1 remote-as 65009
    switch(bgp)# network 8.1.1.1/24
    switch(bgp)# exit
    
  8. # Configure Switch B.
    switch(config)# router bgp 65009
    switch(bgp)# neighbor 3.1.1.2 remote-as 65008
    switch(bgp)# exit
    
  9. # Show IP bgp peer information on Switch B.
    switch(config)# show ip bgp summary
    
    Peer Information
    
    Remote Address Remote-AS Local-AS State        Admin Status
    -------------- --------- -------- --------     ------------
    2.2.2.2        65009     65009    Established  Start
    3.1.1.2        65008     65009    Established  Start
    
  10. The output shows that Switch B has established an iBGP peer relationship with Switch C and an eBGP peer relationship with Switch A.
  11. # Display the BGP routing table on Switch A.
    switch(bgp)# show ip bgp
    
    Local AS : 100
    Local Router-id : 20.0.0.1
    BGP Table Version : 0
    Status codes: * - valid, > - best, i - internal, e -
    external, s - stale
    Origin codes: i - IGP, e - EGP, ? - incomplete
    
    Network          Nexthop  Metric LocalPref  Weight AsPath
    ----------------------------------------------------------
    *> 8.1.1.0/24                   0            32768    I
    *> 8.1.1.0/24     0.0.0.0       0               0     I
    
  12. # Display the BGP routing table on Switch B.
    switch# show ip bgp
    
    Local AS : 100
    Local Router-id : 20.0.0.1
    
    BGP Table Version  : 0
    Status codes: * - valid, > - best, i - internal, e - external, s - stale
    
    Origin codes: i - IGP, e - EGP, ? - incomplete
    
    Network        Nexthop  Metric LocalPref   Weight AsPath
    ---------------------------------------------------------
    *>e 8.1.1.0/24                0              0    65008i
    
  13. # Display the BGP routing table on Switch C.
    switch(bgp)# show ip bgp
    
    Local AS : 100
    Local Router-id : 20.0.0.1
    
    BGP Table Version  : 0
    Status codes: * - valid, > - best, i - internal, e - external, s - stale
    
    Origin codes: i - IGP, e - EGP, ? - incomplete
    
    Network         Nexthop    Metric LocalPref Weight AsPath
    ---------------------------------------------------------
    *>i 8.1.1.0/24                  0            0     65008i
    
    NOTE:

    From the above outputs, you see that Switch A has not learned a route to AS 65009, and Switch C has learned network 8.1.1.0 but the next hop 3.1.1.2 is unreachable, so the route is invalid.

  14. Redistribute connected routes.
  15. Configure BGP to redistribute direct routes on Switch B, so that Switch A can obtain the route to 9.1.1.0/24 and Switch C can obtain the route to 3.1.1.0/24.
  16. # Configure Switch B.
    switch(config)# router bgp 65009
    switch(bgp)# redistribute connected
  17. # Display the BGP routing table on Switch A.
    switch# show ip bgp
    
    Local AS : 65009
    Local Router-id : 1.1.1.1
    
    BGP Table Version  : 0
    Status codes: * - valid, > - best, i - internal, e - external, s - stale
    
    Origin codes: i - IGP, e - EGP, ? - incomplete
    
    Network         Nexthop    Metric LocalPref Weight AsPath
    ---------------------------------------------------------
    *>e 2.2.2.2/32  3.1.1.1        0             0     65009?
    *>e 3.1.1.0/24  3.1.1.1        0             0     65009?
    *>e 8.1.1.0/24                 0             0     65008i
    *>e 8.1.1.0/24                 0             0     65008i
    
    
  18. Two routes 2.2.2.2/32 and 9.1.1.0/24 have been added in Switch A’s routing table.
  19. # Display the BGP routing table on Switch C.
    switch(config)# show ip bgp
    
    Local AS : 65009
    Local Router-id : 3.3.3.3
    
    BGP Table Version  : 1
    
    Status codes: * - valid, > - best, i - internal, e - external, s - stale
    
    Origin codes: i - IGP, e - EGP, ? - incomplete
    
    Network         Nexthop Metric LocalPref Weight AsPath
    -------------------------------------------------------
    *>e 2.2.2.2/32   9.1.1.1           0      100     I
    *>e 3.1.1.0/24   9.1.1.1           0      100     I
    *>e 8.1.1.0/24                     0      0       65008i
    *e 9.1.1.0/24                      0      0       65008i
    *>e 9.1.1.0/24                     0      0       65008i
  20. Route 8.1.1.0 becomes valid with the next hop as Switch A.
  21. Verification.