Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


ipset - combine individual IP and network subset [SOLVED]
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

ipset - combine individual IP and network subset [SOLVED]

gromovnikgromovnik Member
edited June 2019 in General

Hi to all,
I am trying to figure out how to create a ipset set that will combine an individual IP & a network subnet.

From man pages it should be:
create blacklist4 hash:ip family inet hashsize 4096 maxelem 65536

add blacklist4 xxx.xxx.x.xxx
add blacklist4 xx.xxx.xxx.0/24

?

thanks,
g

Comments

  • akbakb Member

    @gromovnik use hash:net instead of hash:ip:

    ipset create blacklist4 hash:net hashsize 4096 maxelem 65536
    ipset add blacklist4 xxx.xxx.x.xxx
    ipset add blacklist4 xx.xxx.xxx.0/24
    
    Thanked by 3ehab uptime gromovnik
  • ClouviderClouvider Member, Patron Provider

    Remember, each IP is also a network, an IPv4 single host is a /32, an IPv6 single host is a /128.

    Thanked by 1gromovnik
  • cheers,
    g

  • SplitIceSplitIce Member, Host Rep

    Also keep in mind that if you are doing small networks hash:ip may be quicker as hash net on ipv4 requires the looking up 32 hashes, 128 for ipv6.

    Thanked by 2uptime gromovnik
Sign In or Register to comment.