更新外发BGP模板

This commit is contained in:
2025-11-03 16:57:26 +08:00
parent d6c621f38d
commit 37842ed600
3 changed files with 47 additions and 13 deletions

View File

@@ -6,6 +6,8 @@ template bgp tpl_bgp_up {
import filter {
if is_self_net() then reject;
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
bgp_large_community.empty;
bgp_large_community.add((LOCAL_ASN,200,0));# 传输到Ebgp
accept;
};
export filter {
@@ -22,6 +24,8 @@ template bgp tpl_bgp_up {
import filter {
if is_self_net_v6() then reject;
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
bgp_large_community.empty;
bgp_large_community.add((LOCAL_ASN,200,0));# 传输到Ebgp
accept;
};
export filter {

View File

@@ -4,19 +4,37 @@ template bgp unet_bgp_up0 {
ipv4 {
table unet4;
import filter {
if unet_is_valid_network_v4_allnet() && !unet_is_self_net() then accept;
reject;
if !unet_is_valid_network_v4_allnet() then reject;
if unet_is_self_net() then reject;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,200,0));# 传输到Ebgp
accept;
};
export filter {
if !unet_is_valid_network_v4_allnet() then reject;
if source !~ [RTS_STATIC, RTS_BGP] then reject;
if bgp_large_community !~ [(UNET_ASN, 200,0)] then reject;
bgp_large_community.empty;
accept;
};
export filter { if unet_is_valid_network_v4_allnet() && source ~ [RTS_STATIC, RTS_BGP] then accept; else reject; };
import limit 9000 action block;
};
ipv6 {
table unet6;
ipv4 {
table unet4;
import filter {
if unet_is_voalid_net_v6() && !unet_is_self_net_v6() then accept;
reject;
if !unet_is_voalid_net_v6() then reject;
if unet_is_self_net_v6() then reject;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,200,0));# 传输到Ebgp
accept;
};
export filter {
if !unet_is_voalid_net_v6() then reject;
if source !~ [RTS_STATIC, RTS_BGP] then reject;
if bgp_large_community !~ [(UNET_ASN, 200,0)] then reject;
bgp_large_community.empty;
accept;
};
export filter { if unet_is_voalid_net_v6() && source ~ [RTS_STATIC, RTS_BGP] then accept; else reject; };
import limit 9000 action block;
};
}
@@ -27,10 +45,19 @@ template bgp unet_bgp_up1 {
ipv4 {
table unet4;
import filter {
if unet_is_valid_network_v4() && !unet_is_self_net() then accept;
reject;
if !unet_is_valid_network_v4() then reject;
if unet_is_self_net() then reject;
bgp_large_community.empty;
bgp_large_community.add((UNET_ASN,200,0));# 传输到Ebgp
accept;
};
export filter {
if !unet_is_valid_network_v4() then reject;
if source !~ [RTS_STATIC, RTS_BGP] then reject;
if bgp_large_community !~ [(UNET_ASN, 200,0)] then reject;
bgp_large_community.empty;
accept;
};
export filter { if unet_is_valid_network_v4() && source ~ [RTS_STATIC, RTS_BGP] then accept; else reject; };
import limit 9000 action block;
};
}

View File

@@ -1,7 +1,10 @@
#!/bin/bash
rm /etc/bird/function/unet.conf
curl https://git.nia.ink/brnet/bird_config/raw/branch/master/bird/function/unet.conf > /etc/bird/function/unet.conf
rm /etc/bird/net/unet.conf
curl https://git.nia.ink/brnet/bird_config/raw/branch/master/bird/net/unet.conf > /etc/bird/net/unet.conf
rm /etc/bird/net/inet.conf
curl https://git.nia.ink/brnet/bird_config/raw/branch/master/bird/net/inet.conf > /etc/bird/net/inet.conf
chmod -R 755 /etc/bird