Friday, April 12, 2013

Procurve - Configuring BGP all 0's route selection




AS-65008 SPH AS-65009
hostname "AS-65008" hostname "SPH" hostname "AS-65009"
ip route 0.0.0.0 0.0.0.0 blackhole ip route 90.1.1.0 255.255.255.0 blackhole ip route 0.0.0.0 0.0.0.0 blackhole
ip route 5.1.1.0 255.255.255.0 blackhole ip routing ip route 40.1.1.0 255.255.255.0 blackhole
ip route 10.1.1.0 255.255.255.0 blackhole ip route 50.1.1.0 255.255.255.0 blackhole
ip routing ip prefix-list "FROM_AS-65008" seq 5 permit 0.0.0.0 255.255.255.255 ip routing
ip prefix-list "FROM_AS-65008" seq 10 permit 5.1.1.0 255.255.255.0
interface loopback 0 ip prefix-list "TO_AS-65008" seq 10 permit 90.1.1.0 255.255.255.0 interface loopback 0
ip address 1.1.1.1 ip address 3.3.3.3
exit exit
ip prefix-list "FROM_AS-65009" seq 5 permit 0.0.0.0 255.255.255.255
router bgp 65008 ip prefix-list "FROM_AS-65009" seq 10 permit 50.1.1.0 255.255.255.0 router bgp 65009
enable ip prefix-list "TO_AS-65009" seq 10 permit 90.1.1.0 255.255.255.0 enable
bgp router-id 20.1.1.2 bgp router-id 30.1.1.2
bgp log-neighbor-changes interface loopback 0 bgp log-neighbor-changes
network 0.0.0.0 0.0.0.0 ip address 2.2.2.2 network 0.0.0.0 0.0.0.0
network 5.1.1.0 255.255.255.0 exit network 40.1.1.0 255.255.255.0
network 10.1.1.0 255.255.255.0 network 50.1.1.0 255.255.255.0
neighbor 20.1.1.1 remote-as 65009 router bgp 65009 neighbor 30.1.1.1 remote-as 65009
exit enable exit
bgp router-id 30.1.1.1
vlan 200 bgp log-neighbor-changes vlan 300
name "VLAN200" bgp maximum-prefix 20   name "VLAN300"
untagged 2 network 20.1.1.0 255.255.255.0 untagged 1
ip address 20.1.1.2 255.255.255.0 network 30.1.1.0 255.255.255.0 ip address 30.1.1.2 255.255.255.0
exit network 90.1.1.0 255.255.255.0 exit
neighbor 20.1.1.2 remote-as 65008
neighbor 20.1.1.2 route-map "FROM_AS-65008" in
neighbor 20.1.1.2 route-map "TO_AS-65008" out
neighbor 30.1.1.2 remote-as 65009
neighbor 30.1.1.2 route-map "FROM_AS-65009" in
neighbor 30.1.1.2 route-map "TO_AS-65009" out
exit
exit
vlan 200
name "VLAN200"
untagged 2
ip address 20.1.1.1 255.255.255.0
exit
vlan 300
name "VLAN300"
untagged 1
ip address 30.1.1.1 255.255.255.0
exit
route-map "FROM_AS-65008" permit seq 10
set local-preference 50
match ip address prefix-list "FROM_AS-65008"
exit
route-map "TO_AS-65008" permit seq 10
match ip address prefix-list "TO_AS-65008"
exit
route-map "FROM_AS-65009" permit seq 10
set local-preference 100
match ip address prefix-list "FROM_AS-65009"
exit
route-map "TO_AS-65009" permit seq 10
match ip address prefix-list "TO_AS-65009"
exit



SPH# show ip bgp route community

  Local AS            : 65009         Local Router-id  : 30.1.1.1
  BGP Table Version   : 2

  Status codes: * - valid, > - best, i - internal, e - external, s - stale
  Origin codes: i - IGP, e - EGP, ? - incomplete

     Network            Nexthop         Community
     ------------------ --------------- --------------------------------------
* e  0.0.0.0/0          20.1.1.2                                              ?
*>i  0.0.0.0/0          30.1.1.2                                              ?
*>e  5.1.1.0/24         20.1.1.2                                              ?
* e  10.1.1.0/24        20.1.1.2                                              ?
*>   20.1.1.0/24                                                              i
*>   30.1.1.0/24                                                              i
* i  40.1.1.0/24        30.1.1.2                                              ?
*>i  50.1.1.0/24        30.1.1.2                                              ?
*>   90.1.1.0/24                                                              ?



SPH# show ip route

                                        IP Route Entries

  Destination        Gateway         VLAN Type      Sub-Type   Metric     Dist.
  ------------------ --------------- ---- --------- ---------- ---------- -----
  0.0.0.0/0          20.1.1.2        200  bgp                  0          20
  2.2.2.2/32         lo0                  connected            1          0
  5.1.1.0/24         20.1.1.2        200  bgp                  0          20
  20.1.1.0/24        VLAN200         200  connected            1          0
  30.1.1.0/24        VLAN300         300  connected            1          0
  50.1.1.0/24        30.1.1.2        300  bgp                  0          200
  90.1.1.0/24        blackhole            static               1          1
  127.0.0.0/8        reject               static               0          0
  127.0.0.1/32       lo0                  connected            1          0


NOTE: The local prefernce shows in the bgp route table to prefer the route set with a local-pref of 100 (higher pref wins) but yet the ip route table shows the lower pref route.  The  LOCAL_PREF is a well know discretionary setting but only shared by  iBGP peers.  So even though the bgp table likes the route to the remote AS (65008) it is the ibgp route that makes it into the routing table (i'm not sure why this is) but is easily fixed by prepending or some other discretionary bgp setting


Using loop-back interfaces


A BGP Interface Cannot Communicate with a Neighbor. Unlike other routing protocols, BGP interfaces do not automatically search for and exchange routes with connected routers. You must manually configure authorized neighbors.

View the BGP neighbor and double-check its IP address:
ProCurve# show ip bgp neighbors

Ping the neighbor to check connectivity.
If the ping is successful, but the router does not seem to be exchanging BGP messages, you might need to configure eBGP multihop. External neighbors are supposed to be directly connected to the BGP interface. If they are not, you must specify the number of hops it is to the neighbor. For example:

ProCurve(config-bgp-neighbor)# ebgp-multihop 4

Remember that a loopback interface adds a hop to the route. Even if the external neighbor is directly connected, you must enable eBGP multihop if you are using the loopback interface as the source BGP interface.





1 comment:

  1. External route is selected because of HPs ProCurve BGP route selection logic, which is slightly different to Cisco. First it looks at admin distance of the route and selects route with lowest admin distance hence external BGP route wins.

    ReplyDelete

Please add comments so I may update the material to accommodate platform modification to various commands. Also if you have some real-world caveats, do please share.

Search Duke

About the Author

My photo
Central Florida, United States