All of lore.kernel.org
 help / color / mirror / Atom feed
* Capturing a C Class range dynamically into an ipset table within iptables. Possible?‏
@ 2012-06-14 22:34 José Pablo Pérez
  2012-06-15  2:52 ` Aidas Kasparas
  0 siblings, 1 reply; 4+ messages in thread
From: José Pablo Pérez @ 2012-06-14 22:34 UTC (permalink / raw)
  To: netfilter

Currently with ipset iam able to send to a table the inidivual (/32)  
source IP of a connection...

I need a way to send to iptables the C Class to an ipset .

In other words I need the historical list of last 30 min of C class  
ranges that have requested my server.

I need this preferably done without something outside of iptables  
(such as a daemon).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Capturing a C Class range dynamically into an ipset table within iptables. Possible?‏
  2012-06-14 22:34 Capturing a C Class range dynamically into an ipset table within iptables. Possible?‏ José Pablo Pérez
@ 2012-06-15  2:52 ` Aidas Kasparas
  2012-06-15  5:39   ` José Pablo Pérez
  0 siblings, 1 reply; 4+ messages in thread
From: Aidas Kasparas @ 2012-06-15  2:52 UTC (permalink / raw)
  To: José Pablo Pérez; +Cc: netfilter

On 2012.06.15 01:34, José Pablo Pérez wrote:
> Currently with ipset iam able to send to a table the inidivual (/32)
> source IP of a connection...
> 
> I need a way to send to iptables the C Class to an ipset .
> 
> In other words I need the historical list of last 30 min of C class
> ranges that have requested my server.
> 
> I need this preferably done without something outside of iptables (such
> as a daemon).
> 

just use parameter netmask 24 while creating ipset and you're done.

test:~# ipset create test hash:ip timeout 60 netmask 24
test:~# ipset add test 127.0.1.2
test:~# ipset add test 127.3.4.5
test:~# ipset list test
Name: test
Type: hash:ip
Header: family inet hashsize 1024 maxelem 65536 netmask 24 timeout 60
Size in memory: 16632
References: 0
Members:
127.0.1.0 timeout 50
127.3.4.0 timeout 55
test:~# ipset test test 127.0.1.1
127.0.1.1 is in set test.
test:~#



-- 
Aidas Kasparas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Capturing a C Class range dynamically into an ipset table within iptables. Possible?‏
  2012-06-15  2:52 ` Aidas Kasparas
@ 2012-06-15  5:39   ` José Pablo Pérez
  2012-06-15  6:00     ` Aidas Kasparas
  0 siblings, 1 reply; 4+ messages in thread
From: José Pablo Pérez @ 2012-06-15  5:39 UTC (permalink / raw)
  To: netfilter

Thanks.. but this would be outside of iptables ruleset.

I need a way to dynamically feed the ipset as traffic cones in via the  
ruleset.





Aidas Kasparas <a.kasparas@gmc.lt> ha escrito:

> On 2012.06.15 01:34, José Pablo Pérez wrote:
>> Currently with ipset iam able to send to a table the inidivual (/32)
>> source IP of a connection...
>>
>> I need a way to send to iptables the C Class to an ipset .
>>
>> In other words I need the historical list of last 30 min of C class
>> ranges that have requested my server.
>>
>> I need this preferably done without something outside of iptables (such
>> as a daemon).
>>
>
> just use parameter netmask 24 while creating ipset and you're done.
>
> test:~# ipset create test hash:ip timeout 60 netmask 24
> test:~# ipset add test 127.0.1.2
> test:~# ipset add test 127.3.4.5
> test:~# ipset list test
> Name: test
> Type: hash:ip
> Header: family inet hashsize 1024 maxelem 65536 netmask 24 timeout 60
> Size in memory: 16632
> References: 0
> Members:
> 127.0.1.0 timeout 50
> 127.3.4.0 timeout 55
> test:~# ipset test test 127.0.1.1
> 127.0.1.1 is in set test.
> test:~#
>
>
>
> --
> Aidas Kasparas
>
>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Capturing a C Class range dynamically into an ipset table within iptables. Possible?&#8207;
  2012-06-15  5:39   ` José Pablo Pérez
@ 2012-06-15  6:00     ` Aidas Kasparas
  0 siblings, 0 replies; 4+ messages in thread
From: Aidas Kasparas @ 2012-06-15  6:00 UTC (permalink / raw)
  To: José Pablo Pérez; +Cc: netfilter

On 2012.06.15 08:39, José Pablo Pérez wrote:
> Thanks.. but this would be outside of iptables ruleset.
> 
> I need a way to dynamically feed the ipset as traffic cones in via the
> ruleset.
> 
> 

You send to this ipset the same way you did for individual source
addresses. If ipset is created with ommitted netmask parameter, it
stores ip addresses individually. If netmask parameter is present,
ipsets will store and check just a network part of ip address supplied
by iptables. Commands to add, list and test addresses were provided just
for illustration. iptables rules should work the same.


> 
> 
> 
> Aidas Kasparas <a.kasparas@gmc.lt> ha escrito:
> 
>> On 2012.06.15 01:34, José Pablo Pérez wrote:
>>> Currently with ipset iam able to send to a table the inidivual (/32)
>>> source IP of a connection...
>>>
>>> I need a way to send to iptables the C Class to an ipset .
>>>
>>> In other words I need the historical list of last 30 min of C class
>>> ranges that have requested my server.
>>>
>>> I need this preferably done without something outside of iptables (such
>>> as a daemon).
>>>
>>
>> just use parameter netmask 24 while creating ipset and you're done.
>>
>> test:~# ipset create test hash:ip timeout 60 netmask 24
>> test:~# ipset add test 127.0.1.2
>> test:~# ipset add test 127.3.4.5
>> test:~# ipset list test
>> Name: test
>> Type: hash:ip
>> Header: family inet hashsize 1024 maxelem 65536 netmask 24 timeout 60
>> Size in memory: 16632
>> References: 0
>> Members:
>> 127.0.1.0 timeout 50
>> 127.3.4.0 timeout 55
>> test:~# ipset test test 127.0.1.1
>> 127.0.1.1 is in set test.
>> test:~#
>>
>>
>>
>> -- 
>> Aidas Kasparas
>>
>>
> 
> 
> 
> -- 
> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Aidas Kasparas

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-15  6:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-14 22:34 Capturing a C Class range dynamically into an ipset table within iptables. Possible?&#8207; José Pablo Pérez
2012-06-15  2:52 ` Aidas Kasparas
2012-06-15  5:39   ` José Pablo Pérez
2012-06-15  6:00     ` Aidas Kasparas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.