Skip to content

Commit 4f176be

Browse files
Kim Klotzkenyon
authored andcommitted
add option to set interface params recommended by keepalived
1 parent 9f0e904 commit 4f176be

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

manifests/vrrp/instance.pp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@
198198
#
199199
# @param collect_unicast_peers
200200
#
201+
# @param apply_sysctl_params
202+
# Apply interface configuration recommended by keepalived project
203+
# https://github.com/acassen/keepalived/blob/master/keepalived/vrrp/vrrp_if_config.c#L23
201204
define keepalived::vrrp::instance (
202205
$interface,
203206
Integer[1,254] $priority,
@@ -240,6 +243,7 @@
240243
$vmac_xmit_base = true,
241244
Boolean $use_vmac_addr = false,
242245
Boolean $native_ipv6 = false,
246+
Boolean $apply_sysctl_params = false,
243247
) {
244248
$_name = regsubst($name, '[:\/\n]', '', 'G')
245249
$_ordersafe = regsubst($_name, '-', '', 'G')
@@ -303,4 +307,33 @@
303307
content => "}\n\n",
304308
order => "100-${_ordersafe}-zzz",
305309
}
310+
311+
if $apply_sysctl_params {
312+
ensure_resource('sysctl::value', "net.ipv4.conf.${virtual_ipaddress_int}.arp_ignore", {
313+
value => '1',
314+
})
315+
ensure_resource('sysctl::value', "net.ipv4.conf.${virtual_ipaddress_int}.arp_filter", {
316+
value => '1',
317+
})
318+
319+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp/${virtual_router_id}.accept_local", {
320+
value => '1',
321+
})
322+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp/${virtual_router_id}.arp_ignore", {
323+
value => '1',
324+
})
325+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp/${virtual_router_id}.rp_filter", {
326+
value => '0',
327+
})
328+
329+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp6/${virtual_router_id}.accept_local", {
330+
value => '1',
331+
})
332+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp6/${virtual_router_id}.arp_ignore", {
333+
value => '1',
334+
})
335+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp6/${virtual_router_id}.rp_filter", {
336+
value => '0',
337+
})
338+
}
306339
}

0 commit comments

Comments
 (0)