Information
When enabled, this feature logs packets with un-routable source addresses to the kernel log.
net.ipv4.conf.default.log_martians controls if IPv4 packets with un-routable source addresses on a newly added network interface is logged to the kernel log.
More information about the kernel parameter configuration files, their location, and load preference is available in the "Configure Network Kernel Parameters" section overview.
Setting net.ipv4.conf.default.log_martians to 1 enables this feature. Logging these packets allows an administrator to investigate the possibility that an attacker is sending spoofed packets to their system.
Solution
- Run the following command to comment out net.ipv4.conf.default.log_martians lines returned by the audit procedure that are not net.ipv4.conf.default.log_martians = 1 :
# sed -ri '^\s*net.ipv4.conf.default.log_martians\s*=\s*0/s/^/#/g' "path/to/file/in/audit/filename"
Example:
# sed -ri '/^\s*net.ipv4.conf.default.log_martians\s*=\s*0/s/^/#/g' /etc/sysctl.d/99-sysctl.conf
- Create or edit a file in the /etc/sysctl.d/ directory ending in .conf and edit or add the following line:
net.ipv4.conf.default.log_martians = 1
Example:
# [ ! -d "/etc/sysctl.d/" ] && mkdir -p /etc/sysctl.d/
# printf '%s\n' "" "net.ipv4.conf.default.log_martians = 1" >> /etc/sysctl.d/60-ipv4_sysctl.conf
- Run the following command to load all sysctl configuration files:
# sysctl --system