LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Block and Allow IP using iptables in RedHat Linux 4.0 (https://www.linuxquestions.org/questions/linux-newbie-8/block-and-allow-ip-using-iptables-in-redhat-linux-4-0-a-744713/)

mostafaashish 08-03-2009 04:48 AM

Block and Allow IP using iptables in RedHat Linux 4.0
 
Dear Friend

I have blocked below IP by using iptables command in RedHat Linux 4.0.

Code:

iptables -A INPUT -s 192.168.0.85 -j DROP
It's now totally blocked and can't get access into web or internal network.

Please let me know how I can un-block that IP, so that it can again starts it's normal operation.

Appreciate, if you would come back at your earliest.


Regards
Pervez

Tokhs 08-03-2009 04:59 AM

Greetings,

Pervez,

To remove a block:
- ssh to the machine that has blocked the user.


- If you need to, you can search the firewall for just that IP address with:
Quote:

sudo /sbin/iptables --list --numeric --verbose | /bin/grep ipaddr, e.g.
sudo /sbin/iptables --list --numeric --verbose | /bin/grep 152.2.129.83
- When you have decided that the address is indeed blocked by the firewall,
run the following command:
Quote:

sudo /sbin/iptables --delete rule -s ipaddr/32 -d 0/0 -j DROP, e.g.
sudo /sbin/iptables --delete UNC-ACCEPT-INPUT -s 152.2.129.83/32 -d 0/0 -j DROP
- Now search for the IP address again in UNC-ACCEPT-INPUT, in case the user
ended up in the firewall more than once. All instances of the IP address
must be removed from the UNC-ACCEPT-INPUT firewall rule.


All the best

centosboy 08-03-2009 05:58 AM

Quote:

Originally Posted by mostafaashish (Post 3629338)
Dear Friend

I have blocked below IP by using iptables command in RedHat Linux 4.0.

Code:

iptables -A INPUT -s 192.168.0.85 -j DROP
It's now totally blocked and can't get access into web or internal network.

Please let me know how I can un-block that IP, so that it can again starts it's normal operation.

Appreciate, if you would come back at your earliest.


Regards
Pervez

couple of ways.

1. service iptables restart
2. iptables --list INPUT -n --line-number and then
iptables -D INPUT <linenumber>


All times are GMT -5. The time now is 07:21 PM.