Blog Home
Updated: 2023 Oct 09

How to enable IP Forwarding in Linux

Check if IP Forwarding is enabled

sudo sysctl net.ipv4.ip_forward

if the output value is 1, it means it is on. otherwise, we move on to the next step.

Enable IP forwarding

Temporary enable

sysctl -w net.ipv4.ip_forward=1

Permanent enable

open the file /etc/sysctl.conf, use your favourite text editing tool.

sudo emacs /etc/sysctl.conf

add the following line. and save and exit.

net.ipv4.ip_forward=1

save ip forwarind in kernel.

sysctl -p

Comments:

Email questions, comments, and corrections to hi@smartisan.dev.

Submissions may appear publicly on this website, unless requested otherwise in your email.