Turn a Linux host into a simple router by enabling kernel IP forwarding and try the commands yourself. 16.11.2025 | reading time: 2 min You need a Linux box to pass packets between networks; enabling IP forwarding tells the kernel to forward IPv4 or IPv6 packets instead of acting only as an endpoint, which is the first step to building a router, gateway, or NAT host. Hands-On Example ```bash sysctl net.ipv4.ip_forward net.ipv4.ip_forward = 0 sudo sysctl -w net.ipv4.ip_forward=1 net.ipv4.ip_forward = 1 cat /proc/sys/net/ipv4/ip_forward 1 echo "net.ipv4.ip_forward=1" | sudo tee /etc/sysctl.d/99-ipforward.conf sudo sysctl --system # Optional: enable simple NAT so private clients reach the Internet sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE ``` Important details to watch Enabling forwarding is not the same as enabling NAT; forwarding simply lets packets traverse the host while NAT or firewall rules determine address translation and security, IPv6 uses the parameter net.ipv6.conf.all.forwarding, and remember to reload sysctl settings with "sudo sysctl --system" to make changes persistent across boots. When this is useful Use IP forwarding for small office gateways, lab topologies, VPN servers that bridge networks, or containers and VMs that must route traffic; but be deliberate — open forwarding without proper firewall rules can expose internal networks to risk. Complementary commands After enabling forwarding, inspect and control traffic with tools like "ip route" and "ss" or apply NAT and filtering with iptables or nftables; also check interface-specific settings in "/proc/sys/net/ipv4/conf/" when troubleshooting asymmetric routing. Next steps Try a quick lab: enable forwarding, add a NAT rule, ping from a client behind the gateway, and then tighten rules to only allow required traffic; keeping experiments controlled builds practical understanding and makes the next certification step easier. Join Bits & Bytes Academy First class LINUX exam preparation. network security setup