Skip to content

Basic TCP/IP sysctl hardening

2016.06.21
linuxsecuritynetworking

Add to /etc/sysctl.conf:

# SYN flood protection
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_rfc1337 = 1

# Reverse path filtering (blocks IP spoofing)
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1

# Log martian packets
net.ipv4.conf.default.log_martians = 1
net.ipv4.conf.all.log_martians = 1

# Ignore ICMP broadcast (smurf attack protection)
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1

# Disable redirects
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0

Apply:

sudo sysctl -p

Via: Arch Wiki — sysctl