• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to disable ICMP redirects on CentOS/RHEL

By admin

In this post, we will see how to disable ICMP redirect processing, which may help maintain network connectivity in situations where a confused switch or network server shunts traffic away from the selected path.

Disable ICMP Redirect From The Command Line

ICMP Redirect processing can be turned off until the next reboot via the command line, as shown below.

For all network interfaces:

# /sbin/sysctl -w net.ipv4.conf.all.accept_redirects = 0
# /sbin/sysctl -w net.ipv4.conf.all.send_redirects   = 0
# /sbin/sysctl -w net.ipv6.conf.all.accept_redirects = 0
# /sbin/sysctl -w net.ipv6.conf.all.send_redirects   = 0

For a selected network interface, such as eth0:

# /sbin/sysctl -w net.ipv4.conf.eth0.accept_redirects = 0
# /sbin/sysctl -w net.ipv4.conf.eth0.send_redirects   = 0
# /sbin/sysctl -w net.ipv6.conf.eth0.accept_redirects = 0
# /sbin/sysctl -w net.ipv6.conf.eth0.send_redirects   = 0

Disable ICMP Redirect Persistently

Create the file /etc/sysctl.d/50-icmp_redirect.conf with the lines:

# Uncomment the lines below as needed.

# Disable ICMP Redirect Globally
# net.ipv4.conf.all.accept_redirects = 0
# net.ipv4.conf.all.send_redirects   = 0
# net.ipv6.conf.all.accept_redirects = 0
# net.ipv6.conf.all.send_redirects   = 0

# Disable ICMP Redirect For A Selected NIC
# net.ipv4.conf.eth0.accept_redirects = 0
# net.ipv4.conf.eth0.send_redirects   = 0
# net.ipv6.conf.eth0.accept_redirects = 0
# net.ipv6.conf.eth0.send_redirects   = 0

Uncomment the lines appropriate for your deployment. The change will persist across reboots.

Apply the settings in current environment:

# sysctl --system       ## for CentOS/RHEL 7 and above
# sysctl -p             ## for CentOS/RHEL 6

Filed Under: CentOS/RHEL, CentOS/RHEL 6, CentOS/RHEL 7

Some more articles you might also be interested in …

  1. SSH Login Stuck At : “debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP” CentOS/RHEL 7
  2. lvdisplay error: “Failed to create directory /var/lock/lvm. File-based locking initilisation failed.”
  3. Understanding The /proc File System
  4. How To Separate Each Of Syslog Client’s Messages Into Different File (CentOS/RHEL 6 and 7)
  5. What are the Network Bonding Modes In CentOS / RHEL
  6. How to Disable the ‘lvm2-lvmetad.socket/service’ on CentOS/RHEL 7
  7. Features of the “Btrfs” Filesystem
  8. How to Configure Logical Volume Manager for Cluster File System
  9. Starting iptables Fails with Error “Another app is currently holding the xtables lock”
  10. How to configure postifx smtp relay in CentOS/RHEL 5 and 6

You May Also Like

Primary Sidebar

Recent Posts

  • SQL script to find tables that are fragmented
  • TRUNCATE TABLE not releasing space from tablespace
  • How to reclaim entire space of an oracle database table with “Truncate Table” statement
  • Oracle SQL Script to Report Tablespace Free and Fragmentation
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary