82 lines
2.5 KiB
Plaintext
82 lines
2.5 KiB
Plaintext
template bgp tpl_bgp_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));# 传输到Ebgp
|
|
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;
|
|
};
|
|
};
|
|
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;
|
|
};
|
|
};
|
|
}
|
|
|
|
template bgp tpl_ibgp {
|
|
graceful restart;
|
|
local as LOCAL_ASN;
|
|
med metric;
|
|
direct;
|
|
ipv4 {
|
|
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;
|
|
};
|
|
};
|
|
ipv6 {
|
|
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;
|
|
};
|
|
};
|
|
}
|
|
include "/etc/bird/peers/inet/*"; |