Information
The net.inet.ip.forwarding and net.inet6.ip.forwarding flags tell the system whether it can forward packets.
In FreeBSD, there are also two other services, mainly gateway and ipv6_gateway, that enable the same behind the scenes.
Setting net.inet.ip.forwarding and net.inet6.ip.forwarding to 0 ensures that a system with multiple interfaces (for example, a hard proxy), will never be able to forward packets, and therefore, never serve as a router. Also make sure that the gateway and ipv6_gateway services are disabled.
Solution
FreeBSD ships with default disabled. Stop and disable the gateway and ipv6_gateway services.
Example:
# service gateway stop
# service gateway disable
-IF- IPv6 is enabled on the system:
Example:
# service ipv6_gateway stop
# service ipv6_gateway disable
Note: If these settings appear in a canonically later file, or later in the same file, these settings will be overwritten
Impact:
IP forwarding is required on systems configured to act as a router. If these parameters are disabled, the system will not be able to perform as a router.
Many Cloud Service Provider (CSP) hosted systems require IP forwarding to be enabled. If the system runs on a CSP platform, this requirement should be reviewed before disabling IP forwarding.