From Hal Pomeranz on Mon, 26 Jul 1999
I admit that I'm being lazy and not searching for the answer in a FAQ, but could you tell me the right incantation under Linux to disable IP forwarding on multi-homed machines. Thanks muchly in advance!
It's already the default setting for most Linux kernels. However, you can force it with:
echo 0 > /proc/sys/net/ipv4/ip_forward
(you can 'cat' the contents of that node to view the current setting). It's more commonly necessary to use:
echo 1 > /proc/sys/net/ipv4/ip_forward
... to ENABLE the forwarding.
Of course this assumes that you have /proc enabled in your Linux kernel (also the default and STRONGLY recommended). I believe there's also a sysctl() interface to this, in case you've stubbornly built your system without /proc support (and replaced the entire procps suite of utilities including your 'ps' command).