更新倒表方式

This commit is contained in:
2026-05-05 15:48:43 +08:00
parent 171c595483
commit 08fdf2fa04
7 changed files with 134 additions and 75 deletions

View File

@@ -1,33 +1,29 @@
protocol kernel kernel_dn42v4_105 {
scan time 20;
kernel table 105;
ipv4 {
table dn42v4;
import none;
export filter {
if bgp_large_community ~ [(DN42_ASN, 3,*)] then reject;
if is_dn42_prefix() then {
krt_prefsrc = DN42_V4_kernel;
accept;
}
reject;
};
protocol pipe dn42v4_sync {
table dn42v4;
peer table t102v4;
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,10204));
krt_prefsrc = DN42_V4_kernel;
accept;
};
};
import none;
}
protocol kernel kernel_dn42v6_105 {
scan time 20;
kernel table 105;
ipv6 {
table dn42v6;
import none;
export filter {
if bgp_large_community ~ [(DN42_ASN, 3,*)] then reject;
if is_dn42_prefix() then {
krt_prefsrc = DN42_V6_kernel;
accept;
}
reject;
};
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

@@ -1,34 +1,29 @@
protocol kernel kernel_inet4_102 {
scan time 20;
kernel table 102;
ipv4 {
table inet4;
import none;
export filter {
if bgp_large_community ~ [(LOCAL_ASN, 3,*)] then reject;
if !is_bogon_prefix() then {
krt_prefsrc = LOCAL_V4_kernel;
accept;
}
reject;
};
protocol pipe inet4_sync {
table inet4;
peer table t102v4;
export filter {
if bgp_large_community ~ [(LOCAL_ASN, 3,*)] then reject;
if is_bogon_prefix() then reject;
bgp_community.empty;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,10,10204));
krt_prefsrc = LOCAL_V4_kernel;
accept;
};
};
import none;
}
protocol kernel kernel_inet6_102 {
scan time 20;
kernel table 102;
ipv6 {
table inet6;
import none;
export filter {
if bgp_large_community ~ [(LOCAL_ASN, 3,*)] then reject;
if !is_bogon_prefix() then {
krt_prefsrc = LOCAL_V6_kernel;
accept;
}
reject;
};
protocol pipe inet6_sync {
table inet6;
peer table t102v6;
export filter {
if bgp_large_community ~ [(LOCAL_ASN, 3,*)] then reject;
if is_bogon_prefix() then reject;
bgp_community.empty;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,10,10206));
krt_prefsrc = LOCAL_V6_kernel;
accept;
};
};
import none;
}

View File

@@ -1,10 +1,15 @@
# 公网处理 => inet4/6
protocol pipe unet4_inet4_sync {
table unet4;
peer table inet4;
peer table t102v4;
export filter {
if bgp_large_community ~ [(UNET_ASN, 3,*)] then reject;
if is_bogon_prefix() then reject;
bgp_path.empty;
bgp_community.empty;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,10,10204));
krt_prefsrc = LOCAL_V4_kernel;
accept;
};
import none;
@@ -12,10 +17,15 @@ protocol pipe unet4_inet4_sync {
protocol pipe unet6_inet6_sync {
table unet6;
peer table inet6;
peer table t102v6;
export filter {
if bgp_large_community ~ [(UNET_ASN, 3,*)] then reject;
if is_bogon_prefix() then reject;
bgp_path.empty;
bgp_community.empty;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,10,10206));
krt_prefsrc = LOCAL_V6_kernel;
accept;
};
import none;
@@ -25,10 +35,15 @@ protocol pipe unet6_inet6_sync {
# DN42处理 => dn42v4/6
protocol pipe unet4_dn42v4_sync {
table unet4;
peer table dn42v4;
peer table t102v4;
export filter {
if bgp_large_community ~ [(UNET_ASN, 3,*)] then reject;
if !is_dn42_prefix() then reject;
bgp_path.empty;
bgp_community.empty;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,10,10204));
krt_prefsrc = DN42_V4_kernel;
accept;
};
import none;
@@ -36,10 +51,15 @@ protocol pipe unet4_dn42v4_sync {
protocol pipe unet6_dn42v6_sync {
table unet6;
peer table dn42v6;
peer table t102v6;
export filter {
if bgp_large_community ~ [(UNET_ASN, 3,*)] then reject;
if !is_dn42_prefix() then reject;
bgp_path.empty;
bgp_community.empty;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,10,10206));
krt_prefsrc = DN42_V6_kernel;
accept;
};
import none;
@@ -53,6 +73,24 @@ protocol pipe unet4_sync {
export filter {
if bgp_large_community ~ [(UNET_ASN, 3,*)] then reject;
if !unet_is_valid_network_v4() then reject;
bgp_community.empty;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,10,4));
krt_prefsrc = UNET_V4_kernel;
accept;
};
import none;
}
protocol pipe unet4_syncto_inet4 {
table unet4;
peer table t102v4;
export filter {
if bgp_large_community ~ [(UNET_ASN, 3,*)] then reject;
bgp_community.empty;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,10,10204));
krt_prefsrc = UNET_V4_kernel;
accept;
};
import none;