Description

The article explains the BGP export policy behavior, this includes why sometimes BGP session flaps, sometimes not after applying the BGP export policy.

Symptoms

BGP neighbor/session flap after adding/deleting the BGP export policy.

Solution




BGP Export policy behavior and BGP session flaps after applying the policy




<-- In normal state there are 5 peers, and no export policy applied either at group level or peer level




test@router> show bgp group   




Warning: License key missing; requires 'bgp' license




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 0      Flags: <>

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 5    Established: 1

 10.1.1.1+179

 10.1.2.1

 10.1.3.1

 10.1.4.1

 10.1.5.1

 inet.0: 0/0/0/0




Groups: 1 Peers: 5  External: 0  Internal: 5  Down peers: 4  Flaps: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0




            0     0     0     0     0     0




<-- one export policy DENY-ALL was configured at the group level, so applies to all peers. 




test@router> show bgp group   




Warning: License key missing; requires 'bgp' license




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 0      Flags: <Export Eval>

 Export: [ DENY-ALL ] <<<<<<<<<< pls refer here 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 5    Established: 5

 10.1.1.1+179

 10.1.2.1+179

 10.1.3.1+179

 10.1.4.1+179

 10.1.5.1+179

 inet.0: 0/0/0/0




Groups: 1 Peers: 5  External: 0  Internal: 5  Down peers: 0  Flaps: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0




<-- None of the BGP sessions flapped, this is expected and correct behavior. As all bgp peers has the same export policy.




test@router> show bgp summary 




Warning: License key missing; requires 'bgp' license




Threading mode: BGP I/O

Default eBGP mode: advertise - accept, receive - accept

Groups: 1 Peers: 5 Down peers: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0

Peer           AS   InPkt   OutPkt  OutQ  Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...

10.1.1.1       20940     8     6    0    0    2:25 Establ

 inet.0: 0/0/0/0

10.1.2.1       20940     8     6    0    0    2:21 Establ

 inet.0: 0/0/0/0

10.1.3.1       20940     7     6    0    0    2:17 Establ

 inet.0: 0/0/0/0

10.1.4.1       20940     7     6    0    0    2:13 Establ

 inet.0: 0/0/0/0

10.1.5.1       20940     7     6    0    0    2:09 Establ

 inet.0: 0/0/0/0




test@router> show bgp summary   










<-- Added BGP export policy DEFAULT-ONLY to neighbor 10.1.1.1 (applied at neighbor level), 

<-- As this policy is unique to the neighbor 10.1.1.1, bgp must create a new group Index to accommodate the new policy

<-- SO new Index 1 has been created and moved the export policies attached to the peer 10.1.1.1 to the new Index.

<-- The movement should re-configure the peer to accommodate the changes, so session flapped. 







test@router> show bgp group    




Warning: License key missing; requires 'bgp' license




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 0      Flags: <>

 Export: [ DENY-ALL ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 4    Established: 4

 10.1.2.1+179

 10.1.3.1+179

 10.1.4.1+179

 10.1.5.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940 <<<<< New group Index, 1 created for the peer 10.1.1.1 to accomadate new policy DEAFULT-ONLY

 Name: test Index: 1      Flags: <>

 Export: [ DENY-ALL DEFAULT-ONLY ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.1.1+179

 inet.0: 0/0/0/0




Groups: 2 Peers: 5  External: 0  Internal: 5  Down peers: 0  Flaps: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0




test@router> show bgp summary   




Warning: License key missing; requires 'bgp' license




Threading mode: BGP I/O

Default eBGP mode: advertise - accept, receive - accept

Groups: 2 Peers: 5 Down peers: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0

Peer           AS   InPkt   OutPkt  OutQ  Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...

10.1.1.1       20940     3     2    0    0      1 Establ <<<<<<<<<<< session is flapped. 

 inet.0: 0/0/0/0

10.1.2.1       20940     11     9    0    0    4:03 Establ

 inet.0: 0/0/0/0

10.1.3.1       20940     11     9    0    0    3:59 Establ

 inet.0: 0/0/0/0

10.1.4.1       20940     11     9    0    0    3:55 Establ

 inet.0: 0/0/0/0

10.1.5.1       20940     11     10    0    0    3:51 Establ

 inet.0: 0/0/0/0







<-- Now added one more policy to the peer 10.1.1.1, 

<-- However, peer is not flapped, because peer 10.1.1.1 doesn't share the Index 1 with any other peers. 

<-- Unlike earlier Index 0 was shared among all the peers because the same export policy present for all the peers. 

<-- The new policy REJECT_DEFAULT was applied, however its been absorbed by the same group Index and no necessity to configure another index. 

<-- As long as the Index 1 is not shared by any other peer, we can keep adding any number of export policies to the peer. BGP session will not flap.







test@router> show bgp group    




Warning: License key missing; requires 'bgp' license




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 0      Flags: <>

 Export: [ DENY-ALL ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 4    Established: 4

 10.1.2.1+179

 10.1.3.1+179

 10.1.4.1+179

 10.1.5.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 1      Flags: <Export Eval>

 Export: [ DENY-ALL DEFAULT-ONLY REJECT_DEFAULT ] <<<<<<<< additional export policy was added. 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.1.1+179

 inet.0: 0/0/0/0




Groups: 2 Peers: 5  External: 0  Internal: 5  Down peers: 0  Flaps: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0




test@router> show bgp summary   




Warning: License key missing; requires 'bgp' license




Threading mode: BGP I/O

Default eBGP mode: advertise - accept, receive - accept

Groups: 2 Peers: 5 Down peers: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0

Peer           AS   InPkt   OutPkt  OutQ  Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...

10.1.1.1       20940     4     3    0    0     45 Establ <<<<<<< no flap in bgp session. 

 inet.0: 0/0/0/0

10.1.2.1       20940     13     11    0    0    4:47 Establ

 inet.0: 0/0/0/0

10.1.3.1       20940     13     11    0    0    4:43 Establ

 inet.0: 0/0/0/0

10.1.4.1       20940     13     11    0    0    4:39 Establ

 inet.0: 0/0/0/0

10.1.5.1       20940     13     12    0    0    4:35 Establ

 inet.0: 0/0/0/0







<-- Now new export policy was applied to peer 10.1.2.1

<-- As peer was sharing Index 0, however, to accommodate the new policy DEFAULT-ONLY for the peer 10.1.2.1,

<-- New Index should be created.

<-- The new Index is 2 and will be exclusively meant for peer 10.1.2.1

<-- So BGP session will flap now.

<-- Further additions of export policies to the peer 10.1.2.1 will not flap the peer.




test@router> show bgp group    




Warning: License key missing; requires 'bgp' license




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 1      Flags: <>

 Export: [ DENY-ALL DEFAULT-ONLY REJECT_DEFAULT ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.1.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 0      Flags: <>

 Export: [ DENY-ALL ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 3    Established: 3

 10.1.3.1+179

 10.1.4.1+179

 10.1.5.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 2      Flags: <>

 Export: [ DEFAULT-ONLY ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.2.1+179

 inet.0: 0/0/0/0




Groups: 3 Peers: 5  External: 0  Internal: 5  Down peers: 0  Flaps: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0







<--- peer 10.1.2.1 added with another export policy, did not flapped ... 




test@router> show bgp summary   




Warning: License key missing; requires 'bgp' license




Threading mode: BGP I/O

Default eBGP mode: advertise - accept, receive - accept

Groups: 3 Peers: 5 Down peers: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0

Peer           AS   InPkt   OutPkt  OutQ  Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...

10.1.1.1       20940     5     4    0    0    1:11 Establ

 inet.0: 0/0/0/0

10.1.2.1       20940     3     3    0    0      2 Establ

 inet.0: 0/0/0/0

10.1.3.1       20940     14     12    0    0    5:09 Establ

 inet.0: 0/0/0/0

10.1.4.1       20940     14     12    0    0    5:05 Establ

 inet.0: 0/0/0/0

10.1.5.1       20940     14     12    0    0    5:01 Establ

 inet.0: 0/0/0/0







test@router> show bgp group   




Warning: License key missing; requires 'bgp' license




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 1      Flags: <>

 Export: [ DENY-ALL DEFAULT-ONLY REJECT_DEFAULT ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.1.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 0      Flags: <>

 Export: [ DENY-ALL ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 3    Established: 3

 10.1.3.1+179

 10.1.4.1+179

 10.1.5.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 2      Flags: <Export Eval>

 Export: [ DEFAULT-ONLY DENY-ALL ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.2.1+179

 inet.0: 0/0/0/0




Groups: 3 Peers: 5  External: 0  Internal: 5  Down peers: 0  Flaps: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0




test@router> show bgp summary   




Warning: License key missing; requires 'bgp' license




Threading mode: BGP I/O

Default eBGP mode: advertise - accept, receive - accept

Groups: 3 Peers: 5 Down peers: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0

Peer           AS   InPkt   OutPkt  OutQ  Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...

10.1.1.1       20940     7     6    0    0    2:09 Establ

 inet.0: 0/0/0/0

10.1.2.1       20940     5     4    0    0    1:00 Establ

 inet.0: 0/0/0/0

10.1.3.1       20940     16     14    0    0    6:07 Establ

 inet.0: 0/0/0/0

10.1.4.1       20940     16     14    0    0    6:03 Establ

 inet.0: 0/0/0/0

10.1.5.1       20940     16     14    0    0    5:59 Establ

 inet.0: 0/0/0/0










<-- Added one more policy such that peer 10.1.2.1 has the same type of export policies as peer 10.1.1.1

<-- However, as Indexes are already created for peers 10.1.1.1 and 10.1.2.1, no need to merge them.

<-- The respective peers will continue to use the same Indexes.. and no session flaps.







test@router> show bgp group    




Warning: License key missing; requires 'bgp' license




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 1      Flags: <>

 Export: [ DENY-ALL DEFAULT-ONLY REJECT_DEFAULT ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.1.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 0      Flags: <>

 Export: [ DENY-ALL ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 3    Established: 3

 10.1.3.1+179

 10.1.4.1+179

 10.1.5.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 2      Flags: <Export Eval>

 Export: [ DEFAULT-ONLY DENY-ALL REJECT_DEFAULT ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.2.1+179

 inet.0: 0/0/0/0




Groups: 3 Peers: 5  External: 0  Internal: 5  Down peers: 0  Flaps: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0




test@router> show bgp group   




Warning: License key missing; requires 'bgp' license




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 1      Flags: <>

 Export: [ DENY-ALL DEFAULT-ONLY REJECT_DEFAULT ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.1.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 0      Flags: <>

 Export: [ DENY-ALL ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 3    Established: 3

 10.1.3.1+179

 10.1.4.1+179

 10.1.5.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 2      Flags: <Export Eval>

 Export: [ DEFAULT-ONLY DENY-ALL REJECT_DEFAULT ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.2.1+179

 inet.0: 0/0/0/0




Groups: 3 Peers: 5  External: 0  Internal: 5  Down peers: 0  Flaps: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0




test@router> show bgp summary   




Warning: License key missing; requires 'bgp' license




Threading mode: BGP I/O

Default eBGP mode: advertise - accept, receive - accept

Groups: 3 Peers: 5 Down peers: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0

Peer           AS   InPkt   OutPkt  OutQ  Flaps Last Up/Dwn State|#Active/Received/Accepted/Damped...

10.1.1.1       20940     8     7    0    0    2:27 Establ

 inet.0: 0/0/0/0

10.1.2.1       20940     5     4    0    0    1:18 Establ

 inet.0: 0/0/0/0

10.1.3.1       20940     17     15    0    0    6:25 Establ

 inet.0: 0/0/0/0

10.1.4.1       20940     17     15    0    0    6:21 Establ

 inet.0: 0/0/0/0

10.1.5.1       20940     16     14    0    0    6:17 Establ

 inet.0: 0/0/0/0




test@router> show bgp group    




Warning: License key missing; requires 'bgp' license




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 1      Flags: <>

 Export: [ DENY-ALL DEFAULT-ONLY REJECT_DEFAULT ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.1.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 0      Flags: <>

 Export: [ DENY-ALL ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 3    Established: 3

 10.1.3.1+179

 10.1.4.1+179

 10.1.5.1+179

 inet.0: 0/0/0/0




Group Type: Internal  AS: 20940         Local AS: 20940

 Name: test Index: 2      Flags: <Export Eval>

 Export: [ DEFAULT-ONLY DENY-ALL REJECT_DEFAULT ] 

 Options: <GracefulShutdownRcv>

 Holdtime: 90 Preference: 0

 Graceful Shutdown Receiver local-preference: 0

 Total peers: 1    Established: 1

 10.1.2.1+179

 inet.0: 0/0/0/0




Groups: 3 Peers: 5  External: 0  Internal: 5  Down peers: 0  Flaps: 0

Table     Tot Paths Act Paths Suppressed  History Damp State  Pending

inet.0        

            0     0     0     0     0     0




test@router>


Modification History

2024-12-10 : Article Created