Tuesday, May 21, 2013

Python-Iptables libiptc version error

Python-iptables is a Python project that provides bindings to the iptables C libraries in Linux.


Hey Readers/Programmers,

If you are here then you must be getting an error like :

iptc.ip4tc.IPTCError: can't initialize filter: libiptc version error

or
File "/usr/local/lib/python2.7/dist-packages/iptc/ip4tc.py", line 1143, in __new__
    obj = Chain._cache.get(table.name + "." + name, None)
AttributeError: 'str' object has no attribute 'name'


After rigorous googling of 2 hrs i found the solution

Follow the step mentioned below

Firstly type in terminal 
 
#lsmod | grep ip 


to check the kernel modules  




If the output does not contains the modules shown below

ip_tables
ip_conntrack
iptable_filter
ipt_state





then it means these modules aren't loaded, then use the following commands to load these modules:

#modprobe ip_tables
#modprobe ip_conntrack
#modprobe iptable_filter
#modprobe ipt_state



 
Thank you!!