-1

To block a single IP address I'm using the following:

/sbin/route add -host 192.168.0.0 127.0.0.1

Is it possible to block an range of the IP addresses using the route?

I have tried the tips found on google like:

/sbin/route add 192.168.0.0/24
/sbin/route add -net 192.168.0.0/24 -blackhole

But none of them seem to work.

Lucas
  • 163
  • 3
  • 10

1 Answers1

4

Blackholing an IP:

/sbin/route add 192.168.0.1 127.0.0.1 -blackhole

Blackholing a range:

/sbin/route add -net 192.168.0.0/24 127.0.0.1 -blackhole

To make it permanent edit /etc/rc.conf:

static_routes=”d1 d2″
route_d1=”-net 192.168.0.0/16 127.0.0.1 -blackhole”
route_d2=”-net 10.0.0.0/8 127.0.0.1 -blackhole”
krugger
  • 411
  • 2
  • 4