6 Replies Latest reply: May 22, 2019 12:21 PM by Samer RSS

    BGP Attributes

    Srikanth

      Dear All,

       

      Can anybody please explain the difference in applying attributes on inbound and outboud prefixes,

       

      WEight

      Local pref

      AS path prepend

      Med

       

      Thanks in advance

      Srikanth

        • 1. Re: BGP Attributes
          jh

          The difference would generally be between what you are receiving/sending from/to your neighbor, but I suppose that's obvious from the wording of your question i.e. inbound/outbound. You might want to clarify your question, possibly with an example.

          • 3. Re: BGP Attributes
            Luke

            You would use local pref and weight to select an outbound path.

            You would use AS-Path prepending and MED to influence the inbound traffic.

             

            When you receive a prefix, you can apply a local pref value to it. This is transitive, so other routers will learn what you set. This is used to select the egress point from your network.

            Weight is local to a router, so you could use that if a single router has multiple egress links, and you want to prefer one of them.

             

            AS-Path prepending changes the length of the AS-Path on prefixes that you advertise. So, when someone receives your prefixes, they will choose the one with the shorter prefix.

             

            MED is non-transitive, which is why AS-Path is usually preferred.

            • 4. Re: BGP Attributes
              Samer

              Srikanth wrote:

               

              Dear All,

               

              Can anybody please explain the difference in applying attributes on inbound and outboud prefixes,

               

              WEight

              Local pref

              AS path prepend

              Med

              Hi Srikanth,

               

              for example check following image:

              if you want to go from SWITCH-A to SWITCH-B using the R8, you can use the Local preference or weight (inbound if you set for specific prefix) or set as default local preference which will apply to all inbound, on R8 to be higher so SWITCH-A will prefer it over the path coming from R7, even though you did this, it wouldn't guarantee the return traffic would be coming back from to R8, so in this case what to do? well, you can configure R7 to send fake AS path outbound direction to fool AS45 that the AS path via R4 to R7 is longer and this is done by using route-map as below

              route-map AS-PATH-PREPREND

              set as-path prepend 78 78 78

              router bgp 78

              neighbor 74.0.0.4 route-map AS-PATH-PREPEND out     \\assuming  74.0.0.4 is R4

               

              by this configuration, R4 will start getting prefixes from R7 but with (AS-path 78 78 78) while R8 will get only one AS (78) from prefixes received from R5

              by this you have configured how to go out and in from your AS-path

               

              Screen Shot 2019-05-20 at 10.45.18 AM.png

               

              how to set weight:

              R8:

              router bgp 78

              nei 85.0.0.5 weight 40000 (default value is 0)

               

              how to set local preference:

               

              R8

              bgp default local-preference 1000 (the default is 100)

              or use route-map

              route-map LOCAL-PREF

              set local pref 1000

              router bgp 78

              neighbor 85.0.0.5 route-map LOCAL-PREF in

               

               

              now regarding the preference of these attributes the following is good table:

               

              PriorityAttribute
              1Weight
              2Local Preference
              3Originate
              4AS path length
              5Origin code
              6MED
              7eBGP path over iBGP path
              8Shortest IGP path to BGP next hop
              9Oldest path
              10Router ID
              11Neighbor IP address

              source of this table is :networklessons.com

              BGP Attributes and Path Selection | NetworkLessons.com

               

               

              note the path attributes above might be different on other vendors, for example weight is Cisco's proprietary attribute.

              I hope you find this helpful.

               

              thanks

              • 5. Re: BGP Attributes
                Srikanth

                Hi Samer,

                 

                Thanks as lot for your wonderful explanation,

                 

                Please clarify

                Inbound routes are routes which we receive from external routers

                outbound are locally generated routes from our lan

                 

                Regards

                Srikanth

                • 6. Re: BGP Attributes
                  Samer

                  You are welcome,

                   

                  Srikanth wrote:


                  Please clarify

                  Inbound routes are routes which we receive from external routers

                  outbound are locally generated routes from our lan

                   

                  Let's say we have R1===iBGP===R2====EBGP===R3===iBGP===R4

                   

                  basically if we say

                  #route-map LP

                  #set local-preference 1999

                  #neighbor 23.0.0.2 route-map LP in configured on R3 BGP and 23.0.0.2 is R2 interface facing R3

                   

                  this means applying route-map LP inbound direction which means LP will not be sent to 23.0.0.2 but R4 will get the local preference

                  you can also do the same on R3 outbound if you done #neighbor 34.0.0.4 route-map LP out  (34.0.0.4 is R4 interface)

                   

                  so as you can see, we are talking about the direction of the policy when its applied, and not where the traffic is originated.