Block Hostile Host using route command

You know that apart from using IPTables to block hostile host. You can use the route command also for the job.

Just use :

route add x.x.x.x gw 127.0.0.1 lo

And the hostile IP will be blocked.

Then you can use the netstat -nr or route -n command to verify your rule. Now remember these tips are not a part of standard RHCE Training.

Then if you wish, you can use the

route delete x.x.x.x

to remove that rule.

Here is the snapshot from my machine showing the effect of the TIP.

Stage -1 – Showing proper communication between the two machines.
Stage – 2 – Showing the rule applied
Stage – 3 – Communication blocked.

PS: If you are on Facebook. Then we suggest going and liking Network NUTS Facebook Page for more tips and tricks. 

block host using route command

block host using route command

Advertisements