Skip to content

Instantly share code, notes, and snippets.

@bswinnerton
Created December 14, 2019 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bswinnerton/6b7527bc9d78215275c1ae75e64d34cd to your computer and use it in GitHub Desktop.
Save bswinnerton/6b7527bc9d78215275c1ae75e64d34cd to your computer and use it in GitHub Desktop.
protocol bgp core_nyiix_14 from core4 {
description "Neptune Networks - Telehouse core";
local 169.254.253.1 as 397143;
neighbor 169.254.253.2 as 397143;
}
template bgp core4 {
hold time 90;
keepalive time 30;
graceful restart;
ipv4 {
next hop self;
import keep filtered;
import filter {
if is_v4_bogon() then reject;
if is_v4_default() then reject;
krt_prefsrc=23.157.160.1;
accept;
};
export filter {
if is_v4_bogon() then reject;
if is_v4_default() then reject;
if is_v4_peering_net() then reject;
if is_v4_neptune_networks() then accept;
if source = RTS_BGP then accept;
reject;
};
};
}
function is_v4_bogon() {
return net ~ [
0.0.0.0/8+, # RFC 1122 'this' network
10.0.0.0/8+, # RFC 1918 private space
100.64.0.0/10+, # RFC 6598 Carrier grade nat space
127.0.0.0/8+, # RFC 1122 localhost
169.254.0.0/16+, # RFC 3927 link local
172.16.0.0/12+, # RFC 1918 private space
192.0.2.0/24+, # RFC 5737 TEST-NET-1
192.88.99.0/24+, # RFC 7526 6to4 anycast relay
192.168.0.0/16+, # RFC 1918 private space
198.18.0.0/15+, # RFC 2544 benchmarking
198.51.100.0/24+, # RFC 5737 TEST-NET-2
203.0.113.0/24+, # RFC 5737 TEST-NET-3
224.0.0.0/4+, # multicast
240.0.0.0/4+ # reserved
];
}
function is_v4_default () {
return net = 0.0.0.0/0;
}
function is_v4_peering_net () {
return net ~ [
198.32.160.0/23+, # NYIIX
185.1.119.0/24+, # LocIX
193.189.82.0/23+ # KleyReX
];
}
function is_v4_neptune_networks () {
if is_v4_internal_neptune_networks() then return true;
if is_v4_external_neptune_networks() then return true;
return false;
}
function is_v4_internal_neptune_networks () {
return net ~ [
23.157.160.0/24{25,32}
];
}
function is_v4_external_neptune_networks () {
return net ~ [
23.157.160.0/24
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment