Thursday, June 28, 2012

Delete iptables Rule - The Easy Way

Iptables is the name of the basic firewall installed in linux servers.

Check if iptables has listed your IP.
----
root@server1 [~]# iptables -nL | grep 115.248.152.21
DROP all -- 115.248.152.21 0.0.0.0/0
DROP all -- 0.0.0.0/0 115.248.152.21
----

Run iptables-save | grep 115.248.152.21 to get the exact rule command used to enabled the block. You will get output similar to this:
----
root@server1 [~]# iptables-save | grep 115.248.152.21
-A LOCALINPUT -s 115.248.152.21/32 ! -i lo -j DROP
-A LOCALOUTPUT -d 115.248.152.21/32 ! -o lo -j DROP
----
Take this command, replace the -A with -D and run it through iptables.
----
root@server1 [~]# iptables -D LOCALINPUT -s 115.248.152.21/32 ! -i lo -j DROP
root@server1 [~]# iptables -D LOCALOUTPUT -d 115.248.152.21/32 ! -o lo -j DROP
----
Thats It. :)



0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews