Skip to contentSkip to conversation

ipset and counters

DISCUSSION Husnu Demir 3 participants 14 messages Apr 22, 2013 – May 7, 2013 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I want to give a try for COUNTERS properties of IPSET. But I could not manage it;

# ipset create COUNTERS bitmap:ip  counters
ipset v6.17: Unknown argument: `counters'
Try `ipset help' for more information.
# man ipset
..
..
   counters, packets, bytes
       All set types support the optional counters option when
creating a set. If the option is specified then the set is created
with packet and byte counters per element support. The packet and byte
 counters  are  initialized  to
       zero when the elements are (re-)added to the set, unless the
packet and byte counter values are explicitly specified by the packets
and bytes options. An example when an element is added to a set with
non-zero counter values:

ipset create foo hash:ip counters

ipset add foo 192.168.1.1 packets 42 bytes 1024

..

I could not set counters. How can I activate it?

I used ipset-20130422 BUILD. And;

# autogen.sh
# ./configure
# make
# make install
# make CONFIG_IP_SET_MAX=2048 modules
# make CONFIG_IP_SET_MAX=2048 modules_install
# ipset -V
ipset v6.17, protocol version: 6

There is a ipset v6.18 bu daily build says 6.17.

Please help.

Thanks in advance.

Husnu Demir.
Network.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBAgAGBQJRdTFDAAoJEISpBAM51qlEP1oH+wfBPOQLmmU8wD+EQ83fUx85 u62Rj0S189piWKNzc4Mb/TijHjDLelGuems7CMGvlqsxSBQQtltog8+15n/GmP3I jeIGXjg4q638ax6+04q+zZwjIm7uF3axWUBuoAhEJgcf0bjjJVXg7QDJTdwWTgU0 jJVRK01NbdIT32PqmpLvlq0CtovtsOmwfv98ENVHqUPyiUjcJuzBh1SjMvZgFO6G 94tez2gevM0mRjz8Dq5J2nxzE6zlsQlGI7mQA7NHW84pTGAgeil2UG1SJV2+mlAL m2GbOL5b2bUQrtNXdLV/00EMlYOj4nZ3vhzAd0rptDKV21SiabP8pVCeQlvXI9w= =bLRy
-----END PGP SIGNATURE-----

#2 lore raw
Quoted 6 lines · Husnu Demir

I want to give a try for COUNTERS properties of IPSET. But I could not manage it;

# ipset create COUNTERS bitmap:ip  counters
ipset v6.17: Unknown argument: `counters'
Try `ipset help' for more information.

What does "ipset help bitmap:ip" says? I suspect you have multiple binaries at different paths.

Quoted 9 lines

I used ipset-20130422 BUILD. And;

# autogen.sh
# ./configure
# make
# make install
# make CONFIG_IP_SET_MAX=2048 modules
# make CONFIG_IP_SET_MAX=2048 modules_install
Quoted 4 lines
# ipset -V
ipset v6.17, protocol version: 6

There is a ipset v6.18 bu daily build says 6.17.

6.18 is a bugfix release, without any new feature. The counters will be announced in 6.19, but the master branch of the git tree already has got it (without bumping the version number).

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

          H-1525 Budapest 114, POB. 49, Hungary
#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 10 lines · Jozsef Kadlecsik
Quoted 5 lines · Husnu Demir

I want to give a try for COUNTERS properties of IPSET. But I could not manage it;

# ipset create COUNTERS bitmap:ip  counters ipset v6.17: Unknown
argument: `counters' Try `ipset help' for more information.

What does "ipset help bitmap:ip" says? I suspect you have multiple
binaries at different paths.

# ipset help bitmap:ip
ipset v6.17

Usage: ipset [options] COMMAND

..

bitmap:ip type specific options:

create SETNAME bitmap:ip range IP/CIDR|FROM-TO
[netmask CIDR] [timeout VALUE] [counters]
add SETNAME IP|IP/CIDR|FROM-TO [timeout VALUE]
[packets VALUE] [bytes VALUE]
del SETNAME IP|IP/CIDR|FROM-TO
test SETNAME IP

where IP, FROM and TO are IPv4 addresses (or hostnames),
CIDR is a valid IPv4 CIDR prefix.

Type bitmap:ip supports family INET only.

hdemir.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBAgAGBQJRdUMvAAoJEISpBAM51qlE6m0H/0gjbvn41sIYniv4MscakUsh lPZ1qu6eqWBxHC1GZUqkVMCcE0/+XpL+8R3cp4SC9p1tpX9l46jPKipiKdKki/vx QbOs/LaMniQtadkkAs5hnDCX9k40OE4m3SAQfpQG0Vf9MlYnedUsEbEe9Hq38Wc+ 8wJrrEqGJywdfjsiVHiBqu1nQs51vQ14wos42KyoUiz0YHh20O91H0AxSZlhm6Mq 4UDj4SZKO9AVIz2KyPPIZhOq/vjvgkP0d7CX5mmDsyuZaNxc30RTNzNJ8ItgWNM9 sVdNRCFNtLUOxq8E/opbU/aCZvGgGbmYLGKeexdElL44koFVyHHyNRjHPAQhiSk= =VGvw
-----END PGP SIGNATURE-----

#4 lore raw
Quoted 18 lines · Husnu Demir
Quoted 10 lines · Jozsef Kadlecsik
Quoted 5 lines · Husnu Demir

I want to give a try for COUNTERS properties of IPSET. But I could not manage it;

# ipset create COUNTERS bitmap:ip  counters ipset v6.17: Unknown
argument: `counters' Try `ipset help' for more information.

What does "ipset help bitmap:ip" says? I suspect you have multiple
binaries at different paths.

# ipset help bitmap:ip
ipset v6.17

Usage: ipset [options] COMMAND

Quoted 6 lines

..

bitmap:ip type specific options:

create SETNAME bitmap:ip range IP/CIDR|FROM-TO
[netmask CIDR] [timeout VALUE] [counters]

So the ipset binary does support counters. Then what is the output of "modinfo ip_set_bitmap_ip"? Also, if you had the previous ipset kernel modules loaded in, then just installing them won't unload them.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

          H-1525 Budapest 114, POB. 49, Hungary
#5 lore raw
Quoted 11 lines · Jozsef Kadlecsik <kadlec <at> blackhole.kfki.hu> writes:
Quoted 2 lines

create SETNAME bitmap:ip range IP/CIDR|FROM-TO
[netmask CIDR] [timeout VALUE] [counters]

So the ipset binary does support counters. Then what is the output of "modinfo ip_set_bitmap_ip"? Also, if you had the previous ipset kernel modules loaded in, then just installing them won't unload them.

Best regards,
Jozsef
-
E-mail : kadlec <at> blackhole.kfki.hu, kadlecsik.jozsef <at>

wigner.mta.hu

Quoted 2 lines

PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of

Sciences

Quoted 7 lines
          H-1525 Budapest 114, POB. 49, Hungary

--
To unsubscribe from this list: send the line "unsubscribe netfilter" in the body of a message to majordomo <at> vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Jozsef
I successfully built and executed ipset 6.19 ,but when I try to run this
command, I failed.

iptables -t nat -A POSTROUTING -m set --match-set ipc src,dst -j MASQUERADE
iptables: No chain/target/match by that name.

could you please help me on this ?

appreciated!
tian

#6 lore raw
Quoted 9 lines · tian fang
Quoted 6 lines · Jozsef Kadlecsik <kadlec <at> blackhole.kfki.hu> writes:
Quoted 2 lines

create SETNAME bitmap:ip range IP/CIDR|FROM-TO
[netmask CIDR] [timeout VALUE] [counters]

So the ipset binary does support counters. Then what is the output of "modinfo ip_set_bitmap_ip"? Also, if you had the previous ipset kernel modules loaded in, then just installing them won't unload them.

Quoted 7 lines

I successfully built and executed ipset 6.19 ,but when I try to run this
command, I failed.

iptables -t nat -A POSTROUTING -m set --match-set ipc src,dst -j MASQUERADE
iptables: No chain/target/match by that name.

could you please help me on this ?

[There's no ipset 6.19 yet.]

Did you install the kernel modules from the ipset package?

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

          H-1525 Budapest 114, POB. 49, Hungary
#7 lore raw

-----Original Message-----
From: Jozsef Kadlecsik [mailto:[email protected]]
Sent: 2013Äê5ÔÂ6ÈÕ 21:41
To: tian fang
Cc: [email protected]
Subject: Re: Fwd: ipset and counters

Quoted 9 lines · tian fang
Quoted 6 lines · Jozsef Kadlecsik <kadlec <at> blackhole.kfki.hu> writes:
Quoted 2 lines

create SETNAME bitmap:ip range IP/CIDR|FROM-TO
[netmask CIDR] [timeout VALUE] [counters]

So the ipset binary does support counters. Then what is the output of "modinfo ip_set_bitmap_ip"? Also, if you had the previous ipset kernel modules loaded in, then just installing them won't unload them.

Quoted 8 lines

I successfully built and executed ipset 6.19 ,but when I try to
run this command, I failed.

iptables -t nat -A POSTROUTING -m set --match-set ipc src,dst -j MASQUERADE
iptables: No chain/target/match by that name.

could you please help me on this ?

[There's no ipset 6.19 yet.]

Did you install the kernel modules from the ipset package?

Best regards,
Jozsef
-
Thanks for your quick reply.
I just follow your README file :make and make modules , then make install
& modules_install.

I want the counters features, so I git cloned the latest code.

Please help!
Best regards

#8 lore raw
In reply to Jozsef Kadlecsik

-----Original Message-----
From: Jozsef Kadlecsik [mailto:[email protected]]
Sent: 2013Äê5ÔÂ6ÈÕ 21:41
To: tian fang
Cc: [email protected]
Subject: Re: Fwd: ipset and counters

Quoted 9 lines · tian fang
Quoted 6 lines · Jozsef Kadlecsik <kadlec <at> blackhole.kfki.hu> writes:
Quoted 2 lines

create SETNAME bitmap:ip range IP/CIDR|FROM-TO
[netmask CIDR] [timeout VALUE] [counters]

So the ipset binary does support counters. Then what is the output of "modinfo ip_set_bitmap_ip"? Also, if you had the previous ipset kernel modules loaded in, then just installing them won't unload them.

Quoted 8 lines

I successfully built and executed ipset 6.19 ,but when I try to
run this command, I failed.

iptables -t nat -A POSTROUTING -m set --match-set ipc src,dst -j MASQUERADE
iptables: No chain/target/match by that name.

could you please help me on this ?

[There's no ipset 6.19 yet.]

Did you install the kernel modules from the ipset package?

Best regards,
Jozsef
-

Jozsef
I succeeded after I sudo cp xt_set.ko /lib/modules/3.5.0-28-generic/kernel/net/netfilter/ . Thanks for your help.
But I am just alittlebit curious why can't I do it by make install.

Best regards
tian

E-mail : [email protected], [email protected] PGP key :
http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

          H-1525 Budapest 114, POB. 49, Hungary
#9 lore raw
Quoted 14 lines · tian fang
Quoted 14 lines
Quoted 6 lines
Quoted 2 lines

create SETNAME bitmap:ip range IP/CIDR|FROM-TO
[netmask CIDR] [timeout VALUE] [counters]

So the ipset binary does support counters. Then what is the output of "modinfo ip_set_bitmap_ip"? Also, if you had the previous ipset kernel modules loaded in, then just installing them won't unload them.

I successfully built and executed ipset 6.19 ,but when I try to
run this command, I failed.

iptables -t nat -A POSTROUTING -m set --match-set ipc src,dst -j MASQUERADE
iptables: No chain/target/match by that name.

Quoted 8 lines
Quoted 1 line

could you please help me on this ?

[There's no ipset 6.19 yet.]

I succeeded after I sudo cp xt_set.ko /lib/modules/3.5.0-28-generic/kernel/net/netfilter/ . Thanks for your help.
But I am just alittlebit curious why can't I do it by make install.

I suspect your "depmod" utility is not configured to process the /lib/modules/uname -r/extra/ directory, in which the modules are installed by the command "make modules_install".

It's strange. You're the second reporting such kind of problem. What is your distribution and what's its version?

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

          H-1525 Budapest 114, POB. 49, Hungary
#10 lore raw
Quoted 26 lines · tian fang
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

create SETNAME bitmap:ip range IP/CIDR|FROM-TO
[netmask CIDR] [timeout VALUE] [counters]

So the ipset binary does support counters. Then what is the output of "modinfo ip_set_bitmap_ip"? Also, if you had the previous ipset kernel modules loaded in, then just installing them won't unload

them.

Quoted 8 lines

I successfully built and executed ipset 6.19 ,but when I try to
run this command, I failed.

iptables -t nat -A POSTROUTING -m set --match-set ipc src,dst -j MASQUERADE
iptables: No chain/target/match by that name.

Quoted 8 lines
Quoted 1 line

could you please help me on this ?

[There's no ipset 6.19 yet.]

I succeeded after I sudo cp xt_set.ko /lib/modules/3.5.0-28-generic/kernel/net/netfilter/ . Thanks for your help.
But I am just alittlebit curious why can't I do it by make install.

Quoted 6 lines

I suspect your "depmod" utility is not configured to process the /lib/modules/uname -r/extra/ directory, in which the modules are installed by the command "make modules_install".

It's strange. You're the second reporting such kind of problem. What is your distribution and what's its version?

Debian Squeeze. Custom made kernel.

hdemir,

Quoted 14 lines

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

          H-1525 Budapest 114, POB. 49, Hungary

--
To unsubscribe from this list: send the line "unsubscribe netfilter" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
In reply to Jozsef Kadlecsik

-----Original Message-----
From: Jozsef Kadlecsik [mailto:[email protected]]
Sent: 2013Äê5ÔÂ7ÈÕ 2:28
To: tian fang
Cc: [email protected]
Subject: RE: Fwd: ipset and counters

Quoted 14 lines · tian fang
Quoted 14 lines
Quoted 6 lines
Quoted 2 lines

create SETNAME bitmap:ip range IP/CIDR|FROM-TO
[netmask CIDR] [timeout VALUE] [counters]

So the ipset binary does support counters. Then what is the output of "modinfo ip_set_bitmap_ip"? Also, if you had the previous ipset kernel modules loaded in, then just installing them won't unload them.

I successfully built and executed ipset 6.19 ,but when I try to
run this command, I failed.

iptables -t nat -A POSTROUTING -m set --match-set ipc src,dst -j MASQUERADE
iptables: No chain/target/match by that name.

Quoted 8 lines
Quoted 1 line

could you please help me on this ?

[There's no ipset 6.19 yet.]

I succeeded after I sudo cp xt_set.ko /lib/modules/3.5.0-28-generic/kernel/net/netfilter/ . Thanks for your help.
But I am just alittlebit curious why can't I do it by make install.

I suspect your "depmod" utility is not configured to process the /lib/modules/uname -r/extra/ directory, in which the modules are installed by the command "make modules_install".

It's strange. You're the second reporting such kind of problem. What is your distribution and what's its version?

Best regards,
Jozsef
-
Jozsef£¬
I am using ubuntu 12.04 LTS.
And I got an issue ,I am sorry if I am wrong because I am a quite newbie.

I am confused of the "--match-set setname src,dst" . it seems only the one before the comma is functional. Please look at this .

I added an IP into the ipset sec,and set the iptables FORWARD Chain as "dst, src" ,I guess this means dst OR src, but unfortunately ,my outgoing packages was dropped.

If I set two separated lines ,it works.

Could you please help me on this?

Great appreciation !
Tian

tfang@gateway:~$ sudo iptables -nvL
Chain INPUT (policy ACCEPT 83 packets, 4308 bytes)
 pkts bytes target     prot opt in     out     source
destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source
destination

    0     0 ACCEPT     all  --  *      *       0.0.0.0/0
0.0.0.0/0            match-set sec dst,src
    4   252 DROP       all  --  *      *       0.0.0.0/0

0.0.0.0/0

Chain OUTPUT (policy ACCEPT 114 packets, 14440 bytes)
pkts bytes target prot opt in out source
destination

E-mail : [email protected], [email protected] PGP key :
http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

          H-1525 Budapest 114, POB. 49, Hungary
#12 lore raw
Quoted 8 lines · tian fang

I suspect your "depmod" utility is not configured to process the /lib/modules/uname -r/extra/ directory, in which the modules are installed by the command "make modules_install".

It's strange. You're the second reporting such kind of problem. What is your distribution and what's its version?

I am using ubuntu 12.04 LTS.

I'll check this out: it should work without any extra effort.

Quoted 10 lines

And I got an issue ,I am sorry if I am wrong because I am a quite newbie.

I am confused of the "--match-set setname src,dst" . it seems only the one before the comma is functional. Please look at this .

I added an IP into the ipset sec,and set the iptables FORWARD Chain as "dst, src" ,I guess this means dst OR src, but unfortunately ,my outgoing packages was dropped.

If I set two separated lines ,it works.

If the dimension of the set is less than the direction parameters of the set match/SET target, then that's ignored.

With "--match-set setname src,dst" you instruct ipset that if the named set stores IP address and port number pairs, then get the source and destination parameters from the packets, say 192.168.1.1 as source address, TCP port 80 as destination, form the element 192.168.1.1,tcp:80 and look it up in the given set.

You can't store and lookup IP address pairs, if that's what you want.

Best regards,
Jozsef

Quoted 23 lines
tfang@gateway:~$ sudo iptables -nvL
Chain INPUT (policy ACCEPT 83 packets, 4308 bytes)
 pkts bytes target     prot opt in     out     source
destination

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source
destination

    0     0 ACCEPT     all  --  *      *       0.0.0.0/0
0.0.0.0/0            match-set sec dst,src
    4   252 DROP       all  --  *      *       0.0.0.0/0

0.0.0.0/0

Chain OUTPUT (policy ACCEPT 114 packets, 14440 bytes)
pkts bytes target prot opt in out source
destination

E-mail : [email protected], [email protected] PGP key :
http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

Quoted 7 lines
          H-1525 Budapest 114, POB. 49, Hungary

--
To unsubscribe from this list: send the line "unsubscribe netfilter" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

          H-1525 Budapest 114, POB. 49, Hungary
#13 lore raw
Quoted 2 lines

I am using ubuntu 12.04 LTS.

I'll check this out: it should work without any extra effort.

Quoted 10 lines

And I got an issue ,I am sorry if I am wrong because I am a quite newbie.

I am confused of the "--match-set setname src,dst" . it seems only the one before the comma is functional. Please look at this .

I added an IP into the ipset sec,and set the iptables FORWARD Chain as "dst, src" ,I guess this means dst OR src, but unfortunately ,my outgoing packages was dropped.

If I set two separated lines ,it works.

If the dimension of the set is less than the direction parameters of the set match/SET target, then that's ignored.

With "--match-set setname src,dst" you instruct ipset that if the named set stores IP address and port number pairs, then get the source and destination parameters from the packets, say 192.168.1.1 as source address, TCP port 80 as destination, form the element 192.168.1.1,tcp:80 and look it up in the given set.

You can't store and lookup IP address pairs, if that's what you want.

Best regards,
Jozsef

Jozsef,
Thanks much for your kindness. Seems I have to set two separated rules
for my purpose.
And I have the last question ,what is the maximum number of the ipset bytes counters ?

RGS
tian

#14 lore raw
Quoted 2 lines · tian fang

And I have the last question ,what is the maximum number of the ipset bytes counters ?

You cannot have either byte or packet counters, only both. If a set is defined with counters, then all its elements are created with counters.

The limit is the physical RAM of your machine.

Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences

          H-1525 Budapest 114, POB. 49, Hungary