CentOS / RHEL : How to add a null route in Linux

As Per the ip man page, there are three route types which will drop traffic in specific ways:

Route types:

unreachable – these destinations are unreachable. Packets are discarded and the ICMP message host unreachable is generated. The local senders get an EHOSTUNREACH error.

blackhole – these destinations are unreachable. Packets are discarded silently. The local senders get an EINVAL error.

prohibit – these destinations are unreachable. Packets are discarded and the ICMP message communication administratively prohibited is generated. The local senders get an EACCES error.

The null route or the blackhole route can be addded with the help of ip command using the blackhole route type. In the example here, we silently drop any packets destined for the 10.192.168.0/24 network:

# ip route add blackhole 10.192.168.0/24
Related Post