tcpdump showed me there are some ICMP-redirect in my network (KVM virtual-machines, bridged network). I decided to take a closer look on them and how my system behaves and how it looks. I found it doesn't work as it should:

Let say I'm on and I ping

# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=63 time=0.569 ms
From icmp_seq=2 Redirect Host(New nexthop:
64 bytes from icmp_seq=2 ttl=63 time=0.690 ms
From icmp_seq=3 Redirect Host(New nexthop:

as you can see I get multiple redirects to which looks fine but for some reason my host ( ignores it.

# sysctl -a|grep accept_redirects
net.ipv4.conf.all.accept_redirects = 1
net.ipv4.conf.default.accept_redirects = 1
net.ipv4.conf.eth0.accept_redirects = 1
net.ipv4.conf.lo.accept_redirects = 1

and there is no entry for that new route in ip route list and ip route list cache is empty.

Kernel version is:

# uname -a
Linux foo.bar 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u3 (2016-01-17) x86_64 GNU/Linux

Changing /proc/sys/net/ipv4/conf/*/accept_redirects values 0|1, networking restart or even reboot didn't worked.

I wish to accept ICMP redirects - any ideas ?


# ip -d route

unicast default via dev eth0  proto boot  scope global 
unicast dev eth0  proto kernel  scope link  src
unicast dev eth0  proto boot  scope link 
  • would you please add to the post ip -d route? – Rui F Ribeiro Mar 8 '16 at 16:12
  • sure, updated but I guess there's nothing interesting (I'm sorry but I need to hide real IPs - regardless if those are internal or not). I wonder if that behaviour can be related to some other /proc/sys/net setting but I didn't find anything interesting (*timeout*, *cache* etc.) – pawel7318 Mar 8 '16 at 16:25
  • Do you have firewall rules in your host machine? – Willian Paixao Mar 8 '16 at 16:27
  • 1
    Something about net.ipv4.conf.eth0.secure_redirects? – Stéphane Chazelas Mar 8 '16 at 16:30
  • no iptables rules, all secure_redirects set to 1 - but above redirects are sent by the default gateway ( in my examples) – pawel7318 Mar 8 '16 at 16:45

ICMP redirects are sent to define a better route/gateway to a destination.

As you have to have an IP address in the same network as the gateway/exit for a route, the route will only be inserted in the routing table if all the following conditions are true:

  • accept_redirects is set to 1
  • the machine in question has an interface with an address that belongs to the network of the gateway
  • it does not have an IP address in the same network as the destination route.

otherwise the route will be discarded.

I would not accept blindly redirects as there known security implications with spoofed ICMP redirects. ICMP redirects may also mask transient network malfunctions, or network design mistakes.

What are ICMP redirects and should they be blocked?

  • 1
    and the machine in question has an interface with an address that belongs to the network - that is the reason why it ignored it ! – pawel7318 Mar 8 '16 at 18:08

To add to Rui F Ribeiro's answer:

You may also have to disable secure_redirects, as that defaults to 1 now and rejects redirect destinations that aren't already one of the existing gateways.

Alternatively, if you can add the destination IP as a second default gateway for the same interface, perhaps with a lower metric, that should work too. If someone knows how to do that, please comment.

  • Technically your answer to the question is correct, +1. I do however prefer to fix the underlying network problem (lack of route, router down, other problems rather than enabling ICMP redirects) – Rui F Ribeiro Sep 5 '18 at 17:42
  • Good point Rui. Where I ran into this is when I had a host placed on a subnet connecting a core router to the firewall. The default gateway was set to the core router, but that was redirecting all internet bound traffic to the firewall. The correct fix would be to put the host on a different subnet, but by then we had other things relying on it being at that location. So I worked around it by setting the default gateway to the firewall and adding a static route for internal traffic. – petiepooo Sep 7 '18 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.