iptables - how to allow IP when it is blocked by default

Solution 1:

You're looking for "INSERT" instead of "APPEND". AFAIR you can use

iptables -I INPUT <slot> -p tcp -s xx.xx.xx.xx --dport 11211 -j ACCEPT

To insert the rule into the desired slot in the chain. To find the right slot number use iptables -nL Then start counting the rules starting with 1.

I think you can also omit the slot to have iptables inserting the new rule at the first slot (on top).

Solution 2:

Use iptables -I INPUT -p tcp -s xx.xx.xx.xx --dport 11211 -j ACCEPT this will insert the rule at the beginning of the INPUT chain and will be processed before the existing DROP rule. Iptables works from top to bottom and the 1st rule to match wins. Don't forget to save the iptables configuration once your sure it's working correctly.