Name=<%= @interface[:interface] %>
[Network]
+<% if @interface.dig(:inet6, :dhcp) -%>
+DHCP=ipv6
+<% end -%>
<% if @interface[:inet] -%>
Address=<%= @interface[:inet][:address] %>/<%== @interface[:inet][:prefix] %>
<% 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[:inet6][:dhcp][:duidtype] -%>
+DUIDType=<%= @interface[:inet6][:dhcp][:duidtype] %>
+<% end -%>
+<% if @interface[:inet6][:dhcp][:duidrawdata] -%>
+DUIDRawData=<%= @interface[:inet6][:dhcp][:duidrawdata] %>
+<% end -%>
+WithoutRA=solicit
+<% end -%>
<% if @interface.dig(:inet, :gateway) && @interface[:inet][:gateway] != @interface[:inet][:address] -%>
[Route]
<% 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] -%>
<% 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] -%>
[Route]
-<% if details[:gateway] -%>
-Gateway=<%= details[:gateway] %>
+<% if details[:via] -%>
+Gateway=<%= details[:via] %>
<% end -%>
Destination=<%= destination %>
<% if details[:metric] -%>
Type=<%= details[:type] %>
<% end -%>
<% end -%>
+<% end -%>
<% Hash(@interface.dig(:inet6, :routes)).sort.each do |destination, details| -%>
+<% unless details[:via] == @interface[:inet6][:address] -%>
[Route]
-<% if details[:gateway] -%>
-Gateway=<%= details[:gateway] %>
+<% if details[:via] -%>
+Gateway=<%= details[:via] %>
<% end -%>
Destination=<%= destination %>
<% if details[:metric] -%>
Type=<%= details[:type] %>
<% end -%>
<% end -%>
+<% end -%>