Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to write a script which runs a command or a bunch of commands to check if connection tracking is enabled. Or if any connection is being tracked. Basically knowing if any iptables rule is added that would track connections or is tracking connections.

Any suggestions? I have been trying out thing with listing tables with iptables list commands but I think there should be a more straightforward way.

share|improve this question

1 Answer 1

Is there some reason why conntrack or netstat-nat already do this?

share|improve this answer
    
conntrack tools doesn't exactly capture my requirement. Let me re-phrase my requirements, If I run a conntrack command conntrack -L -s 10.1.1.30 -d 10.1.1.40 and see zero entries returned, it could be because of two reasons. One is that none of the entries match the query, the other is no configuration enabling connection tracking. So, how do I find that out if no configuration has been applied with a command or a script. I can write the script, just need the idea. Thanks. sorry for being a bit ambiguous. –  Gaurav Sinha Dec 13 '11 at 18:10
    
Can you possibly update your question and elaborate? It is not entirely clear to me what you are asking for. –  Zoredache Dec 13 '11 at 18:11
    
Finally I was able to do it with parsing the command output "iptables -L -t <table>". I checked for hooks that are well defined for the system I work on and it works fine. –  Gaurav Sinha Dec 16 '11 at 21:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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