Netipv4ipforward
Net.ipv4.ip_forward is a Linux kernel parameter that controls IPv4 packet forwarding. When enabled, the kernel can forward IPv4 packets between network interfaces, allowing the host to function as a router or gateway. When disabled, the system will not route packets between interfaces, effectively acting as an end host.
Typically, net.ipv4.ip_forward is 0 by default on most distributions to avoid unintended routing. The value is
To enable, use echo 1 > /proc/sys/net/ipv4/ip_forward or sysctl -w net.ipv4.ip_forward=1. To disable again, set to 0.
To persist across reboots, set net.ipv4.ip_forward = 1 in /etc/sysctl.conf or add a file under /etc/sysctl.d with
Even with IP forwarding enabled, traffic must be properly routed and permitted by the firewall. In practice,
Disabling IP forwarding can mitigate exposure; only enable on systems serving as gateways or routers. In addition