]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/networking/templates/default/network.erb
Fix online detection for bond interfaces
[chef.git] / cookbooks / networking / templates / default / network.erb
index 431330e2c7a28700c6d1fd6a9d1331f8b6d7b54b..d2c34bfbf24559fe9dfc44e9c3c0e96fc9c7c960 100644 (file)
@@ -15,6 +15,12 @@ IPv6AcceptRA=no
 <% Array(@interface[:vlans]).sort.uniq.each do |vlan| -%>
 VLAN=<%= @interface[:interface] %>.<%= vlan %>
 <% end -%>
 <% Array(@interface[:vlans]).sort.uniq.each do |vlan| -%>
 VLAN=<%= @interface[:interface] %>.<%= vlan %>
 <% end -%>
+<% if @interface[:interface] =~ /^bond\d+$/ && node[:packages][:systemd][:version].to_i < 254 -%>
+
+[Link]
+RequiredFamilyForOnline=ipv4
+RequiredForOnline=degraded-carrier
+<% end -%>
 <% if @interface.dig(:inet6, :dhcp) -%>
 
 [DHCPv6]
 <% if @interface.dig(:inet6, :dhcp) -%>
 
 [DHCPv6]
@@ -34,6 +40,20 @@ GatewayOnLink=true
 <% if @interface[:metric] -%>
 Metric=<%= @interface[:metric] %>
 <% end -%>
 <% if @interface[:metric] -%>
 Metric=<%= @interface[:metric] %>
 <% end -%>
+<% if @interface[:source_route_table] -%>
+
+[Route]
+Gateway=<%= @interface[:inet][:gateway] %>
+GatewayOnLink=true
+<% if @interface[:metric] -%>
+Metric=<%= @interface[:metric] %>
+<% end -%>
+Table=<%= @interface[:source_route_table] %>
+
+[RoutingPolicyRule]
+From=<%= @interface[:inet][:address] %>
+Table=<%= @interface[:source_route_table] %>
+<% end -%>
 <% end -%>
 <% if @interface.dig(:inet6, :gateway) && @interface[:inet6][:gateway] != @interface[:inet6][:address] -%>
 
 <% end -%>
 <% if @interface.dig(:inet6, :gateway) && @interface[:inet6][:gateway] != @interface[:inet6][:address] -%>
 
@@ -43,6 +63,20 @@ GatewayOnLink=true
 <% if @interface[:metric] -%>
 Metric=<%= @interface[:metric] %>
 <% end -%>
 <% if @interface[:metric] -%>
 Metric=<%= @interface[:metric] %>
 <% end -%>
+<% if @interface[:source_route_table] -%>
+
+[Route]
+Gateway=<%= @interface[:inet6][:gateway] %>
+GatewayOnLink=true
+<% if @interface[:metric] -%>
+Metric=<%= @interface[:metric] %>
+<% end -%>
+Table=<%= @interface[:source_route_table] %>
+
+[RoutingPolicyRule]
+From=<%= @interface[:inet6][:address] %>
+Table=<%= @interface[:source_route_table] %>
+<% end -%>
 <% end -%>
 <% Hash(@interface.dig(:inet, :routes)).sort.each do |destination, details| -%>
 <% unless details[:via] == @interface[:inet][:address] -%>
 <% end -%>
 <% Hash(@interface.dig(:inet, :routes)).sort.each do |destination, details| -%>
 <% unless details[:via] == @interface[:inet][:address] -%>