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 <% if interface[:interface] =~ /\.\d+$/ -%>
18 vlan-raw-device <%= interface[:interface].split(".").first %>
20 address <%= interface[:address] %>
21 <% if interface[:family] == "inet" -%>
22 netmask <%= interface[:netmask] %>
23 <% elsif interface[:family] == "inet6" -%>
24 netmask <%= interface[:prefix] %>
26 <% if interface[:hwaddress] -%>
27 hwaddress <%= interface[:hwaddress] %>
29 <% if interface[:gateway] -%>
30 <% if interface[:network].include?(interface[:gateway]) or IPAddr.new("fe80::/64").include?(interface[:gateway]) -%>
31 gateway <%= interface[:gateway] %>
32 metric <%= interface[:metric] %>
34 post-up /sbin/ip -f <%= interface[:family] %> route add <%= interface[:gateway] %> dev <%= interface[:interface] %>
35 post-up /sbin/ip -f <%= interface[:family] %> route add default metric <%= interface[:metric] %> via <%= interface[:gateway] %>
36 pre-down /sbin/ip -f <%= interface[:family] %> route del default metric <%= interface[:metric] %> via <%= interface[:gateway] %>
37 pre-down /sbin/ip -f <%= interface[:family] %> route del <%= interface[:gateway] %> dev <%= interface[:interface] %>
40 <% if interface[:mtu] -%>
41 mtu <%= interface[:mtu] %>
43 <% if interface[:family] == "inet6" -%>
46 <% if interface[:bond] -%>
47 bond-mode <%= interface[:bond][:mode] || "active-backup" %>
49 bond-primary <%= interface[:bond][:slaves].first %>
50 bond-miimon <%= interface[:bond][:miimon] || 100 %>
51 <% if interface[:bond][:xmithashpolicy] -%>
52 bond_xmit_hash_policy <%= interface[:bond][:xmithashpolicy] %>
54 bond-downdelay <%= interface[:bond][:downdelay] || 200 %>
55 bond-updelay <%= interface[:bond][:updelay] || 200 %>
60 auto lo <%= node[:networking][:interfaces].collect { |n,i| i[:interface] }.compact.sort.uniq.join(" ") %>