UDEV rules and forwarding rules

We are trying to migrate our current OS to BalenaOS but for me it is not clear where to put the following:

  • Custom UDEV rules:

SUBSYSTEM=="net", DEVPATH=="/devices/pci*/net/e*", NAME="lan0"

  • IP forwarding rules (net.ipv4.ip_forward=1) MASQUERADE for forwading external WIFI ports to internal devices connected via ethernet:

post-up iptables -t nat -A PREROUTING -p tcp --dport 2111 -j DNAT --to-destination

Thanks in advance

Hi @reinzor ,
The UDEV rules can go into config.json. The process is described here: https://jel.ly.fish/4592e980-3db9-4059-9aa8-dc4324b7f577.
The config.json file can be found on the running device in /mnt/boot or on the boot partition of your SD-card / flash image.
IPTables rules can be added from within an application container with host networking enabled (and possibly privileged mode too). You need be very careful to make sure you do not interfere with the IPtables rules set by docker.

1 Like

sorry accidentally copied a wrong link. Find the description of UDEV rules here: https://github.com/balena-os/meta-balena#udevrules

Thanks a lot for the quick response! This clears things up!

Please let us know if you need further support!