Please help guyz, I am not able to add iptables rule..

On the computer on which I have to login, Shoreline is installed.I know I can add rule to /etc/shoreline/rules but I decided to manually enter an iptable rule by typing:

/sbin/iptables -A local2fw -s 10.100.98.74 -p tcp -m tcp --dport 22 -j ACCEPT 

FULL iptables-save output is here(before command) After I executed the command, OUTPUT

Then why am I not able to login using 10.100.98.74... I get connection refused error... And I can login ssh using other ips listed in the rule...

Tell me what more info do u need.. What can be the probable cause?

link|improve this question

67% accept rate
feedback

1 Answer

up vote 3 down vote accepted

What can be the probable cause?

The most likely reason this isn't working is the order of the rules.

See:

-A local2fw -s 10.100.56.42 -j ACCEPT 
-A local2fw -j all2all 
-A local2fw -s 10.100.98.74 -p tcp -m tcp --dport 22 -j ACCEPT 

By issuing a -A local2fw your rule is being appended to that change. But if you look the last rule on the chain before you add that rule sends everything to a different chain. By appending that rule after the jump nothing gets to the rule.

You could trying passing -I option instead of -A to insert the rule at some position.

link|improve this answer
You are right.. That solved the issue. Thanx – Shadyabhi Jun 21 '10 at 11:00
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.