Resources
    BGP Path Manipulation: Bo ...
    30 June 10

    BGP Path Manipulation: Bob is at it again...

    Posted byINE
    facebooktwitterlinkedin
    news-featured

    Summer was in full swing, and it was over 105 degrees Fahrenheit outside.   Bob was told it was a "dry heat", but he thought "so is my oven".  Needless to say, Bob was glad to be in the data center, where the temperature and humidity controls kept it very cold.   He had been asked to setup up a basic route-map with BGP, and here is the diagram he worked from.

    BGP Triangle
    The goal, was to modify BGP,  so that all traffic going towards the 1.1.1.0 network (which is sourced from AS1), traveling either from or through AS23, would only use the 13.0.0.0/24 segment (between R3 and R1), and not use the 10.0.0.0/24 segment (between R2 and R1) as a transit path.
    Bob reviewed some of the BGP topics he had recently learned.   Here is the list he made of possibilities:
    R1 could pre-pend to the AS path for advertisements of the 1.1.1.0/24 prefix when it is sent to R2 from R1.   This way, AS23 would see a better path through R3 rather than R2.  He tried this using the following on R1:

    ip prefix-list JUST-1.1.1.0 seq 5 permit 1.1.1.0/24
    

    route-map PRE-PEND permit 10
    match ip address prefix-list JUST-1.1.1.0
    set as-path prepend 1
    route-map PRE-PEND permit 20

    router bgp 1
    neighbor 10.0.0.2 route-map PRE-PEND out

    Bob cleared the BGP session, just to be sure.    Unfortunately, some traffic destined to 1.1.1.0 was still flowing over the 10.0.0.0 network between R2 and R1.

    Bob decided to try another approach, and instead of R1 trying to make AS23 think the path on 10.0.0.0 was worse, perhaps he would tell R3 to make the path on 13.0.0.0 look better.    He considered weight, but then realized that would only work for R3, and not every other device in AS23.    So Bob decided to use local-preference.  On R3, he tried using local-preference, to specify that when a BGP update came in from R1 for 1.1.1.0, R3 would set the local-preference to 250 for that prefix, in hopes that this would allow traffic destined for 1.1.1.0 go exclusively through the 13.0.0.0 segment between R3 and R1.   Unfortunately, even with this change, Bob noticed that traffic destined to 1.1.1.0 from our through AS23 still crossed on the link between R2 and R1.

    Below are the configurations for R1, R2 and R3 along with the relevant show commands.

    Can you assist Bob?   What can he do?  What did he do wrong, if anything?

    Post your ideas and comments below!

    R1:

    version 12.4
    hostname R1
    interface Loopback0
    ip address 1.1.1.1 255.255.255.0
    ip ospf network point-to-point

    interface FastEthernet0/0
    ip address 10.0.0.1 255.255.255.0
    ip ospf 1 area 1

    interface FastEthernet1/0
    ip address 13.0.0.1 255.255.255.0
    ip ospf 1 area 1

    router bgp 1
    no synchronization
    bgp log-neighbor-changes
    network 1.1.1.0 mask 255.255.255.0
    neighbor 10.0.0.2 remote-as 23
    neighbor 10.0.0.2 route-map PRE-PEND out
    neighbor 13.0.0.3 remote-as 23
    no auto-summary

    ip prefix-list JUST-1.1.1.0 seq 5 permit 1.1.1.0/24

    route-map PRE-PEND permit 10
    match ip address prefix-list JUST-1.1.1.0
    set as-path prepend 1

    route-map PRE-PEND permit 20

    R2:

    version 12.4
    hostname R2
    interface FastEthernet0/0
    ip address 10.0.0.2 255.255.255.0
    ip ospf 1 area 1

    interface FastEthernet0/1
    ip address 23.0.0.2 255.255.255.0
    ip ospf 1 area 1

    router bgp 23
    no synchronization
    bgp log-neighbor-changes
    neighbor 10.0.0.1 remote-as 1
    neighbor 23.0.0.3 remote-as 23
    no auto-summary
    !

    R3:

    version 12.4
    hostname R3
    interface FastEthernet0/0
    ip address 13.0.0.3 255.255.255.0
    ip ospf 1 area 1

    interface FastEthernet0/1
    ip address 23.0.0.3 255.255.255.0
    ip ospf 1 area 1

    router bgp 23
    no synchronization
    bgp log-neighbor-changes
    neighbor 13.0.0.1 remote-as 1
    neighbor 13.0.0.1 route-map SET-LOCAL-PREF in
    neighbor 23.0.0.2 remote-as 23
    no auto-summary

    ip prefix-list LOCAL-PREF-250 seq 5 permit 1.1.1.0/24

    route-map SET-LOCAL-PREF permit 10
    match ip address prefix-list LOCAL-PREF-250
    set local-preference 250

    route-map SET-LOCAL-PREF permit 20

    Show commands R1:

    R1#show ip bgp summary
    BGP router identifier 1.1.1.1, local AS number 1
    BGP table version is 2, main routing table version 2
    1 network entries using 120 bytes of memory
    1 path entries using 52 bytes of memory
    2/1 BGP path/bestpath attribute entries using 248 bytes of memory
    0 BGP route-map cache entries using 0 bytes of memory
    0 BGP filter-list cache entries using 0 bytes of memory
    Bitfield cache entries: current 1 (at peak 2) using 32 bytes of memory
    BGP using 452 total bytes of memory
    BGP activity 2/1 prefixes, 2/1 paths, scan interval 60 secs

    Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
    10.0.0.2        4    23      77      73        2    0    0 00:29:01        0
    13.0.0.3        4    23      74      74        2    0    0 00:29:01        0

    R1#show ip bgp
    BGP table version is 2, local router ID is 1.1.1.1
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
    r RIB-failure, S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete

    Network          Next Hop            Metric LocPrf Weight Path
    *> 1.1.1.0/24       0.0.0.0                  0         32768 i

    R1#show ip route | begin resort
    Gateway of last resort is not set

    1.0.0.0/24 is subnetted, 1 subnets
    C       1.1.1.0 is directly connected, Loopback0
    23.0.0.0/24 is subnetted, 1 subnets
    O       23.0.0.0 [110/2] via 13.0.0.3, 00:48:43, FastEthernet1/0
    [110/2] via 10.0.0.2, 00:48:09, FastEthernet0/0
    10.0.0.0/24 is subnetted, 1 subnets
    C       10.0.0.0 is directly connected, FastEthernet0/0
    13.0.0.0/24 is subnetted, 1 subnets
    C       13.0.0.0 is directly connected, FastEthernet1/0

    Show commands R2:

    R2#show ip bgp summary
    BGP router identifier 2.2.2.2, local AS number 23
    BGP table version is 14, main routing table version 14
    1 network entries using 120 bytes of memory
    2 path entries using 104 bytes of memory
    3/1 BGP path/bestpath attribute entries using 372 bytes of memory
    2 BGP AS-PATH entries using 48 bytes of memory
    0 BGP route-map cache entries using 0 bytes of memory
    0 BGP filter-list cache entries using 0 bytes of memory
    Bitfield cache entries: current 1 (at peak 2) using 32 bytes of memory
    BGP using 676 total bytes of memory
    BGP activity 1/0 prefixes, 4/2 paths, scan interval 60 secs

    Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
    10.0.0.1        4     1      73      77       14    0    0 00:29:07        1
    23.0.0.3        4    23      71      73       14    0    0 01:04:54        1

    R2#show ip bgp
    BGP table version is 14, local router ID is 2.2.2.2
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
    r RIB-failure, S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete

    Network          Next Hop            Metric LocPrf Weight Path
    *>i1.1.1.0/24       13.0.0.1                 0    250      0 1 i
    *                   10.0.0.1                 0             0 1 1 i

    R2#show ip route | begin resort
    Gateway of last resort is not set

    1.0.0.0/24 is subnetted, 1 subnets
    B       1.1.1.0 [200/0] via 13.0.0.1, 00:28:37
    2.0.0.0/24 is subnetted, 1 subnets
    C       2.2.2.0 is directly connected, Loopback0
    23.0.0.0/24 is subnetted, 1 subnets
    C       23.0.0.0 is directly connected, FastEthernet0/1
    10.0.0.0/24 is subnetted, 1 subnets
    C       10.0.0.0 is directly connected, FastEthernet0/0
    13.0.0.0/24 is subnetted, 1 subnets
    O       13.0.0.0 [110/2] via 23.0.0.3, 00:48:16, FastEthernet0/1
    [110/2] via 10.0.0.1, 00:49:19, FastEthernet0/0

    Show commands R3:

    R3#show ip bgp summary
    BGP router identifier 3.3.3.3, local AS number 23
    BGP table version is 6, main routing table version 6
    1 network entries using 120 bytes of memory
    1 path entries using 52 bytes of memory
    3/1 BGP path/bestpath attribute entries using 372 bytes of memory
    1 BGP AS-PATH entries using 24 bytes of memory
    0 BGP route-map cache entries using 0 bytes of memory
    0 BGP filter-list cache entries using 0 bytes of memory
    Bitfield cache entries: current 1 (at peak 2) using 32 bytes of memory
    BGP using 600 total bytes of memory
    BGP activity 1/0 prefixes, 5/4 paths, scan interval 60 secs

    Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
    13.0.0.1        4     1      74      74        6    0    0 00:29:09        1
    23.0.0.2        4    23      73      71        6    0    0 01:04:56        0

    R3#show ip bgp
    BGP table version is 6, local router ID is 3.3.3.3
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
    r RIB-failure, S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete

    Network          Next Hop            Metric LocPrf Weight Path
    *> 1.1.1.0/24       13.0.0.1                 0    250      0 1 i

    R3#show ip route | begin resort
    Gateway of last resort is not set

    1.0.0.0/24 is subnetted, 1 subnets
    B       1.1.1.0 [20/0] via 13.0.0.1, 00:28:39
    3.0.0.0/24 is subnetted, 1 subnets
    C       3.3.3.0 is directly connected, Loopback0
    23.0.0.0/24 is subnetted, 1 subnets
    C       23.0.0.0 is directly connected, FastEthernet0/1
    10.0.0.0/24 is subnetted, 1 subnets
    O       10.0.0.0 [110/2] via 23.0.0.2, 00:48:18, FastEthernet0/1
    [110/2] via 13.0.0.1, 00:48:48, FastEthernet0/0
    13.0.0.0/24 is subnetted, 1 subnets
    C       13.0.0.0 is directly connected, FastEthernet0/0

    Best wishes.

     

     

    And the answer is:

    Thanks to you, and your 50+ posts, bob got his answer.   By reading your responses, Bob learned the following:

    For R2, the BGP next hop for the best route, is still 13.0.0.1, even though it is learned from R3.     R3 doesn't bother to change the next-hop attribute when learning routes via a eBGP neighbor (R1).    With R2 having 2 equal cost paths (OSPF) for the next hop of 13.0.0.1, R2 would load balance the traffic over the 10.0.0.0 and 23.0.0.0 networks for traffic going to 1.1.1.0/24

    One solution would be to have R3 use next-hop-self for updates sent to R2.  Then R2 would see the next hop as 23.0.0.3, and all the traffic would be forwarded to R3 as desired.

    The update on R3 would look like this:

    router bgp 23
    neighbor 23.0.0.2 next-hop-self

    This would cause R2, to have the BGP table of this:

    R2#show ip bgp
    BGP table version is 4, local router ID is 2.2.2.2
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
    r RIB-failure, S Stale
    Origin codes: i - IGP, e - EGP, ? - incomplete

    Network          Next Hop            Metric LocPrf Weight Path
    *>i1.1.1.0/24       23.0.0.3                 0    250      0 1 i
    *                   10.0.0.1                 0             0 1 1 i

    Another option would be increasing the OSPF cost on R2's 10.0.0.0/24 interface, so that it wouldn't be considered an equal cost to get to 13.0.0.1 (the previous next hop before the change we just made).

    Thanks everyone for all your assistance!    You rock.

    © 2024 INE. All Rights Reserved. All logos, trademarks and registered trademarks are the property of their respective owners.
    instagram Logofacebook Logotwitter Logolinkedin Logoyoutube Logo