]> git.openstreetmap.org Git - chef.git/blob - cookbooks/networking/templates/default/network.erb
Ignore additional routes that point at ourselves
[chef.git] / cookbooks / networking / templates / default / network.erb
1 [Match]
2 Name=<%= @interface[:interface] %>
3
4 [Network]
5 <% if @interface[:inet] -%>
6 Address=<%= @interface[:inet][:address] %>/<%== @interface[:inet][:prefix] %>
7 <% end -%>
8 <% if @interface[:inet6] -%>
9 Address=<%= @interface[:inet6][:address] %>/<%== @interface[:inet6][:prefix] %>
10 <% end -%>
11 IPv6AcceptRA=no
12 <% Array(@interface[:vlans]).sort.uniq.each do |vlan| -%>
13 VLAN=<%= @interface[:interface] %>.<%= vlan %>
14 <% end -%>
15 <% if @interface.dig(:inet, :gateway) && @interface[:inet][:gateway] != @interface[:inet][:address] -%>
16
17 [Route]
18 Gateway=<%= @interface[:inet][:gateway] %>
19 GatewayOnLink=true
20 <% if @interface[:metric] -%>
21 Metric=<%= @interface[:metric] %>
22 <% end -%>
23 <% end -%>
24 <% if @interface.dig(:inet6, :gateway) && @interface[:inet6][:gateway] != @interface[:inet6][:address] -%>
25
26 [Route]
27 Gateway=<%= @interface[:inet6][:gateway] %>
28 GatewayOnLink=true
29 <% if @interface[:metric] -%>
30 Metric=<%= @interface[:metric] %>
31 <% end -%>
32 <% end -%>
33 <% Hash(@interface.dig(:inet, :routes)).sort.each do |destination, details| -%>
34 <% unless details[:via] == @interface[:inet][:address] -%>
35
36 [Route]
37 <% if details[:via] -%>
38 Gateway=<%= details[:via] %>
39 <% end -%>
40 Destination=<%= destination %>
41 <% if details[:metric] -%>
42 Metric=<%= details[:metric] %>
43 <% end -%>
44 <% if details[:type] -%>
45 Type=<%= details[:type] %>
46 <% end -%>
47 <% end -%>
48 <% end -%>
49 <% Hash(@interface.dig(:inet6, :routes)).sort.each do |destination, details| -%>
50 <% unless details[:via] == @interface[:inet6][:address] -%>
51
52 [Route]
53 <% if details[:via] -%>
54 Gateway=<%= details[:via] %>
55 <% end -%>
56 Destination=<%= destination %>
57 <% if details[:metric] -%>
58 Metric=<%= details[:metric] %>
59 <% end -%>
60 <% if details[:type] -%>
61 Type=<%= details[:type] %>
62 <% end -%>
63 <% end -%>
64 <% end -%>