Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    How do you discover which ipset blocklist contains particular IP?


    Hello,

    how do you discover which ipset blocklist contains particular IP?

    Usually when i want to see if some IP is banned by ipset, i do:

    ipset list|grep IP

    But it do nto tell me which ipset blocklist contain this IP.

    I can list blocklists: service ipset status

    But what is the most simple command that will tell me in which list this IP reside. I need to know it quickly without quering each list (ipset list listname|grep IP), i have many lists..

    So far this works, but is not ideal (hard to remember):

    for ipset in $(service ipset status|grep "Name:"|awk "{print $2}");do echo $ipset;done|grep -v Name >> ipsetlist
    for ipset in $(cat ipsetlist);do echo $ipset && ipset list $ipset|grep IPHERE;done

    ---
    ipset v6.11, CentOS 6

  2. #2
    Linux User
    Join Date
    Jul 2016
    Posts
    443
    -->
    Quote Originally Posted by postcd View Post
    Hello,
    how do you discover which ipset blocklist contains particular IP? Usually when i want to see if some IP is banned by ipset, i do:

    ipset list|grep IP

    But it do nto tell me which ipset blocklist contain this IP. I can list blocklists:

    service ipset status

    But what is the most simple command that will tell me in which list this IP reside. I need to know it quickly without quering each list (ipset list listname|grep IP), i have many lists.. So far this works, but is not ideal (hard to remember):

    for ipset in $(service ipset status|grep "Name:"|awk "{print $2}");do echo $ipset;done|grep -v Name >> ipsetlist
    for ipset in $(cat ipsetlist);do echo $ipset && ipset list $ipset|grep IPHERE;done

    ---
    ipset v6.11, CentOS 6
    so again your past 5 yrs of experience with iptables, scripting, ipset, and 43 other iptables posts have taught you absolutely nothing? you cant figure out (again) how to do a simple thing with the software you have yrs of experience with? and why dont you just save 'your" commands (you copied/pasted them......again.......) into a file and run it with an ip address as an argument? too difficult? how many years is it going to take you to be able to do something simple?
    Last edited by habit; 04-11-2018 at 01:27 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •