iptables: Memory allocation problem and a way to solve it
Posted in Serverside stuff May 23rd, 2007 by pa

So your server is sending errormessages liks this one:

iptables: Memory allocation problem
iptables v1.2.8: Couldn’t load target `acctboth’:/lib/iptables/libipt_acctboth.so: cannot open shared object file: No such file or directory
Try `iptables -h’ or ‘iptables –help’ for more information. iptables v1.2.8: Couldn’t load target `acctboth’:/lib/iptables/libipt_acctboth.so: cannot open shared object file: No such file or directory
Try `iptables -h’ or ‘iptables –help’ for more information.
iptables: No chain/target/match by that name
iptables: No chain/target/match by that name
iptables: No chain/target/match by that name
iptables: No chain/target/match by that name
iptables: No chain/target/match by that name
etc…

iptables: No chain/target/match by that name iptables: Table does not exist (do you need to insmod?)
iptables: Table does not exist (do you need to insmod?)

This error is most likely being caused by your number of blocked ip’s being full ( * numiptent).

(* There is a restriction on the total number of IP packet filtering entries in the system. The numiptent parameter limits number of NETFILTER (IP packet filtering) entries. High numiptent settings causes considerable slowdown of processing of network packets. The recommended numiptent limit is between 200-300 entries.)

How to solve it
The solution when this happens is either to increase the number of ip’s to block or to restart iptables and flush the file.
Preferrably you do this with ssh using the command: service iptables restart, or maybe login to your Virtuozzopanel or whatever panel you are using and restart iptables.

But a more convinient way is to create a cron job that does this every day or so.

How to set up a cron job to restart iptables
Create the file iptables.cron and throw it in to: /etc/cron.daily/

Put these lines into the file:
#!/bin/sh
/etc/init.d/iptables restart

Now save and you are done. No more iptables: Memory allocation problem.