I learn the rounte command can add the reject rule by:
route add -host aaa.bbb.ccc.ddd reject
But, I have no idea to display the reject rules set. How to get the all reject rules set by others ?
On Linux at least, the route
command shows reject-routes with a !
in the Flags
column, so something like:
route | egrep 'Flags|!'
will show you just the reject-routes (and the headers).
The ip
command can be used to show only these routes, they're called "unreachable" in ip
. For example:
$ sudo route add 8.8.8.8 reject
$ sudo ip route add unreachable 8.8.4.4
$ sudo ip route ls type unreachable
8.8.4.4
8.8.8.8 scope host
$