Skip to content

Commit b6424db

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

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

REFERENCE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,7 @@ The following parameters are available in the `keepalived::vrrp::instance` defin
11291129
* [`garp_lower_prio_repeat`](#-keepalived--vrrp--instance--garp_lower_prio_repeat)
11301130
* [`higher_prio_send_advert`](#-keepalived--vrrp--instance--higher_prio_send_advert)
11311131
* [`collect_unicast_peers`](#-keepalived--vrrp--instance--collect_unicast_peers)
1132+
* [`apply_sysctl_params`](#-keepalived--vrrp--instance--apply_sysctl_params)
11321133

11331134
##### <a name="-keepalived--vrrp--instance--interface"></a>`interface`
11341135

@@ -1490,6 +1491,15 @@ Data type: `Boolean`
14901491

14911492

14921493

1494+
Default value: `false`
1495+
1496+
##### <a name="-keepalived--vrrp--instance--apply_sysctl_params"></a>`apply_sysctl_params`
1497+
1498+
Data type: `Boolean`
1499+
1500+
Apply interface configuration recommended by keepalived project
1501+
https://github.com/acassen/keepalived/blob/master/keepalived/vrrp/vrrp_if_config.c#L23
1502+
14931503
Default value: `false`
14941504

14951505
### <a name="keepalived--vrrp--script"></a>`keepalived::vrrp::script`

manifests/vrrp/instance.pp

Lines changed: 49 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,49 @@
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+
{
314+
value => '1',
315+
},
316+
)
317+
ensure_resource('sysctl::value', "net.ipv4.conf.${virtual_ipaddress_int}.arp_filter",
318+
{
319+
value => '1',
320+
},
321+
)
322+
323+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp/${virtual_router_id}.accept_local",
324+
{
325+
value => '1',
326+
},
327+
)
328+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp/${virtual_router_id}.arp_ignore",
329+
{
330+
value => '1',
331+
},
332+
)
333+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp/${virtual_router_id}.rp_filter",
334+
{
335+
value => '0',
336+
},
337+
)
338+
339+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp6/${virtual_router_id}.accept_local",
340+
{
341+
value => '1',
342+
},
343+
)
344+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp6/${virtual_router_id}.arp_ignore",
345+
{
346+
value => '1',
347+
},
348+
)
349+
ensure_resource('sysctl::value', "net.ipv4.conf.vrrp6/${virtual_router_id}.rp_filter",
350+
{
351+
value => '0',
352+
},
353+
)
354+
}
306355
}

0 commit comments

Comments
 (0)