Information
The net.ipv4.ip_forward and net.ipv6.conf.all.forwarding flags are used to tell the system whether it can forward packets or not.
The Operating System (OS) must not enable IPv4 packet forwarding unless the system is a router.
Solution
Configure the OS to not allow IPv4 packet forwarding, unless the system is a router.
Add or edit the following line in a system configuration file, in the "/etc/sysctl.d/" directory:
net.ipv4.conf.all.forwarding=0
Remove any configurations that conflict with the above from the following locations:
/run/sysctl.d/*.conf
/usr/local/lib/sysctl.d/*.conf
/usr/lib/sysctl.d/*.conf
/lib/sysctl.d/*.conf
/etc/sysctl.conf
/etc/sysctl.d/*.conf
Load settings from all system configuration files with the following command:
# sysctl --system
Impact:
Routing protocol daemons are typically used on routers to exchange network topology information with other routers. If this software is used when not required, system network information may be unnecessarily transmitted across the network.
The sysctl --system command will load settings from all system configuration files. All configuration files are sorted by their filename in lexicographic order, regardless of which of the directories they reside in. If multiple files specify the same option, the entry in the file with the lexicographically latest name will take precedence. Files are read from directories in the following list from top to bottom. Once a file of a given filename is loaded, any file of the same name in subsequent directories is ignored.
/etc/sysctl.d/.conf
/run/sysctl.d/.conf
/usr/local/lib/sysctl.d/.conf
/usr/lib/sysctl.d/.conf
/lib/sysctl.d/*.conf
/etc/sysctl.conf