]> git.openstreetmap.org Git - chef.git/commitdiff
Direct AWS IPv6 traffic in Dublin via Equinix
authorTom Hughes <tom@compton.nu>
Fri, 20 Dec 2024 16:48:58 +0000 (16:48 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 20 Dec 2024 16:53:07 +0000 (16:53 +0000)
cookbooks/networking/recipes/default.rb
cookbooks/networking/templates/default/network.erb
roles/equinix-dub.rb

index 2f60280f06172dec3ba73f8f80c6fae6abcecfaa..2b4d9676107cd738d230e7ca8d7f237282b90cf6 100644 (file)
@@ -78,12 +78,14 @@ node[:networking][:interfaces].each do |name, interface|
     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]
index d2c34bfbf24559fe9dfc44e9c3c0e96fc9c7c960..7f38de3c563d14bd1f37d13c08129766d94c6d1e 100644 (file)
@@ -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] -%>
@@ -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| -%>
@@ -110,3 +112,35 @@ Type=<%= details[:type] %>
 <% end -%>
 <% end -%>
 <% end -%>
+<% Array(@interface.dig(:inet, :rules)).each do |rule| -%>
+
+[RoutingPolicyRule]
+<% if rule[:from] -%>
+From=<%= rule[:from] %>
+<% end -%>
+<% if rule[:to] -%>
+To=<%= rule[:to] %>
+<% end -%>
+<% if rule[:table] -%>
+Table=<%= rule[:table] %>
+<% end -%>
+<% if rule[:priority] -%>
+Priority=<%= rule[:priority] %>
+<% end -%>
+<% end -%>
+<% Array(@interface.dig(:inet6, :rules)).each do |rule| -%>
+
+[RoutingPolicyRule]
+<% if rule[:from] -%>
+From=<%= rule[:from] %>
+<% end -%>
+<% if rule[:to] -%>
+To=<%= rule[:to] %>
+<% end -%>
+<% if rule[:table] -%>
+Table=<%= rule[:table] %>
+<% end -%>
+<% if rule[:priority] -%>
+Priority=<%= rule[:priority] %>
+<% end -%>
+<% end -%>
index 11e6ea85d971988d40649c2199fcae4e7acf2dfa..6561d30193bec5aa45adad36296b8234de8e223e 100644 (file)
@@ -25,9 +25,9 @@ default_attributes(
       :external => {
         :zone => "dub",
         :inet6 => {
-          :routes => {
-            "2600:9000::/28" => { :type => "unreachable" }
-          }
+          :rules => [
+            { :to => "2600:9000::/28", :table => 150, :priority => 100 }
+          ]
         }
       }
     }