exit: enable forwarding directed broadcasts for WoL

Must be set in IPv4 sysctls for all interfaces and every input
interface from which broadcasts are sent. These are the virtual
MLAG interfaces (bridge-*-v0), which are created dynamically.

We enable directed broadcasts for (only MLAG) interfaces enumerated by
the ifaces_directed_broadcast value in NetBox device local context.
This commit is contained in:
Timotej Lazar 2024-09-18 14:27:30 +02:00
parent 6322d5ec97
commit ae1cfd5337
3 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,2 @@
# enable directed broadcasts for WoL, must also be enabled on input interfaces to take effect
net.ipv4.conf.all.bc_forwarding = 1

View file

@ -1,3 +1,8 @@
- name: Set up sysctls
copy:
dest: /etc/sysctl.d/local-exit.conf
src: sysctl.conf
- name: Set up networks
template:
dest: /etc/network/interfaces.d/networks.intf

View file

@ -47,6 +47,10 @@ iface {{ iface.name }}
{% set fhrp_assignment = fhrp_assignments | selectattr('interface.id', '==', iface.id) | first %}
{% set fhrp_group = fhrp_groups | selectattr('id', '==', fhrp_assignment.group.id) | first %}
address-virtual 00:00:5e:00:01:01 {{ fhrp_group.ip_addresses | sort(attribute='family.value') | map(attribute='address') | join(' ') }}
{% if iface.name in ifaces_directed_broadcast|default([]) %}
{# Enable directed broadcast forwarding from this interface for WoL. #}
post-up echo 1 > /proc/sys/net/ipv4/conf/{{ iface.name | replace('.', '-') }}-v0/bc_forwarding
{% endif %}
{% endif %}
{% endfor %}