5.28. 禁用 ICMP 重定向接受

当主机使用非最优或已失效的路由到达特定目的地时,路由器会使用 ICMP 重定向数据包来通知主机正确的路由应该是什么。如果攻击者能够伪造 ICMP 重定向数据包,他或她可以更改主机上的路由表,并可能通过导致流量通过您不希望的路径来破坏主机的安全性。强烈建议禁用 ICMP 重定向接受,以保护您的服务器免受此漏洞的影响。

version 6.1 only

              [root@deep] /# for f in /proc/sys/net/ipv4/conf/*/accept_redirects; do
              > echo 0 > $f
              > done
              
              [root@deep] /#
              
将上述命令添加到/etc/rc.d/rc.local脚本文件,这样下次重启系统时您就不必再次输入它们。

Version 6.2 only

编辑/etc/sysctl.conf文件并添加以下行
              # Disable ICMP Redirect Acceptance
              net.ipv4.conf.all.accept_redirects = 0
              
您必须重启网络才能使更改生效。手动重启网络的命令如下
              [root@deep] /# /etc/rc.d/init.d/network restart
              Setting network parameters	[  OK  ]
              Bringing up interface lo		[  OK  ]
              Bringing up interface eth0	[  OK  ]
              Bringing up interface eth1	[  OK  ]
              
请注意,上述命令对于 Red Hat Linux 6.1 或 6.2 将禁用所有接口(lo、ethN、pppN 等)上的重定向接受数据包。