Skip to content

Instantly share code, notes, and snippets.

@tonusoo
Created April 20, 2025 14:54
Show Gist options
  • Save tonusoo/aa531093e1c6179f3dd2b9a922e4f647 to your computer and use it in GitHub Desktop.
Save tonusoo/aa531093e1c6179f3dd2b9a922e4f647 to your computer and use it in GitHub Desktop.
Juniper conditional BGP announcement PoC
[edit policy-options]
+ prefix-list DC1-aggregate {
+ 10.10.0.0/23;
+ }
[edit policy-options]
+ policy-statement ISP-B-out-v4 {
+ term conditional-announcement {
+ from {
+ prefix-list DC1-aggregate;
+ condition conditional-announcement;
+ }
+ then reject;
+ }
+ then next policy;
+ }
+ policy-statement from-ISP-A {
+ term allow-from-ISP-A {
+ from community from-ISP-A;
+ then accept;
+ }
+ term reject-all {
+ then reject;
+ }
+ }
[edit policy-options]
+ community from-ISP-A members 64512:10;
[edit policy-options]
+ condition conditional-announcement {
+ if-route-exists {
+ 0.0.0.0/0;
+ table conditional.inet.0;
+ }
+ }
[edit]
+ routing-instances {
+ conditional {
+ instance-type virtual-router;
+ }
+ }
[edit routing-options]
+ rib-groups {
+ conditional {
+ import-rib [ inet.0 conditional.inet.0 ];
+ import-policy from-ISP-A;
+ }
+ }
[edit protocols bgp group ebgp]
- export [ AS64512-aggregates-v4 reject-all ];
+ export [ ISP-B-out-v4 AS64512-aggregates-v4 reject-all ];
[edit protocols bgp group ibgp]
+ family inet {
+ unicast {
+ rib-group conditional;
+ }
+ }
@tonusoo
Copy link
Author

tonusoo commented Apr 20, 2025

conditional_announcement_in_Junos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment