BGP Attribute Local Preference


Scenario:

You work as a network engineer for a laboratium in San Francisco which is specialized in genetic engineering. To exchange research information with other laboratoria and universities you have built a network using BGP. At this moment you have not configured any path selection for BGP and you want to make sure you have a little more control to influence your routing. Local preference is one of the BGP attributes that you are going to use to fix this.

Goal:

  • All IP addresses have been preconfigured for you as specified in the topology picture.
  • Configure IBGP within AS 1.
  • Configure EBGP between router Franklin and Jacobs.
  • Configure EBGP between router Jacobs and Pinto.
  • Configure EBGP between router Pinto and Franco.
  • Configure EBGP between router Hunisker and Franco.
  • Advertise all networks from AS1, AS2, AS3 and AS4 in BGP.
  • Ensure AS1 can reach any network in AS2, AS3 or AS4.
  • You are only allowed to use the local preference attribute for the upcoming tasks.
  • Configure router Franklin so all networks learned through EBGP have a local preference of 500.
  • Configure router Hunisker so network 6.6.6.0/24 has a local preference of 600.
  • Configure router Hunisker so all networks from AS 4 have a local preference of 700.
  • Configure router Hunisker so network 66.66.66.0/24 has a local preference of 800, you are not allowed to use an access-list.

It took me 1000s of hours reading books and doing labs, making mistakes over and over again until I mastered all the routing protocols for CCNP.

Would you like to be a master of routing too? In a short time without having to read 900 page books or google the answers to your questions and browsing through forums?

I collected all my knowledge and created a single ebook for you that has everything you need to know to become a master of routing.

You will learn all the secrets about BGP attributes, local preference and more.

Does this sound interesting to you? Take a look here and let me show you how to Master CCNP ROUTE

IOS:

c3640-jk9o3s-mz.124-16.bin

Topology:

BGP Attribute Local Preference

Video Solution:

Configuration Files

You need to register to download the GNS3 topology file. (Registration is free!)

Once you are logged in you will find the configuration files right here.

Opt In Image
Do you want your CCNA or CCNP Certificate?

The How to Master series helps you to understand complex topics like spanning-tree, VLANs, trunks, OSPF, EIGRP, BGP and more.

Written by René Molenaar - CCIE #41726

You May Also Like

About the Author: Rene Molenaar

René - CCIE #41726 is the creator of GNS3Vault.com where he shares CCNA, CCNP and CCIE R&S labs. He also blogs about networking on http://networklessons.com

24 Comments

  1. It’s a good lab. Yes, I like it. But, unfortunately, I don’t see any discussion here. So, I have aquestion.
    What is the point of tuning Local preference on Hunisker router for network 1.1.1.0/24 which is internal for AS1.

  2. “Configure router Hunisker so network 1.1.1.0/24 has a local preference of 800, you are not allowed to use an access-list.”

    I am have diffululty with this last step. Can someone help me.
    router bgp 1
    no synchronization
    bgp log-neighbor-changes
    neighbor 1.1.1.1 remote-as 1
    neighbor 1.1.1.1 update-source Loopback0
    neighbor 1.1.1.1 route-map R1 in
    neighbor 2.2.2.2 remote-as 1
    neighbor 2.2.2.2 update-source Loopback0
    neighbor 2.2.2.2 next-hop-self
    neighbor 3.3.3.3 remote-as 1
    neighbor 3.3.3.3 update-source Loopback0
    neighbor 3.3.3.3 next-hop-self
    neighbor 3.3.3.3 route-map localR6 in
    neighbor 7.7.7.7 remote-as 4
    neighbor 7.7.7.7 ebgp-multihop 2
    neighbor 7.7.7.7 update-source Loopback0
    neighbor 7.7.7.7 route-map AS4 in
    no auto-summary
    ip prefix-list 2 seq 5 permit 1.1.1.0/24 le 32
    access-list 1 permit 6.6.6.0 0.0.0.255
    access-list 1 permit 7.7.7.0 0.0.0.255
    !
    !
    !
    route-map localR6 permit 10
    match ip address 1
    set local-preference 600
    !
    route-map localR6 permit 20
    !
    route-map AS4 permit 10
    match ip address 1
    set local-preference 700
    !
    route-map AS4 permit 20
    !
    route-map R1 permit 10
    match ip address 1
    set local-preference 800
    !
    route-map R1 permit 20

  3. I beleive the last step cannot work.
    In the lasb it states to only advertise routes into BGP for AS2-4 not AS1. This is why you will not show any internet networks in BGP “show ip bgp.” Therefore, you cannot set local pref, to 1.1.1.0 network.

  4. Sorry, I didn’t realize about the configuration’s file that it’s included here.

  5. Done,

    How do you expect to apply a BGP route policy to the network 1.1.1.0/24 which is only in the IGP table????

    Only the routers FRANKLIN and HUNISKER have different configuration.

    ##############################################################
    !
    hostname FRANKLIN
    !
    router bgp 1
    bgp default local-preference 500
    neighbor 1.1.1.1 remote-as 1
    neighbor 1.1.1.1 update-source Loopback0
    neighbor 1.1.1.1 next-hop-self
    neighbor 2.2.2.2 remote-as 1
    neighbor 2.2.2.2 update-source Loopback0
    neighbor 2.2.2.2 next-hop-self
    neighbor 4.4.4.4 remote-as 1
    neighbor 4.4.4.4 update-source Loopback0
    neighbor 4.4.4.4 next-hop-self
    neighbor 5.5.5.5 remote-as 2
    neighbor 5.5.5.5 ebgp-multihop 2
    neighbor 5.5.5.5 update-source Loopback0
    neighbor 5.5.5.5 default-originate
    !
    ##############################################################
    !
    hostname HUNISKER
    !
    router bgp 1
    neighbor 1.1.1.1 remote-as 1
    neighbor 1.1.1.1 update-source Loopback0
    neighbor 1.1.1.1 next-hop-self
    neighbor 2.2.2.2 remote-as 1
    neighbor 2.2.2.2 update-source Loopback0
    neighbor 2.2.2.2 next-hop-self
    neighbor 3.3.3.3 remote-as 1
    neighbor 3.3.3.3 update-source Loopback0
    neighbor 3.3.3.3 next-hop-self
    neighbor 3.3.3.3 route-map AS4-NETWORK6 in
    neighbor 7.7.7.7 remote-as 4
    neighbor 7.7.7.7 ebgp-multihop 2
    neighbor 7.7.7.7 update-source Loopback0
    neighbor 5.5.5.5 default-originate
    neighbor 7.7.7.7 route-map AS4-NETWORK6 in
    !
    ip as-path access-list 1 permit ^4$
    !
    access-list 1 permit 6.6.6.0 0.0.0.255
    !
    route-map AS4-NETWORK6 permit 10
    match ip address 1
    set local-preference 600
    !
    route-map AS4-NETWORK6 permit 20
    match as-path 1
    set local-preference 700
    !
    route-map AS4-NETWORK6 permit 30
    !
    ##############################################################

  6. For HUNISKER, the next line shouldn’t be there, I made a mistake when I copied from Notepad.

    neighbor 5.5.5.5 default-originate

    It should:

    neighbor 7.7.7.7 default-originate

  7. Hi Guys,

    This lab had one of my monday-morning errors ;D Network 1.1.1.0/24 is internal to AS 1 so this task didn’t make any sense. I just changed it and also created the final configurations + Video solution. Let me know if you still have any questions.

    Rene

  8. hey mate, could you please up the topology files again thanks.
    i cant seem to find the link to it.
    thanks..

  9. Excellent lab as usual. Had me thinking for a bit.

    •Configure router Hunisker so network 6.6.6.0/24 has a local preference of 600.
    •Configure router Hunisker so all networks from AS 4 have a local preference of 700.

    I saw you only apply the route-map to 192.168.47.7 inward but I think it should also be applied to neighbor Franklin because there is a possibility that Franklin also can advertise these routes if there is an issue with the link between Franco.

    The only reason why Hunisker doesn’t have it in its table right now is because Franklin withdrawn it since Hunisker is telling him he has a better one but if you check you will see that the route is being received from Jacobs.

    Also, Advertise all networks from AS1, AS2, AS3 and AS4 in BGP did you mean to advertise with IGP or BGP? I used BGP because at the end it will end up in the BGP table only difference is that when you redistribute, it will show as ? which can have a penality with path selection

    1. Yeah I didn’t really understand that part either. It works but there’s a chance the localpref can change if that neighbor fails. In that case though it would still work because if the neighbor fails, there is only one other path to leave out of. I think maybe I just answered my own confusion.

  10. hi rene,
    i’m a little confused. when connecting ebgp, why did you use the fast eithernet links on the neighbor command and not the loopbacks with the ebgp-multihop command? is there an advantage with either one? thanks.
    adrian

  11. Hi,
    I have a problem with basic config of eBGP in this topo. I have configured eBGP neighbors with loopback interfaces(and also ebgp multihop and proper source) but the thing that happens is that router Hunisker is sending packet properly through 192.168.47.0 network. But Franco is sending all the way long through 192.168.67.0 network according to “best match rule”, here is the part of RT:

    4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
    B 4.4.4.4/32 [20/0] via 6.6.6.6, 00:26:43
    S 4.4.4.0/24 [1/0] via 192.168.47.4

    SInce ebgp-multihops is set to two hops, it never reaches the Hunisker.

    I can ping Huniskers loopback from 7.7.7.7, but by the longer way.

    The same problem would probably occur with route to Franklin and Jacobs but since Hunisker cannot even advertise its routes by eBGP, Franklin – Jacobs neighbor state is established.

    BTW – originator of this mess is probably router Franklin:
    4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
    O 4.4.4.4/32 [110/2] via 192.168.34.4, 01:42:45, FastEthernet1/0
    B 4.4.4.0/24 [200/0] via 4.4.4.4, 00:00:22

    But I dont know what to do with that and not using filtering or maybe set ospf interface type to p2p so no /24 prefix is advertised, is this setup even possible?
    Can you please explain how to set the eBGP with loopbacks? Thank you.

    PS: Tried also loopback addreses in eBGP in MED lab but its the similar problem, even if OSPF is set to P2P, so is really reommended to use loopbacks in eBGP?

  12. hello ,can someone help me..I have configure the IBGP & EBGP & also advertise all the networks & use command redistribute ospf on router Franklin & hunisker but i am not able to ping the loopback address of AS2,3,4 from AS1.

  13. On question:
    Configure router Hunisker so all networks from AS 4 have a local preference of 700.

    I intepreted all the networks configured in router Franco, not necesarily the ones announced by Franco. Maybe you can make that modification. Thank you

  14. I have a question:

    Because the routers Franklin, Hunisker, Jacobs, Pinto and Franco “weight” appears as 32768 on some routes?
    I know that in CISCO connections, the weight is included with the standard 32768, but did not understand then why not display weight in Rodman and Landon.
    Someone could better explain this fact?

    1. The only routes that will have a weight of 32768 are the routes through a router’s loopbacks. I haven’t read about it, but since weight is the first attribute that BGP compares to find the best route, a weight of 32768 will act as a safeguard to make sure that a router’s path to the network on its own loopback will always be the chosen one.

      For instance, if Rodman’s path to network 1.1.1.0 via its loopback had a weight of 0, BGP would continue to compare the route through the loopback to other possible routes to 1.1.1.0 (ex: Rodman to Franklin to Hunisker to Landon and back to Rodman again).

      That said, I don’t know why they just don’t set the default to full max of 65535.

Comments are closed.