From 1dd25e25ed6d910f4894c1117b6bc983e61d7dd9 Mon Sep 17 00:00:00 2001 From: daxi20 Date: Wed, 26 Nov 2025 20:51:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0IXP=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bird/conf/inet.conf | 12 ------------ bird/conf/inet_func.conf | 13 +++++++++++++ bird/conf/inet_ixp.conf | 13 +++++++++++++ bird/template/inet_ixp.conf | 21 +++++++++++++++++++++ update.sh | 9 ++++----- 5 files changed, 51 insertions(+), 17 deletions(-) create mode 100644 bird/conf/inet_func.conf create mode 100644 bird/conf/inet_ixp.conf create mode 100644 bird/template/inet_ixp.conf diff --git a/bird/conf/inet.conf b/bird/conf/inet.conf index 4951250..2c64e5f 100644 --- a/bird/conf/inet.conf +++ b/bird/conf/inet.conf @@ -1,9 +1,3 @@ -function is_self_net() { - return net ~ [ - 44.32.191.0/24 - ]; -} - protocol static route_int_export_v4 { route 44.32.191.0/24 reject; ipv4 { @@ -18,12 +12,6 @@ protocol static route_int_export_v4 { }; } -function is_self_net_v6() { - return net ~ [ - 2406:840:e600::/44{44,48} - ]; -} - protocol static route_int_export_v6 { route 2406:840:e602::/48 reject; route 2406:840:e604::/48 reject; diff --git a/bird/conf/inet_func.conf b/bird/conf/inet_func.conf new file mode 100644 index 0000000..eee9599 --- /dev/null +++ b/bird/conf/inet_func.conf @@ -0,0 +1,13 @@ +function is_self_net() { + return net ~ [ + 44.32.191.0/24 + ]; +} + + +function is_self_net_v6() { + return net ~ [ + 2406:840:e600::/44{44,48}, + 2a0f:1cc5:10::/44{44,48} + ]; +} diff --git a/bird/conf/inet_ixp.conf b/bird/conf/inet_ixp.conf new file mode 100644 index 0000000..e217ebf --- /dev/null +++ b/bird/conf/inet_ixp.conf @@ -0,0 +1,13 @@ +protocol static route_int_export_ixp_v6 { + route 2406:840:e600::/44 reject; + ipv6 { + table inet6; + import filter { + bgp_large_community.add((LOCAL_ASN,3,0)); + bgp_large_community.add((LOCAL_ASN,1,0)); + bgp_large_community.add((LOCAL_ASN,200,1)); + accept; + }; + export none; + }; +} \ No newline at end of file diff --git a/bird/template/inet_ixp.conf b/bird/template/inet_ixp.conf new file mode 100644 index 0000000..0cda23c --- /dev/null +++ b/bird/template/inet_ixp.conf @@ -0,0 +1,21 @@ +template bgp tpl_inet6_ixp { + graceful restart; + local as LOCAL_ASN; + ipv6 { + table inet6; + import filter { + if is_self_net_v6() then reject; + if is_bogon_prefix() || (bgp_path.len > 100) then reject; + accept; + }; + export filter { + if !is_self_net_v6() then reject; + if is_bogon_prefix() || (bgp_path.len > 100) then reject; + if bgp_large_community !~ [(LOCAL_ASN, 200,1)] then reject; + bgp_large_community.delete((LOCAL_ASN,3,*)); + bgp_large_community.delete((LOCAL_ASN,1,*)); + bgp_large_community.delete((LOCAL_ASN,200,*)); + accept; + }; + }; +} \ No newline at end of file diff --git a/update.sh b/update.sh index 13c2996..4eb9d81 100644 --- a/update.sh +++ b/update.sh @@ -2,14 +2,13 @@ cd git clone https://git.nia.ink/brnet/bird_config.git -rm -rf /etc/bird/net -mv bird_config/bird/net /etc/bird/ -rm -rf /etc/bird/bird.conf -mv bird_config/bird/bird.conf /etc/bird/ +mv bird_config/bird/conf/inet_func.conf /etc/bird/conf/ +mv bird_config/bird/conf/inet_ixp.conf /etc/bird/conf/ +mv bird_config/bird/template/inet_ixp.confbird.conf /etc/bird/template chmod -R 755 /etc/bird -echo "如有需要,可以birdc c" +echo "老规矩哈" cd rm -rf bird_config