Fix:add dn42 and change config
This commit is contained in:
63
bird/template/dn42.conf
Normal file
63
bird/template/dn42.conf
Normal file
@@ -0,0 +1,63 @@
|
||||
template bgp dn42_bgp_up {
|
||||
graceful restart;
|
||||
local as DN42_ASN;
|
||||
ipv4 {
|
||||
table dn42v4;
|
||||
import filter {
|
||||
if is_dn42_prefix() && !dn42_is_self_net() then accept;
|
||||
reject;
|
||||
};
|
||||
export filter { if is_dn42_prefix() && source ~ [RTS_STATIC, RTS_BGP] then accept; else reject; };
|
||||
import limit 9000 action block;
|
||||
};
|
||||
ipv6 {
|
||||
table dn42v6;
|
||||
import filter {
|
||||
if is_dn42_prefix() && !dn42_is_self_net_v6() then accept;
|
||||
reject;
|
||||
};
|
||||
export filter { if is_dn42_prefix() && source ~ [RTS_STATIC, RTS_BGP] then accept; else reject; };
|
||||
import limit 9000 action block;
|
||||
};
|
||||
}
|
||||
|
||||
template bgp dn42_ibgp {
|
||||
graceful restart;
|
||||
local as DN42_ASN;
|
||||
med metric;
|
||||
direct;
|
||||
ipv4 {
|
||||
table dn42v4;
|
||||
next hop self;
|
||||
gateway direct;
|
||||
import filter {
|
||||
if bgp_large_community ~ [(DN42_ASN, 1,*)] then reject;
|
||||
if !is_dn42_prefix() then reject;
|
||||
if dn42_is_self_net() then reject;
|
||||
accept;
|
||||
};
|
||||
export filter {
|
||||
if bgp_large_community ~ [(DN42_ASN, 1,*)] then reject;
|
||||
if !is_dn42_prefix() then reject;
|
||||
if dn42_is_self_net() then reject;
|
||||
accept;
|
||||
};
|
||||
};
|
||||
ipv6 {
|
||||
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 dn42_is_self_net_v6() then reject;
|
||||
accept;
|
||||
};
|
||||
export filter {
|
||||
if bgp_large_community ~ [(DN42_ASN, 1,*)] then reject;
|
||||
if !is_dn42_prefix() then reject;
|
||||
if dn42_is_self_net_v6() then reject;
|
||||
accept;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -2,6 +2,8 @@ include "/etc/bird/template/inet.conf";
|
||||
include "/etc/bird/template/inet_ixp.conf";
|
||||
include "/etc/bird/peers/inet/*";
|
||||
|
||||
include "/etc/bird/template/dn42.conf";
|
||||
include "/etc/bird/peers/dn42/*.conf";
|
||||
|
||||
include "/etc/bird/template/unet.conf";
|
||||
include "/etc/bird/peers/unet/*.conf";
|
||||
|
||||
@@ -1,23 +1,88 @@
|
||||
filter filter_inet4_bgp_import {
|
||||
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));
|
||||
accept;
|
||||
}
|
||||
|
||||
filter filter_inet4_bgp_export {
|
||||
if !is_self_net() then reject;
|
||||
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
||||
if source != RTS_STATIC then reject;
|
||||
if bgp_large_community !~ [(LOCAL_ASN, 200,0)] then reject;
|
||||
bgp_large_community.empty;
|
||||
accept;
|
||||
}
|
||||
|
||||
filter filter_inet6_bgp_import {
|
||||
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;
|
||||
}
|
||||
|
||||
filter filter_inet6_bgp_export {
|
||||
if !is_self_net_v6() then reject;
|
||||
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
||||
if source != RTS_STATIC then reject;
|
||||
if bgp_large_community !~ [(LOCAL_ASN, 200,0)] then reject;
|
||||
bgp_large_community.empty;
|
||||
accept;
|
||||
}
|
||||
|
||||
filter filter_inet4_ibgp_import {
|
||||
if is_self_net() then reject;
|
||||
if is_bogon_prefix() then reject;
|
||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||
accept;
|
||||
}
|
||||
|
||||
filter filter_inet4_ibgp_export {
|
||||
if is_self_net() then reject;
|
||||
if is_bogon_prefix() then reject;
|
||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||
accept;
|
||||
}
|
||||
|
||||
filter filter_inet6_ibgp_import {
|
||||
if is_self_net_v6() then reject;
|
||||
if is_bogon_prefix() then reject;
|
||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||
accept;
|
||||
}
|
||||
|
||||
filter filter_inet6_ibgp_export {
|
||||
if is_self_net_v6() then reject;
|
||||
if is_bogon_prefix() then reject;
|
||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||
accept;
|
||||
}
|
||||
|
||||
|
||||
template bgp tpl_inet_up {
|
||||
graceful restart;
|
||||
local as LOCAL_ASN;
|
||||
ipv4 {
|
||||
table inet4;
|
||||
import filter_inet4_bgp_import;
|
||||
export filter_inet4_bgp_export;
|
||||
};
|
||||
ipv6 {
|
||||
table inet6;
|
||||
import filter_inet6_bgp_import;
|
||||
export filter_inet6_bgp_export;
|
||||
};
|
||||
}
|
||||
|
||||
template bgp tpl_inet4_up {
|
||||
graceful restart;
|
||||
local as LOCAL_ASN;
|
||||
ipv4 {
|
||||
table inet4;
|
||||
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));
|
||||
accept;
|
||||
};
|
||||
export filter {
|
||||
if !is_self_net() then reject;
|
||||
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
||||
if source != RTS_STATIC then reject;
|
||||
if bgp_large_community !~ [(LOCAL_ASN, 200,0)] then reject;
|
||||
bgp_large_community.empty;
|
||||
accept;
|
||||
};
|
||||
import filter_inet4_bgp_import;
|
||||
export filter_inet4_bgp_export;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -26,21 +91,29 @@ template bgp tpl_inet6_up {
|
||||
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;
|
||||
bgp_large_community.empty;
|
||||
bgp_large_community.add((LOCAL_ASN,200,0));# 传输到Ebgp
|
||||
accept;
|
||||
};
|
||||
export filter {
|
||||
if !is_self_net_v6() then reject;
|
||||
if is_bogon_prefix() || (bgp_path.len > 100) then reject;
|
||||
if source != RTS_STATIC then reject;
|
||||
if bgp_large_community !~ [(LOCAL_ASN, 200,0)] then reject;
|
||||
bgp_large_community.empty;
|
||||
accept;
|
||||
};
|
||||
import filter_inet6_bgp_import;
|
||||
export filter_inet6_bgp_export;
|
||||
};
|
||||
}
|
||||
|
||||
template bgp tpl_inet_ibgp {
|
||||
graceful restart;
|
||||
local as LOCAL_ASN;
|
||||
med metric;
|
||||
direct;
|
||||
ipv4 {
|
||||
table inet4;
|
||||
next hop self;
|
||||
gateway direct;
|
||||
import filter_inet4_ibgp_import;
|
||||
export filter_inet4_ibgp_export;
|
||||
};
|
||||
ipv6 {
|
||||
table inet6;
|
||||
next hop self;
|
||||
gateway direct;
|
||||
import filter_inet6_ibgp_import;
|
||||
export filter_inet6_ibgp_export;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -53,18 +126,8 @@ template bgp tpl_inet4_ibgp {
|
||||
table inet4;
|
||||
next hop self;
|
||||
gateway direct;
|
||||
import filter {
|
||||
if is_self_net() then reject;
|
||||
if is_bogon_prefix() then reject;
|
||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||
accept;
|
||||
};
|
||||
export filter {
|
||||
if is_self_net() then reject;
|
||||
if is_bogon_prefix() then reject;
|
||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||
accept;
|
||||
};
|
||||
import filter_inet4_ibgp_import;
|
||||
export filter_inet4_ibgp_export;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -77,17 +140,7 @@ template bgp tpl_inet6_ibgp {
|
||||
table inet6;
|
||||
next hop self;
|
||||
gateway direct;
|
||||
import filter {
|
||||
if is_self_net_v6() then reject;
|
||||
if is_bogon_prefix() then reject;
|
||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||
accept;
|
||||
};
|
||||
export filter {
|
||||
if is_self_net_v6() then reject;
|
||||
if is_bogon_prefix() then reject;
|
||||
if bgp_large_community ~ [(LOCAL_ASN, 1,*)] then reject;
|
||||
accept;
|
||||
};
|
||||
import filter_inet6_ibgp_import;
|
||||
export filter_inet6_ibgp_export;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user