sysctl.si › Parameters › net.ipv4.ip_forward

net.ipv4.ip_forward

Allows the machine to route packets between interfaces.

Default
0
Typical value
1 on routers and container hosts

When to change it

Required for routers, VPN gateways and container hosts. Enabling it on other machines can turn them into unintended routers.

Check the current value

sysctl net.ipv4.ip_forward

Change it until the next reboot

sudo sysctl -w net.ipv4.ip_forward=1

Make it permanent

echo "net.ipv4.ip_forward = 1" | sudo tee /etc/sysctl.d/99-custom.conf
sudo sysctl --system

Related parameters

net.core.somaxconn · net.ipv4.tcp_max_syn_backlog · net.core.netdev_max_backlog · net.core.rmem_max · net.core.wmem_max · net.ipv4.tcp_congestion_control · net.core.default_qdisc · net.ipv4.tcp_tw_reuse

Generate a full sysctl config for your server

Values are starting points. Test on a staging machine and measure before and after.