Linux Kernel /etc/sysctl.conf Security Hardening

Originally published at: https://www.cyberciti.biz/faq/linux-kernel-etcsysctl-conf-security-hardening/

How do I set advanced security options of the TCP/IP stack and virtual memory to improve the security and performance of my Linux based system? How do I configure Linux kernel to prevent certain kinds of attacks using /etc/sysctl.conf? How do I set Linux kernel parameters?