How to enable IPv4 forwarding in Alpine Linux

You can run this simple command as root to enable IPv4 forwarding in Alpine Linux:

sysctl -w net.ipv4.ip_forward=1

This setting will not persist after reboot.

In order to make the setting persist, append net.ipv4.ip_forward=1 to /etc/sysctl.conf:

echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf