How to enable IPv4 forwarding in Alpine Linux

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

example.sh
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:

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

 


Check out similar posts by category: Alpine Linux, Networking