How to Configure BGP Weight Attribute

(Rene Molenaar) #48

Hi Rawaz,

That is correct. The weight attribute defines the outgoing path but only for the local router. If you want to influence this for the entire AS, you can use the local preference attribute.

AS path prepending (or MED) can be used to influence inbound routing.

Rene

(Rene Molenaar) #49

@lagapides @sims

I used the same IP address on those loopbacks on purpose so that R2/R3 advertise the exact same thing in BGP. Otherwise, I could have added a fourth router in between R2/R3 with some loopbacks that were advertised in BGP.

Rene

(Arindom N) #51

Hi Rene,
Based on your last comments

when i am trying to useing same ip address(2.2.2.2) in loop back0 of R2 & R3 I am getting below mention error & the BGP state is is idle:

R3#
*Jul 18 21:48:05.895: %BGP-3-NOTIFICATION: sent to neighbor 192.168.23.2 passive 2/3 (BGP identifier wrong) 4 bytes 02020202
*Jul 18 21:48:05.895: %BGP-4-MSGDUMP: unsupported or mal-formatted message received from 192.168.23.2:
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0039 0104 0002 00B4 0202 0202 1C02 0601
0400 0100 0102 0280 0002 0202 0002 0246 0002 0641 0400 0000 02
R3#
*Jul 18 21:48:10.927: %BGP-5-NBR_RESET: Neighbor 192.168.23.2 passive reset (BGP Notification sent)
*Jul 18 21:48:10.927: %BGP-5-ADJCHANGE: neighbor 192.168.23.2 passive Down BGP Notification sent
*Jul 18 21:48:10.963: %BGP-3-NOTIFICATION: received from neighbor 192.168.23.2 active 2/3 (BGP identifier wrong) 4 bytes 02020202
*Jul 18 21:48:10.963: %BGP-5-NBR_RESET: Neighbor 192.168.23.2 active reset (BGP Notification received)
*Jul 18 21:48:10.963: %BGP-5-ADJCHANGE: neighbor 192.168.23.2 active Down BGP Notification received
*Jul 18 21:48:10.963: %BGP_SESSION-5-ADJCHANGE: neighbor 192.168.23.2 IPv4 Unicast topology base removed from session BGP Notification received
*Jul 18 21:48:14.091: %BGP-3-NOTIFICATION: sent to neighbor 192.168.23.2 passive 2/3 (BGP identifier wrong) 4 bytes 02020202
*Jul 18 21:48:14.091: %BGP-4-MSGDUMP: unsupported or mal-formatted message received from 192.168.23.2:
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0039 0104 0002 00B4 0202 0202 1C02 0601
0400 0100 0102 0280 0002 0202 0002 0246 0002 0641 0400 0000 02
*Jul 18 21:48:17.111: %BGP-3-NOTIFICATION: received from neighbor 192.168.23.2 active 2/3 (BGP identifier wrong) 4 bytes 02020202
*Jul 18 21:48:17.115: %BGP-5-NBR_RESET: Neighbor 192.168.23.2 active reset (BGP Notification received)
*Jul 18 21:48:17.115: %BGP-5-ADJCHANGE: neighbor 192.168.23.2 active Down BGP Notification received
*Jul 18 21:48:17.115: %BGP_SESSION-5-ADJCHANGE: neighbor 192.168.23.2 IPv4 Unicast topology base removed from session BGP Notification received

R2#
session BGP Notification received
*Jul 18 21:54:06.535: %BGP-5-NBR_RESET: Neighbor 192.168.23.3 passive reset (BGP Notification sent)
*Jul 18 21:54:06.535: %BGP-5-ADJCHANGE: neighbor 192.168.23.3 passive Down BGP Notification sent
*Jul 18 21:54:14.687: %BGP-3-NOTIFICATION: sent to neighbor 192.168.23.3 passive 2/3 (BGP identifier wrong) 4 bytes 02020202
*Jul 18 21:54:14.687: %BGP-4-MSGDUMP: unsupported or mal-formatted message received from 192.168.23.3:
FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF 0039 0104 0002 00B4 0202 0202 1C02 0601
0400 0100 0102 0280 0002 0202 0002 0246 0002 0641 0400 0000 02
*Jul 18 21:54:14.763: %BGP-3-NOTIFICATION: received from neighbor 192.168.23.3 active 2/3 (BGP identifier wrong) 4 bytes 02020202
*Jul 18 21:54:14.763: %BGP-5-NBR_RESET: Neighbor 192.168.23.3 active reset (BGP Notification received)
*Jul 18 21:54:14.763: %BGP-5-ADJCHANGE: neighbor 192.168.23.3 active Down BGP Notification received
*Jul 18 21:54:14.763: %BGP_SESSION-5-ADJCHANGE: neighbor 192.168.23.3 IPv4 Unicast topology base removed from session BGP Notification received
*Jul 18 21:54:14.763: %BGP-3-NOTIFICATION: received from neighbor 192.168.23.3 active 2/3 (BGP identifier wrong) 4 bytes 02020202

after change the loopback ip address of R3 the BGP state is getting up so i think its due to same IP address in loopback of both R2 & R3 Routre id getting same & the session is getting up am i right Rene ? plz find the below details.

R3#sh ip inter brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.23.3 YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
FastEthernet1/0 192.168.13.3 YES manual up up
FastEthernet1/1 unassigned YES unset administratively down down
Loopback0 2.2.2.2 YES manual up up
R3#sh ip bgp summary
BGP router identifier 2.2.2.2, local AS number 2
BGP table version is 2, main routing table version 2
1 network entries using 144 bytes of memory
1 path entries using 80 bytes of memory
1/1 BGP path/bestpath attribute entries using 136 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
BGP using 360 total bytes of memory
BGP activity 4/3 prefixes, 8/7 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.13.1 4 1 37 35 2 0 0 00:28:55 0
192.168.23.2 4 2 0 0 1 0 0 00:28:56 Idle
R3(config)#inter loopback 0
R3(config-if)#no ip add
R3(config-if)#no ip address
R3(config-if)#ip add
R3(config-if)#ip address 2.2.2.3 255.255.255.0
R3(config-if)#end
R3#clear ip bgp *

R3#sh ip bgp summary
BGP router identifier 2.2.2.3, local AS number 2
BGP table version is 1, main routing table version 1
1 network entries using 144 bytes of memory
1 path entries using 80 bytes of memory
2/0 BGP path/bestpath attribute entries using 272 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
BGP using 496 total bytes of memory
BGP activity 5/4 prefixes, 10/9 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.13.1 4 1 6 2 1 0 0 00:00:03 0
192.168.23.2 4 2 5 2 1 0 0 00:00:00 1

And as per your 2nd example when using ip address 22.22.22.22 in both R2 & R3 as a loopback getting same error bcz 22.22.22.22 is the highest ip address of loop back so as based on router Id selection process its correct but the BGP session is not up between R2 & R3.

Am i right Rene?i think you should fix this :smiley: waiting for your valuable answer.
Thanks & Regards,
Arindom

(Rene Molenaar) #52

Hi Arindom,

Take a look at this message:

BGP identifier wrong

And this output:

R3#sh ip bgp summary
BGP router identifier 2.2.2.2, local AS number 2

The problem is that both routers probably have the same BGP router ID. Try setting the router ID manually and it should be OK. BGP uses the IP address of the loopback as the router ID so that’s where it goes wrong.

Rene

(Arindom N) #53

Hi Rene,
Thanks for replying me…yes after set the router id in R3 now everything is up and not getting identifier error:smiley:

R3#sh running-config | include bgp
router bgp 2
 bgp router-id 1.1.1.1
 bgp log-neighbor-changes

R3#sh ip bgp summary
BGP router identifier 1.1.1.1, local AS number 2
BGP table version is 1, main routing table version 1
2 network entries using 288 bytes of memory
2 path entries using 160 bytes of memory
2/0 BGP path/bestpath attribute entries using 272 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
BGP using 720 total bytes of memory
BGP activity 6/4 prefixes, 8/6 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.13.1    4            1       6       2        1    0    0 00:00:05        0
192.168.23.2    4            2       5       2        1    0    0 00:00:03        2


R3#sh ip inter brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        192.168.23.3    YES NVRAM  up                    up
FastEthernet0/1        unassigned      YES NVRAM  administratively down down
FastEthernet1/0        192.168.13.3    YES NVRAM  up                    up
FastEthernet1/1        unassigned      YES NVRAM  administratively down down
Loopback0              2.2.2.2         YES manual up                    up
Loopback1              22.22.22.22     YES NVRAM  up                    up


---------------------------------------------------------------------------------------------

R2#sh ip bgp summary
BGP router identifier 22.22.22.22, local AS number 2
BGP table version is 3, main routing table version 3
2 network entries using 288 bytes of memory
3 path entries using 240 bytes of memory
2/1 BGP path/bestpath attribute entries using 272 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
BGP using 800 total bytes of memory
BGP activity 2/0 prefixes, 3/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
192.168.12.1    4            1       5       5        3    0    0 00:01:18        0
192.168.23.3    4            2       5       5        3    0    0 00:01:12        1


R2#sh ip inter brief
Interface              IP-Address      OK? Method Status                Protocol
FastEthernet0/0        192.168.12.2    YES NVRAM  up                    up
FastEthernet0/1        unassigned      YES NVRAM  administratively down down
FastEthernet1/0        192.168.23.2    YES NVRAM  up                    up
FastEthernet1/1        unassigned      YES NVRAM  administratively down down
Loopback0              2.2.2.2         YES NVRAM  up                    up
Loopback1              22.22.22.22     YES NVRAM  up                    up


R2#sh running-config | include bgp
router bgp 2
 bgp log-neighbor-changes

Then conclusion is if we want to use same loop back address in both router then 1st we should set the BGP router id(Like ospf) for specific identification, should not go for normal Router ID election process am i right Rene?

Thanks & Regards,
Arindom

(Arindom N) #54

Hi Rene,
Thanks for replying me…yes after set the router id in R3 now everything is up and not getting identifier error:smiley:

R3#sh running-config | include bgp
router bgp 2
bgp router-id 1.1.1.1
bgp log-neighbor-changes

R3#sh ip bgp summary
BGP router identifier 1.1.1.1, local AS number 2
BGP table version is 1, main routing table version 1
2 network entries using 288 bytes of memory
2 path entries using 160 bytes of memory
2/0 BGP path/bestpath attribute entries using 272 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
BGP using 720 total bytes of memory
BGP activity 6/4 prefixes, 8/6 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.13.1 4 1 6 2 1 0 0 00:00:05 0
192.168.23.2 4 2 5 2 1 0 0 00:00:03 2

R3#sh ip inter brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.23.3 YES NVRAM up up
FastEthernet0/1 unassigned YES NVRAM administratively down down
FastEthernet1/0 192.168.13.3 YES NVRAM up up
FastEthernet1/1 unassigned YES NVRAM administratively down down
Loopback0 2.2.2.2 YES manual up up
Loopback1 22.22.22.22 YES NVRAM up up

R2#sh ip bgp summary
BGP router identifier 22.22.22.22, local AS number 2
BGP table version is 3, main routing table version 3
2 network entries using 288 bytes of memory
3 path entries using 240 bytes of memory
2/1 BGP path/bestpath attribute entries using 272 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
BGP using 800 total bytes of memory
BGP activity 2/0 prefixes, 3/0 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.12.1 4 1 5 5 3 0 0 00:01:18 0
192.168.23.3 4 2 5 5 3 0 0 00:01:12 1

R2#sh ip inter brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.12.2 YES NVRAM up up
FastEthernet0/1 unassigned YES NVRAM administratively down down
FastEthernet1/0 192.168.23.2 YES NVRAM up up
FastEthernet1/1 unassigned YES NVRAM administratively down down
Loopback0 2.2.2.2 YES NVRAM up up
Loopback1 22.22.22.22 YES NVRAM up up

R2#sh running-config | include bgp
router bgp 2
bgp log-neighbor-changes

Then conclusion is if we want to use same loop back address in both router then 1st we should set the BGP router id(Like ospf) for specific identification, should not go for normal Router ID election process am i right Rene?

and one thing Rene in your topology picture 'How to configure BGP Weight Attribute" between R2(FastEthernet1/0) & R3(FastEthernet0/0) you didn’t add any IP address in topology picture How%20to%20configure%20BGP%20Weight%20Attributebut in lesson you add when you configured so if you don’t mind here i want to give you a suggestion please add then it will good for the topology picture.:smile:

Thanks & Regards,
Arindom

1 Like
(bahri a) #55

Hi
i received notification msg but configuration is true

R2#show run | begin bgp
router bgp 2
 bgp log-neighbor-changes
 network 2.2.2.0 mask 255.255.255.0
 neighbor 192.168.12.1 remote-as 1
 neighbor 192.168.23.3 remote-as 2

router bgp 2
 bgp log-neighbor-changes
 neighbor 192.168.13.1 remote-as 1
 neighbor 192.168.23.2 remote-as 2
!


*Aug 20 16:57:54.777: %BGP-3-NOTIFICATION: received from neighbor 192.168.23.3 a^ctive 2/3 (BGP identifier wrong) 4
(bahri a) #56

thanks everybody i solved it
router-id conflict
took the same id
i shutdown interface than i changed router- id

(Arindom N) #57

Hi Bahiri,
Good job:+1:you solved this

If you read the above messages you can able to see i did same mistake then Rene rectify me:smile:

Thanks & Regards,
Arindom

(bahri a) #58

Hi arindom.nag
thanks alot your recommend

(Arindom N) #59

Welcome Bahria :smile:

(bahri a) #60

welcome arindom.nag :smile:

(champion n) #61

Hi Rene,

Probably a bit of a retarded/basic question., but please could you explain why you did the following below - regarding BGP Weight PA.:

You used the following:

R1(config)#route-map SETWEIGHT permit 10
R1(config-route-map)#match ip address 1
R1(config-route-map)#set weight 400
R1(config-route-map)#exit
R1(config)#route-map SETWEIGHT permit 20
R1(config-route-map)#set weight 0
R1(config-route-map)#exit
R1(config)#access-list 1 permit 22.22.22.0 0.0.0.255

R1(config-router)#neighbor 192.168.13.3 route-map SETWEIGHT in

Why did you use two permit statements and why was it applied to the “in” direction?

Many Thanks

(Lazaros Agapides) #62

Hello Champion

This route map has two steps. Both steps have permit clauses because if a match occurs, we want to be able to modify the weight attribute of that match and send it on its way. If there were deny clauses and a match occurred, even if the weight was changed, the particular path would be blocked. So by having permit statements, we are allowing that specific path AND we are thus able to change its weight attribute.

Secondly, there are two permit statements because we want to classify traffic from a particular subnet. Specifically the 22.22.22.0/24 subnet. The first permit statement attempts to match this IP address. If it matches, then the weight of that path is set to 400. The second permit statement is for all other traffic that does not match this ACL. Those destinations are classified with a weight of 0. Thus we are giving preferential treatment, or more weight, to routes matching the 22.22.22.0/24 destination.

Finally, the in/out direction of the application of route maps for BGP neighbors is a bit confusing. The rule of thumb is this: Applying inbound route-map influences outbound traffic and applying outbound route-map influences inbound traffic.

I hope this has been helpful!

Laz

(champion n) #63

Hey Lagapides,

Thank you so much. This cleared up a lot for me. Especially the “in” and “out” issue.

Regards

1 Like
(champion n) #64

Hi Lagapides,

If I were to follow the rule of thumb of “in” for outbound and “out” for inbound for BGP PAs, why is this different for AS-Path prepending, if according to Cisco AS path prepending is for outbound traffic.

R1(config)#route-map PREPEND permit 10
R1(config-route-map)#set as-path prepend 1 1 1 1 1
R1(config-route-map)#exit
R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 route-map PREPEND out

Thanks

(Lazaros Agapides) #65

Hello Champion

My apologies, you’re absolutely right, I should have been clearer. This rule of thumb is only applied to the application of route maps for BGP neighbors when applying it to the weight and local pref attribute. It is not the case when applied to other parameters such as AS_PATH. The reason for this is that both weight and local pref are attributes that are local to the router and not shared.

Think about it this way: the direction for weight and local pref has to do with the direction of information you learn. You only learn info that comes into the interface.

I hope this has been helpful!

Laz

(Emmanuel) #66

Is the second permit statement necessary? Won’t other prefixes outside of the matching ACL be assigned the default weight value?

Please clarify.

Thanks

(Lazaros Agapides) #67

Hello Billing

There are two purposes to the second permit statement. The first is that route maps have an implicit deny statement at the end. This means that if there was only one permit statement, then all prefixes outside the matching ACL would simply be denied. Secondly, the second permit statement resets the weight of any other routes received to 0, so that any changes to weight made downstream are cancelled out here.

I hope this has been helpful!

Laz

1 Like
(harshit singh r) #68

lagapides sir
I am confuse little bit u have applied 2 permit statement but i can do the same work with 1 permit statement you have used SETWEIGHT 0 why you use it if i am not using this permit statement my connection is working and in bgp table i can see all network go by 192.168.12.0 path with weight 0 and 22.22.22.0 by setweight 400 routemap please clarify this permit statement see below :

   Network          Next Hop            Metric LocPrf Weight Path
*> 2.2.2.0/24       192.168.12.2             0             0 2 i
*> 3.3.3.0/24       192.168.12.2             0             0 2 i
*> 4.4.4.0/24       192.168.12.2             0             0 2 i
*  5.5.5.0/24       192.168.12.2                           0 2 i
*>                        192.168.13.3             0             200 2 i

sir but when i follow both permit command then 192.168.13.0 link add in bgp table see below:

   Network          Next Hop            Metric LocPrf Weight Path
*> 2.2.2.0/24       192.168.12.2             0             0 2 i
*                   192.168.13.3             0             0 2 i
*> 3.3.3.0/24       192.168.12.2             0             0 2 i
*                   192.168.13.3             0             0 2 i
*> 4.4.4.0/24       192.168.12.2             0             0 2 i
*                   192.168.13.3                           0 2 i
*  5.5.5.0/24       192.168.12.2                           0 2 i
*>                  192.168.13.3             0           200 2 i

sir please clear it