# [solved] iptables - can't add match rules

## markf

I'm having trouble issuing match commands in iptables.

Example:

```
$ iptables -N ALLOW_IP

$ iptables -A ALLOW_IP -m iprange --src-range 10.0.0.1-10.0.0.2 -j ACCEPT

iptables: No chain/target/match by that name
```

I've enabled all the matching rules in the kernel, and have the file /lib/iptables/libipt_iprange.so, so i'm pretty sure i've got iprange installed.

if i mistype the src-range param (e.g. "10.0.0.1/8") it says

```
iptables v1.3.8: iprange match: Bad IP address `10.0.0.1/8'
```

so it seems to be parsing the parameter correctly before failing, but i have no idea how to fix the "no chain/target/match" error.

i've also tried enabling "extensions" use flag, but that just completely ruins iptables (as in, it gives an "ERROR: 0 not a valid target" when i try to start iptables, or if i do iptables-save).

anyone have any ideas? i'm pretty new to iptables, so any suggestions are welcome.Last edited by markf on Sun Feb 17, 2008 2:55 pm; edited 1 time in total

----------

## schachti

Is iptables or some part of it compiled as a module? Then try to load that module first... Any useful information in the output of dmesg after iptables fails?

----------

## markf

i think i've found the problem (shame)

i rechecked my kernel, and the module isn't enabled. i thought the existence of the lib/iptables/ file was a sure sign it was, and i had been looking at wrong section of the kernel too when i was looking for rules.

.. rebooted new kernel and it works like a charm.

less beer on a saturday night i think.

thanks for quick response.

----------

## Hu

To clarify, the file /lib/iptables/libipt_iprange.so is from net-firewall/iptables.  It provides the userland code that turns your command line into a command that the kernel can understand.  That is why mangling your command line changed the error message.  The userland component of iptables supported iprange and was correctly parsing it.  The error came when iptables tried to tell the kernel to use that match.

----------

