From eb4795ca4e84998f546333746fe01c199b317e92 Mon Sep 17 00:00:00 2001 From: Ljcbaby <46277145+ljcbaby@users.noreply.github.com> Date: Sat, 4 Oct 2025 22:39:37 +0800 Subject: [PATCH 1/9] feat(bird): ibgp and rr --- bird/ibgp.conf | 2 +- bird/ibgp_rrs.conf | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 bird/ibgp_rrs.conf diff --git a/bird/ibgp.conf b/bird/ibgp.conf index e0a15a2..ef9f1f3 100644 --- a/bird/ibgp.conf +++ b/bird/ibgp.conf @@ -4,7 +4,7 @@ template bgp ibgp_peers { graceful restart on; # bfd on; ipv4 { - next hop self; + next hop self ebgp; igp table OSPF_table; table BGP_table; import filter { diff --git a/bird/ibgp_rrs.conf b/bird/ibgp_rrs.conf new file mode 100644 index 0000000..3f90937 --- /dev/null +++ b/bird/ibgp_rrs.conf @@ -0,0 +1,62 @@ +template bgp ibgp_peers { + local as LOCAL_ASN; + source address SERVE_IP; + graceful restart on; + # bfd on; + ipv4 { + next hop self ebgp; + igp table OSPF_table; + table BGP_table; + import filter { + dn11_update_cross_ibgp(); + accept; + }; + export filter { + if source != RTS_BGP then reject; + dn11_update_server_location(); + unset(bgp_med); + accept; + }; + }; +} + +template bgp ibgp_rrs { + local as LOCAL_ASN; + source address SERVE_IP; + rr client; + rr cluster id ; + graceful restart on; + # bfd on; + ipv4 { + next hop self ebgp; + igp table OSPF_table; + table BGP_table; + import filter { + dn11_update_cross_ibgp(); + accept; + }; + export filter { + if source != RTS_BGP then reject; + dn11_update_server_location(); + unset(bgp_med); + accept; + }; + }; +} + +# plain ibgp between RRs +protocol bgp IBGP_ from ibgp_peers { + neighbor internal; +} + +# ibgp from RR Server to RR Client +protocol bgp IBGP_ from ibgp_rrs { + neighbor internal; +} + +# or a dynamic protocol +protocol bgp IBGP_RRClient from ibgp_rrs { + neighbor range external; + dynamic name "RRClient"; + # password "string" # when needed +} From 45559ed2cfcbb83cdc34d535c5748bfd0fe30f10 Mon Sep 17 00:00:00 2001 From: Ljcbaby <46277145+ljcbaby@users.noreply.github.com> Date: Sat, 4 Oct 2025 22:40:43 +0800 Subject: [PATCH 2/9] Update bird/ibgp_rrs.conf Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- bird/ibgp_rrs.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bird/ibgp_rrs.conf b/bird/ibgp_rrs.conf index 3f90937..633ccb1 100644 --- a/bird/ibgp_rrs.conf +++ b/bird/ibgp_rrs.conf @@ -56,7 +56,7 @@ protocol bgp IBGP_ from ibgp_rrs { # or a dynamic protocol protocol bgp IBGP_RRClient from ibgp_rrs { - neighbor range external; + neighbor range internal; dynamic name "RRClient"; # password "string" # when needed } From ecde42dd748698eef66fd64842f277ae1b6d213e Mon Sep 17 00:00:00 2001 From: Ljcbaby <46277145+ljcbaby@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:31:15 +0800 Subject: [PATCH 3/9] Refactor BGP configuration templates and protocols --- bird/ibgp_rrs.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bird/ibgp_rrs.conf b/bird/ibgp_rrs.conf index 633ccb1..098738f 100644 --- a/bird/ibgp_rrs.conf +++ b/bird/ibgp_rrs.conf @@ -14,7 +14,6 @@ template bgp ibgp_peers { export filter { if source != RTS_BGP then reject; dn11_update_server_location(); - unset(bgp_med); accept; }; }; @@ -38,7 +37,6 @@ template bgp ibgp_rrs { export filter { if source != RTS_BGP then reject; dn11_update_server_location(); - unset(bgp_med); accept; }; }; @@ -60,3 +58,4 @@ protocol bgp IBGP_RRClient from ibgp_rrs { dynamic name "RRClient"; # password "string" # when needed } + From cc64b5179f44760575f1c8727f7a26a399af49f7 Mon Sep 17 00:00:00 2001 From: Ljcbaby <46277145+ljcbaby@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:32:06 +0800 Subject: [PATCH 4/9] Refactor BGP templates and protocols in ibgp_rrs.conf --- bird/ibgp_rrs.conf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bird/ibgp_rrs.conf b/bird/ibgp_rrs.conf index 098738f..60b83cf 100644 --- a/bird/ibgp_rrs.conf +++ b/bird/ibgp_rrs.conf @@ -19,7 +19,7 @@ template bgp ibgp_peers { }; } -template bgp ibgp_rrs { +template bgp ibgp_rr { local as LOCAL_ASN; source address SERVE_IP; rr client; @@ -48,14 +48,15 @@ protocol bgp IBGP_ from ibgp_peers { } # ibgp from RR Server to RR Client -protocol bgp IBGP_ from ibgp_rrs { +protocol bgp IBGP_ from ibgp_rr { neighbor internal; } # or a dynamic protocol -protocol bgp IBGP_RRClient from ibgp_rrs { +protocol bgp IBGP_RRClient from ibgp_rr { neighbor range internal; dynamic name "RRClient"; # password "string" # when needed } + From 5d982617d20d387151f251140097cf4855c4e41c Mon Sep 17 00:00:00 2001 From: Ljcbaby <46277145+ljcbaby@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:41:31 +0800 Subject: [PATCH 5/9] fix --- bird/{ibgp_rrs.conf => ibgp_rr.conf} | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) rename bird/{ibgp_rrs.conf => ibgp_rr.conf} (76%) diff --git a/bird/ibgp_rrs.conf b/bird/ibgp_rr.conf similarity index 76% rename from bird/ibgp_rrs.conf rename to bird/ibgp_rr.conf index 60b83cf..b8bf655 100644 --- a/bird/ibgp_rrs.conf +++ b/bird/ibgp_rr.conf @@ -4,16 +4,13 @@ template bgp ibgp_peers { graceful restart on; # bfd on; ipv4 { + add paths on; next hop self ebgp; igp table OSPF_table; table BGP_table; - import filter { - dn11_update_cross_ibgp(); - accept; - }; + import all; export filter { if source != RTS_BGP then reject; - dn11_update_server_location(); accept; }; }; @@ -27,22 +24,20 @@ template bgp ibgp_rr { graceful restart on; # bfd on; ipv4 { + add paths on; next hop self ebgp; igp table OSPF_table; table BGP_table; - import filter { - dn11_update_cross_ibgp(); - accept; - }; + import all; export filter { if source != RTS_BGP then reject; - dn11_update_server_location(); accept; }; }; } # plain ibgp between RRs +# or ibgp from RR Client to RR Server protocol bgp IBGP_ from ibgp_peers { neighbor internal; } @@ -60,3 +55,4 @@ protocol bgp IBGP_RRClient from ibgp_rr { } + From 4eb322fc5af42f4df91c313d98ff66cb300b3cb4 Mon Sep 17 00:00:00 2001 From: Ljcbaby <46277145+ljcbaby@users.noreply.github.com> Date: Sun, 5 Oct 2025 13:47:01 +0800 Subject: [PATCH 6/9] Refactor BGP configuration templates and protocols --- bird/ibgp_rr.conf | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/bird/ibgp_rr.conf b/bird/ibgp_rr.conf index b8bf655..69ed16b 100644 --- a/bird/ibgp_rr.conf +++ b/bird/ibgp_rr.conf @@ -24,7 +24,25 @@ template bgp ibgp_rr { graceful restart on; # bfd on; ipv4 { - add paths on; + add paths tx; + next hop self ebgp; + igp table OSPF_table; + table BGP_table; + import all; + export filter { + if source != RTS_BGP then reject; + accept; + }; + }; +} + +template bgp ibgp_rr_client { + local as LOCAL_ASN; + source address SERVE_IP; + graceful restart on; + # bfd on; + ipv4 { + add paths rx; next hop self ebgp; igp table OSPF_table; table BGP_table; @@ -37,7 +55,6 @@ template bgp ibgp_rr { } # plain ibgp between RRs -# or ibgp from RR Client to RR Server protocol bgp IBGP_ from ibgp_peers { neighbor internal; } @@ -54,5 +71,8 @@ protocol bgp IBGP_RRClient from ibgp_rr { # password "string" # when needed } - +# ibgp from RR Client to RR Server +protocol bgp IBGP_ from ibgp_rr_client { + neighbor internal; +} From b2e8eb52ec195471adbcdb49456f1c9cc5bd3903 Mon Sep 17 00:00:00 2001 From: Ljcbaby <46277145+ljcbaby@users.noreply.github.com> Date: Sun, 5 Oct 2025 14:46:24 +0800 Subject: [PATCH 7/9] Refactor BGP templates and add location update Updated BGP templates and protocols to include dn11_update_server_location function in export filters. --- bird/ibgp_rr.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bird/ibgp_rr.conf b/bird/ibgp_rr.conf index 69ed16b..03d5b24 100644 --- a/bird/ibgp_rr.conf +++ b/bird/ibgp_rr.conf @@ -4,13 +4,13 @@ template bgp ibgp_peers { graceful restart on; # bfd on; ipv4 { - add paths on; next hop self ebgp; igp table OSPF_table; table BGP_table; import all; export filter { if source != RTS_BGP then reject; + dn11_update_server_location(); accept; }; }; @@ -49,6 +49,7 @@ template bgp ibgp_rr_client { import all; export filter { if source != RTS_BGP then reject; + dn11_update_server_location(); accept; }; }; @@ -76,3 +77,4 @@ protocol bgp IBGP_ from ibgp_rr_client { neighbor internal; } + From c096989fda2b3dd6d8181942f78bb61d6b207b67 Mon Sep 17 00:00:00 2001 From: Ljcbaby <46277145+ljcbaby@users.noreply.github.com> Date: Sat, 29 Nov 2025 16:09:45 +0800 Subject: [PATCH 8/9] 111 --- bird/ibgp.conf | 2 +- bird/ibgp_rr.conf | 36 ++++++++++++++---------------------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/bird/ibgp.conf b/bird/ibgp.conf index ef9f1f3..3b57b7f 100644 --- a/bird/ibgp.conf +++ b/bird/ibgp.conf @@ -9,11 +9,11 @@ template bgp ibgp_peers { table BGP_table; import filter { dn11_update_cross_ibgp(); + dn11_update_server_location(); accept; }; export filter { if source != RTS_BGP then reject; - dn11_update_server_location(); unset(bgp_med); accept; }; diff --git a/bird/ibgp_rr.conf b/bird/ibgp_rr.conf index 03d5b24..1d979aa 100644 --- a/bird/ibgp_rr.conf +++ b/bird/ibgp_rr.conf @@ -1,4 +1,4 @@ -template bgp ibgp_peers { +template bgp ibgp_base { local as LOCAL_ASN; source address SERVE_IP; graceful restart on; @@ -7,28 +7,29 @@ template bgp ibgp_peers { next hop self ebgp; igp table OSPF_table; table BGP_table; - import all; + import filter { + dn11_update_cross_ibgp(); + dn11_update_server_location(); + accept; + }; + } +} + +template bgp ibgp_peers from ibgp_base { + ipv4 { + next hop self ebgp; export filter { if source != RTS_BGP then reject; - dn11_update_server_location(); accept; }; }; } -template bgp ibgp_rr { - local as LOCAL_ASN; - source address SERVE_IP; +template bgp ibgp_rr from ibgp_base { rr client; rr cluster id ; - graceful restart on; - # bfd on; ipv4 { add paths tx; - next hop self ebgp; - igp table OSPF_table; - table BGP_table; - import all; export filter { if source != RTS_BGP then reject; accept; @@ -36,20 +37,11 @@ template bgp ibgp_rr { }; } -template bgp ibgp_rr_client { - local as LOCAL_ASN; - source address SERVE_IP; - graceful restart on; - # bfd on; +template bgp ibgp_rr_client from ibgp_base { ipv4 { add paths rx; - next hop self ebgp; - igp table OSPF_table; - table BGP_table; - import all; export filter { if source != RTS_BGP then reject; - dn11_update_server_location(); accept; }; }; From 0afa977fc4ad9717151bccdc71465302a6cdb2f9 Mon Sep 17 00:00:00 2001 From: Ljcbaby <46277145+ljcbaby@users.noreply.github.com> Date: Sat, 29 Nov 2025 16:31:07 +0800 Subject: [PATCH 9/9] ibgp_rrs --- bird/ibgp_rr.conf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bird/ibgp_rr.conf b/bird/ibgp_rr.conf index 1d979aa..4393884 100644 --- a/bird/ibgp_rr.conf +++ b/bird/ibgp_rr.conf @@ -25,6 +25,14 @@ template bgp ibgp_peers from ibgp_base { }; } +# for ibgp between rr +template bgp ibgp_rrs from ibgp_peers { + ipv4 { + add paths tx; + add paths rx; + } +} + template bgp ibgp_rr from ibgp_base { rr client; rr cluster id ;