1 # DO NOT EDIT - This file is being maintained by Chef
4 <% node[:networking][:interfaces].each do |name,interface| -%>
6 iface <%= interface[:interface] %> <%= interface[:family] %> static
7 address <%= interface[:address] %>
8 <% if interface[:family] == "inet" -%>
9 netmask <%= interface[:netmask] %>
10 <% elsif interface[:family] == "inet6" -%>
11 netmask <%= interface[:prefix] %>
13 <% if interface[:hwaddress] -%>
14 hwaddress <%= interface[:hwaddress] %>
16 <% if interface[:gateway] -%>
17 <% if interface[:network].include?(interface[:gateway]) or IPAddr.new("fe80::/64").include?(interface[:gateway]) -%>
18 gateway <%= interface[:gateway] %>
19 metric <%= interface[:metric] %>
21 post-up /sbin/ip -f <%= interface[:family] %> route add <%= interface[:gateway] %> dev <%= interface[:interface] %>
22 post-up /sbin/ip -f <%= interface[:family] %> route add default metric <%= interface[:metric] %> via <%= interface[:gateway] %>
23 pre-down /sbin/ip -f <%= interface[:family] %> route del default metric <%= interface[:metric] %> via <%= interface[:gateway] %>
24 pre-down /sbin/ip -f <%= interface[:family] %> route del <%= interface[:gateway] %> dev <%= interface[:interface] %>
27 <% if interface[:mtu] -%>
28 mtu <%= interface[:mtu] %>
30 <% if interface[:family] == "inet6" -%>
35 auto lo <%= node[:networking][:interfaces].collect { |n,i| i[:interface] }.sort.uniq.join(" ") %>