1 # DO NOT EDIT - This file is being maintained by Chef
4 <% node[:networking][:interfaces].each do |name,interface| -%>
5 <% if interface[:interface] -%>
6 <% if interface[:bond] -%>
7 <% interface[:bond][:slaves].each do |slave| -%>
9 iface <%= slave %> inet manual
10 bond-master <%= interface[:interface] %>
13 auto <%= interface[:bond][:slaves].sort.uniq.join(" ") %>
16 iface <%= interface[:interface] %> <%= interface[:family] %> static
17 address <%= interface[:address] %>
18 <% if interface[:family] == "inet" -%>
19 netmask <%= interface[:netmask] %>
20 <% elsif interface[:family] == "inet6" -%>
21 netmask <%= interface[:prefix] %>
23 <% if interface[:hwaddress] -%>
24 hwaddress <%= interface[:hwaddress] %>
26 <% if interface[:gateway] -%>
27 <% if interface[:network].include?(interface[:gateway]) or IPAddr.new("fe80::/64").include?(interface[:gateway]) -%>
28 gateway <%= interface[:gateway] %>
29 metric <%= interface[:metric] %>
31 post-up /sbin/ip -f <%= interface[:family] %> route add <%= interface[:gateway] %> dev <%= interface[:interface] %>
32 post-up /sbin/ip -f <%= interface[:family] %> route add default metric <%= interface[:metric] %> via <%= interface[:gateway] %>
33 pre-down /sbin/ip -f <%= interface[:family] %> route del default metric <%= interface[:metric] %> via <%= interface[:gateway] %>
34 pre-down /sbin/ip -f <%= interface[:family] %> route del <%= interface[:gateway] %> dev <%= interface[:interface] %>
37 <% if interface[:mtu] -%>
38 mtu <%= interface[:mtu] %>
40 <% if interface[:family] == "inet6" -%>
43 <% if interface[:bond] -%>
44 bond-mode <%= interface[:bond][:mode] || "active-backup" %>
46 bond-primary <%= interface[:bond][:slaves].first %>
47 bond-miimon <%= interface[:bond][:miimon] || 100 %>
48 bond-downdelay <%= interface[:bond][:downdelay] || 200 %>
49 bond-updelay <%= interface[:bond][:updelay] || 200 %>
54 auto lo <%= node[:networking][:interfaces].collect { |n,i| i[:interface] }.compact.sort.uniq.join(" ") %>