Skip to content

Commit fc52966

Browse files
author
Kim Klotz
committed
add option to set interface params recommended by keepalived
1 parent a08c9d9 commit fc52966

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]', '')
245249
$unicast_peer_array = [$unicast_peers].flatten
@@ -297,4 +301,33 @@
297301
content => "}\n\n",
298302
order => "100-${_name}-zzz",
299303
}
304+
305+
if $apply_sysctl_params {
306+
ensure_resource('sysctl::value', "net.ipv4.conf.${virtual_ipaddress_int}.arp_ignore", {
307+
value => '1',
308+
})
309+
ensure_resource('sysctl::value', "net.ipv4.conf.${virtual_ipaddress_int}.arp_filter", {
310+
value => '1',
311+
})
312+
313+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp/${virtual_router_id}.accept_local", {
314+
value => '1',
315+
})
316+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp/${virtual_router_id}.arp_ignore", {
317+
value => '1',
318+
})
319+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp/${virtual_router_id}.rp_filter", {
320+
value => '0',
321+
})
322+
323+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp6/${virtual_router_id}.accept_local", {
324+
value => '1',
325+
})
326+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp6/${virtual_router_id}.arp_ignore", {
327+
value => '1',
328+
})
329+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp6/${virtual_router_id}.rp_filter", {
330+
value => '0',
331+
})
332+
}
300333
}

0 commit comments

Comments
 (0)