|
198 | 198 | # |
199 | 199 | # @param collect_unicast_peers |
200 | 200 | # |
| 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 |
201 | 204 | define keepalived::vrrp::instance ( |
202 | 205 | $interface, |
203 | 206 | Integer[1,254] $priority, |
|
240 | 243 | $vmac_xmit_base = true, |
241 | 244 | Boolean $use_vmac_addr = false, |
242 | 245 | Boolean $native_ipv6 = false, |
| 246 | + Boolean $apply_sysctl_params = false, |
243 | 247 | ) { |
244 | 248 | $_name = regsubst($name, '[:\/\n]', '', 'G') |
245 | 249 | $_ordersafe = regsubst($_name, '-', '', 'G') |
|
303 | 307 | content => "}\n\n", |
304 | 308 | order => "100-${_ordersafe}-zzz", |
305 | 309 | } |
| 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 | + } |
306 | 339 | } |
0 commit comments