-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
70 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,43 @@ | ||
ipv6 table v6_nameservice; | ||
ipv4 table v4_nameservice; | ||
ipv6 table v6_bgpdisco | ||
ipv4 table v4_bgpdisco; | ||
|
||
# Define BGP attribute 250 for our custom nameservice extension :) | ||
attribute bgp 250 bytestring bgp_nameservice; | ||
attribute bgp 250 bytestring bgpdisco; | ||
|
||
protocol static static_nameservice_v4 { | ||
ipv4 { table v4_nameservice; }; | ||
protocol static static_bgpdisco_v4 { | ||
ipv4 { table v4_bgpdisco; }; | ||
{% for (let _rt in data): if (index(_rt, ':') == -1): %} | ||
route {{ _rt }}/32 blackhole { bgp_nameservice = hex:{{ hexenc(data[_rt]) }}; }; | ||
route {{ _rt }}/32 blackhole { bgpdisco = hex:{{ hexenc(data[_rt]) }}; }; | ||
{% endif; endfor %} | ||
}; | ||
|
||
protocol static static_nameservice_v6 { | ||
ipv6 { table v6_nameservice; }; | ||
protocol static static_bgpdisco_v6 { | ||
ipv6 { table v6_bgpdisco; }; | ||
{% for (let _rt in data): if (index(_rt, ':') != -1): %} | ||
route {{ _rt }}/128 blackhole { bgp_nameservice = hex:{{ hexenc(data[_rt]) }}; }; | ||
route {{ _rt }}/128 blackhole { bgpdisco = hex:{{ hexenc(data[_rt]) }}; }; | ||
{% endif; endfor %} | ||
} | ||
|
||
{% let i = 1; %} | ||
{% for (let neigh in neighbors): %} | ||
protocol bgp nameservice{{ i++ }} { | ||
protocol bgp bgpdisco_{{ replace(neigh.iface, '.', '_') }} { | ||
local as 65000; | ||
debug {states,events}; | ||
interface "{{ neigh[0] }}"; | ||
neighbor {{ neigh[1] }} as 65000 internal; | ||
interface "{{ neigh.iface }}"; | ||
neighbor {{ neigh.ip }} as 65000 internal; | ||
direct; | ||
ipv4 { | ||
table v4_nameservice; | ||
table v4_bgpdisco; | ||
import all; | ||
export all; | ||
gateway recursive; | ||
next hop address 192.0.2.0; | ||
}; | ||
ipv6 { | ||
table v6_nameservice; | ||
table v6_bgpdisco; | ||
import all; | ||
export all; | ||
gateway recursive; | ||
next hop address 2001:db8::; # Safe some memory by using IPv4 NH | ||
}; | ||
|
||
} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters