Tuesday, January 25, 2011

Unable to add an iptables RULE

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?

  • 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.

    Shadyabhi : You are right.. That solved the issue. Thanx
    From Zoredache

0 comments:

Post a Comment