|
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]', '') |
245 | 249 | $unicast_peer_array = [$unicast_peers].flatten |
|
297 | 301 | content => "}\n\n", |
298 | 302 | order => "100-${_name}-zzz", |
299 | 303 | } |
| 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 | + } |
300 | 333 | } |
0 commit comments