This commit is contained in:
2026-05-23 17:35:37 +08:00
parent ca4a406afc
commit b903422ec6
8 changed files with 35 additions and 175 deletions

View File

@@ -12,17 +12,3 @@ protocol static route_dn42_export_v4 {
export none; export none;
}; };
} }
protocol static route_dn42_export_v6 {
route fde8:936e:ee29::/48 reject;
ipv6 {
table dn42v6;
import filter {
bgp_large_community.add((DN42_ASN,3,0));# 不允许导出到内核
bgp_large_community.add((DN42_ASN,1,0));# 不允许传输到ibgp
bgp_large_community.add((DN42_ASN,200,0));# 传输到Ebgp
accept;
};
export none;
};
}

View File

@@ -3,7 +3,6 @@ ipv6 table t102v6;
ipv4 table inet4; ipv4 table inet4;
ipv6 table inet6; ipv6 table inet6;
ipv4 table dn42v4; ipv4 table dn42v4;
ipv6 table dn42v6;
ipv4 table unet4; ipv4 table unet4;
ipv6 table unet6; ipv6 table unet6;
ipv4 table ospf4; ipv4 table ospf4;

View File

@@ -13,7 +13,6 @@ function unet_is_valid_network_v4_allnet(){
function unet_is_voalid_net_v6(){ function unet_is_voalid_net_v6(){
if is_self_net() then return true; if is_self_net() then return true;
if is_dn42_self_net() then return true;
return false; return false;
} }

View File

@@ -1,29 +1,14 @@
protocol pipe dn42v4_sync { protocol pipe dn42v4_sync {
table dn42v4; table dn42v4;
peer table t102v4; peer table master4;
export filter { export filter {
if bgp_large_community ~ [(DN42_ASN, 3,*)] then reject; if bgp_large_community ~ [(DN42_ASN, 3,*)] then reject;
if !is_dn42_prefix() then reject; if !is_dn42_prefix() then reject;
bgp_community.empty; bgp_community.empty;
bgp_large_community.empty; bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,10,10204)); bgp_large_community.add((UNET_ASN,10,4));
krt_prefsrc = DN42_V4_kernel; krt_prefsrc = DN42_V4_kernel;
accept; accept;
}; };
import none; import none;
} }
protocol pipe dn42v6_sync {
table dn42v6;
peer table t102v6;
export filter {
if bgp_large_community ~ [(DN42_ASN, 3,*)] then reject;
if !is_dn42_prefix() then reject;
bgp_community.empty;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,10,10206));
krt_prefsrc = DN42_V6_kernel;
accept;
};
import none;
}

View File

@@ -38,18 +38,6 @@ protocol pipe unet4_dn42v4_sync {
import none; import none;
} }
protocol pipe unet6_dn42v6_sync {
table unet6;
peer table dn42v6;
export filter {
if bgp_large_community ~ [(UNET_ASN, 3,*)] then reject;
if !is_dn42_prefix() then reject;
accept;
};
import none;
}
# 剩下的进入master (只有V4) # 剩下的进入master (只有V4)
protocol pipe unet4_sync { protocol pipe unet4_sync {
table unet4; table unet4;

View File

@@ -1,40 +1,24 @@
template bgp dn42_bgp_up { template bgp dn42_up0_new {
graceful restart; graceful restart;
local as DN42_ASN; local as DN42_ASN;
ipv4 { ipv4 {
table dn42v4; table dn42v4;
import filter { import filter {if !function_dn42_bgp_import_from_upstream() then reject; accept; };
if !is_dn42_prefix() then reject; export filter {if !function_dn42_bgp_export_to_upstream0() then reject; accept; };
if is_dn42_self_net() then reject;
accept;
};
export filter {
if !is_dn42_prefix() then reject;
if source !~ [RTS_STATIC, RTS_BGP] then reject;
if bgp_large_community !~ [(DN42_ASN, 200,0)] then reject;
accept;
};
import limit 9000 action block;
};
ipv6 {
table dn42v6;
import filter {
if !is_dn42_prefix() then reject;
if is_dn42_self_net() then reject;
accept;
};
export filter {
if !is_dn42_prefix() then reject;
if source !~ [RTS_STATIC, RTS_BGP] then reject;
if bgp_large_community !~ [(DN42_ASN, 200,0)] then reject;
accept;
};
import limit 9000 action block;
}; };
} }
template bgp dn42_ibgp { template bgp dn42_up1_new {
graceful restart;
local as DN42_ASN;
ipv4 {
table dn42v4;
import filter {if !function_dn42_bgp_import_from_upstream() then reject; accept; };
export filter {if !function_dn42_bgp_export_to_upstream1() then reject; accept; };
};
}
template bgp dn42_ibgp_new {
graceful restart; graceful restart;
local as DN42_ASN; local as DN42_ASN;
med metric; med metric;
@@ -43,34 +27,19 @@ template bgp dn42_ibgp {
table dn42v4; table dn42v4;
next hop self; next hop self;
gateway direct; gateway direct;
import filter { import filter {if !function_dn42_ibgp_import() then reject; accept; };
if bgp_large_community ~ [(DN42_ASN, 1,*)] then reject; export filter {if !function_dn42_ibgp_export() then reject; accept; };
if !is_dn42_prefix() then reject; };
if is_dn42_self_net() then reject; }
accept;
};
export filter { template bgp dn42_ibgp_mp_new {
if bgp_large_community ~ [(DN42_ASN, 1,*)] then reject; graceful restart;
if !is_dn42_prefix() then reject; local as DN42_ASN;
if is_dn42_self_net() then reject; med metric;
accept; ipv4 {
}; table dn42v4;
}; import filter {if !function_dn42_ibgp_import() then reject; accept; };
ipv6 { export filter {if !function_dn42_ibgp_export() then reject; accept; };
table dn42v6;
next hop self;
gateway direct;
import filter {
if bgp_large_community ~ [(DN42_ASN, 1,*)] then reject;
if !is_dn42_prefix() then reject;
if is_dn42_self_net() then reject;
accept;
};
export filter {
if bgp_large_community ~ [(DN42_ASN, 1,*)] then reject;
if !is_dn42_prefix() then reject;
if is_dn42_self_net() then reject;
accept;
};
}; };
} }

View File

@@ -1,67 +0,0 @@
template bgp dn42_up0_new {
graceful restart;
local as DN42_ASN;
ipv4 {
table dn42v4;
import filter {if !function_dn42_bgp_import_from_upstream() then reject; accept; };
export filter {if !function_dn42_bgp_export_to_upstream0() then reject; accept; };
};
ipv6 {
table dn42v6;
import filter {if !function_dn42_bgp_import_from_upstream() then reject; accept; };
export filter {if !function_dn42_bgp_export_to_upstream0() then reject; accept; };
};
}
template bgp dn42_up1_new {
graceful restart;
local as DN42_ASN;
ipv4 {
table dn42v4;
import filter {if !function_dn42_bgp_import_from_upstream() then reject; accept; };
export filter {if !function_dn42_bgp_export_to_upstream1() then reject; accept; };
};
ipv6 {
table dn42v6;
import filter {if !function_dn42_bgp_import_from_upstream() then reject; accept; };
export filter {if !function_dn42_bgp_export_to_upstream1() then reject; accept; };
};
}
template bgp dn42_ibgp_new {
graceful restart;
local as DN42_ASN;
med metric;
direct;
ipv4 {
table dn42v4;
next hop self;
gateway direct;
import filter {if !function_dn42_ibgp_import() then reject; accept; };
export filter {if !function_dn42_ibgp_export() then reject; accept; };
};
ipv6 {
table dn42v6;
next hop self;
gateway direct;
import filter {if !function_dn42_ibgp_import() then reject; accept; };
export filter {if !function_dn42_ibgp_export() then reject; accept; };
};
}
template bgp dn42_ibgp_mp_new {
graceful restart;
local as DN42_ASN;
med metric;
ipv4 {
table dn42v4;
import filter {if !function_dn42_ibgp_import() then reject; accept; };
export filter {if !function_dn42_ibgp_export() then reject; accept; };
};
ipv6 {
table dn42v6;
import filter {if !function_dn42_ibgp_import() then reject; accept; };
export filter {if !function_dn42_ibgp_export() then reject; accept; };
};
}

View File

@@ -3,14 +3,15 @@
cd cd
git clone https://git.nia.ink/brnet/bird_config.git git clone https://git.nia.ink/brnet/bird_config.git
rm /etc/bird/bird.conf
mv ./bird_config/bird/bird.conf /etc/bird/bird.conf
rm /etc/bird/net/*.conf rm /etc/bird/net/*.conf
mv ./bird_config/bird/net/*.conf /etc/bird/net/ mv ./bird_config/bird/net/*.conf /etc/bird/net/
rm /etc/bird/net/ospf.conf*
rm /etc/bird/template/*.conf rm /etc/bird/template/dn42*.conf
mv ./bird_config/bird/template/*.conf /etc/bird/template/ mv ./bird_config/bird/template/dn42.conf /etc/bird/template/
rm /etc/bird/function/*.conf
mv ./bird_config/bird/function/*.conf /etc/bird/function/
birdc c birdc c
cd cd