I have rules like this in my IPTABLES:
-A INPUT -s 166.100.102.50/32 -j LOG --log-level 7
and I wrote a script that grabs the output of these rules and outputs the bytes from the IP to my server.
I was hoping to get suggestions on how I could create a rules that tracks ip traffic from dispersant subnets. The ip address aren't fixed and even the subnets aren't fixed. For example:
120.2.33.45 could be the ip address of the device one day and 204.65.3.88 could be the ip address of the same device the next day.
I think that if there was a way to write the rule so that it gave me the ip address of everything except a range of ip address that are fixed, like 166.100.102.50 then I would be ok.
Something like:
-A INPUT -s NOT EQUAL 166.100.102.50/32 -j LOG --log-level 7
Thanks in advance
Did you want (watch the
!
):This will match everything with source address NOT 166.100.102.50.
From
man iptables
Here starts the relevant part:
You may find that building a chain here will make things a lot easier to work with.
A chain is basically like a sub-table. You send stuff to it, and then you can either return or process things within that chain.
Another option, might be to create and use an ipset, which basically lets you build a set of addresses, which you can then reference in a rule using the
--match-set
option.