From 1d0af5fadba5bf964e2f3069c084d8abec4fe3d8 Mon Sep 17 00:00:00 2001 From: daxi20 Date: Mon, 13 Oct 2025 01:17:30 +0800 Subject: [PATCH 1/2] 111 --- bird/bird.conf | 15 +++++++++++++++ bird/function/tables.conf | 18 +++++++++--------- update.sh | 11 +++++++++++ 3 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 update.sh diff --git a/bird/bird.conf b/bird/bird.conf index 49d4b2a..1df7f8e 100644 --- a/bird/bird.conf +++ b/bird/bird.conf @@ -31,7 +31,22 @@ protocol kernel { krt_prefsrc = UNET_V4_kernel; accept; } + reject; + }; + }; +}; + +# echo "102 ipv4_pub" >> /etc/iproute2/rt_tables +protocol kernel { + scan time 20; + kernel table 102; + ipv4 { + table inet4; + import none; + export filter { + if source = RTS_STATIC then reject; if !is_bogon_prefix() then { + if bgp_large_community ~ [(LOCAL_ASN, 3,*)] then reject; krt_prefsrc = LOCAL_V4_kernel; accept; } diff --git a/bird/function/tables.conf b/bird/function/tables.conf index fb60958..f95a190 100644 --- a/bird/function/tables.conf +++ b/bird/function/tables.conf @@ -15,15 +15,15 @@ protocol pipe inet6_sync { }; } -protocol pipe inet4_sync { - table inet4; - peer table master4; - import none; - export filter { - if bgp_large_community ~ [(LOCAL_ASN, 3,*)] then reject; - accept; - }; -} +#protocol pipe inet4_sync { +# table inet4; +# peer table master4; +# import none; +# export filter { +# if bgp_large_community ~ [(LOCAL_ASN, 3,*)] then reject; +# accept; +# }; +#} protocol pipe unet4_sync { table unet4; diff --git a/update.sh b/update.sh new file mode 100644 index 0000000..973c36b --- /dev/null +++ b/update.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +git clone git@ssh.git.nia.ink:brnet/bird_config.git +rm /etc/bird/bird.conf +rm /etc/bird/function/tables.conf + +mv bird_config/bird.conf /etc/bird/bird.conf +mv bird_config/function/tables.conf /etc/bird/function/tables.conf +rm -rf bird_config + +birdc c \ No newline at end of file -- 2.49.1 From d82ba494a74da995740d8b93d9d7911ac9b8722c Mon Sep 17 00:00:00 2001 From: daxi20 Date: Mon, 13 Oct 2025 01:18:32 +0800 Subject: [PATCH 2/2] 00 --- update.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/update.sh b/update.sh index 973c36b..18c1d56 100644 --- a/update.sh +++ b/update.sh @@ -1,5 +1,16 @@ #!/bin/bash +TABLE_NAME="ipv4_pub" +TABLE_ID=102 +RT_TABLES="/etc/iproute2/rt_tables" + +if ! grep -q "^${TABLE_ID}[[:space:]]\+${TABLE_NAME}" "$RT_TABLES"; then + echo "添加路由表 $TABLE_NAME(编号$TABLE_ID)..." + echo "${TABLE_ID} ${TABLE_NAME}" >> "$RT_TABLES" +else + echo "路由表 $TABLE_NAME 已存在,无需创建" +fi + git clone git@ssh.git.nia.ink:brnet/bird_config.git rm /etc/bird/bird.conf rm /etc/bird/function/tables.conf -- 2.49.1