Skip to content

Commit

Permalink
Direct AWS IPv6 traffic in Dublin via Equinix
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Dec 20, 2024
1 parent 44166d0 commit 83e9528
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cookbooks/networking/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,14 @@
node.default_unless[:networking][:interfaces][name][:inet][:prefix] = role[:inet][:prefix]
node.default_unless[:networking][:interfaces][name][:inet][:gateway] = role[:inet][:gateway]
node.default_unless[:networking][:interfaces][name][:inet][:routes] = role[:inet][:routes]
node.default_unless[:networking][:interfaces][name][:inet][:rules] = role[:inet][:rules]
end

if interface[:inet6] && role[:inet6]
node.default_unless[:networking][:interfaces][name][:inet6][:prefix] = role[:inet6][:prefix]
node.default_unless[:networking][:interfaces][name][:inet6][:gateway] = role[:inet6][:gateway]
node.default_unless[:networking][:interfaces][name][:inet6][:routes] = role[:inet6][:routes]
node.default_unless[:networking][:interfaces][name][:inet6][:rules] = role[:inet6][:rules]
end

node.default_unless[:networking][:interfaces][name][:metric] = role[:metric]
Expand Down
34 changes: 34 additions & 0 deletions cookbooks/networking/templates/default/network.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Table=<%= @interface[:source_route_table] %>
[RoutingPolicyRule]
From=<%= @interface[:inet][:address] %>
Table=<%= @interface[:source_route_table] %>
Priority=1000
<% end -%>
<% end -%>
<% if @interface.dig(:inet6, :gateway) && @interface[:inet6][:gateway] != @interface[:inet6][:address] -%>
Expand All @@ -76,6 +77,7 @@ Table=<%= @interface[:source_route_table] %>
[RoutingPolicyRule]
From=<%= @interface[:inet6][:address] %>
Table=<%= @interface[:source_route_table] %>
Priority=1000
<% end -%>
<% end -%>
<% Hash(@interface.dig(:inet, :routes)).sort.each do |destination, details| -%>
Expand Down Expand Up @@ -110,3 +112,35 @@ Type=<%= details[:type] %>
<% end -%>
<% end -%>
<% end -%>
<% Hash(@interface.dig(:inet, :rules)).each do |rule| -%>

[RoutingPolicyRule]
<% if details[:from] -%>
From=<%= details[:from] %>
<% end -%>
<% if details[:to] -%>
To=<%= details[:to] %>
<% end -%>
<% if details[:table] -%>
Table=<%= details[:table] %>
<% end -%>
<% if details[:priority] -%>
Priority=<%= details[:priority] %>
<% end -%>
<% end -%>
<% Hash(@interface.dig(:inet6, :rules)).each do |rule| -%>

[RoutingPolicyRule]
<% if details[:from] -%>
From=<%= details[:from] %>
<% end -%>
<% if details[:to] -%>
To=<%= details[:to] %>
<% end -%>
<% if details[:table] -%>
Table=<%= details[:table] %>
<% end -%>
<% if details[:priority] -%>
Priority=<%= details[:priority] %>
<% end -%>
<% end -%>
6 changes: 3 additions & 3 deletions roles/equinix-dub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
:external => {
:zone => "dub",
:inet6 => {
:routes => {
"2600:9000::/28" => { :type => "unreachable" }
}
:rules => [
{ :to => "2600:9000::/28", :table => 150, :priority => 100 }
]
}
}
}
Expand Down

0 comments on commit 83e9528

Please sign in to comment.