Inverted IP range matching

SaimenSays

Member
May 5, 2020
6
0
6
41
Hello,

with iptables it is possible to invert an ip range by using an exclamtion mark in front of the IP. Is there a way to get this behaviour on proxmox firewall / GUI? Using "!" is not allowed and results in error below.
The intend is to allow web traffic, but block local address range. I actually use a drop rule before each allow rule, but it would be more convienient to invert local range on destination.

1652813211215.png
 
Hi,

you can create an Alias with an IP range. then in IP Set you can create an IP set and add the alias you created and then select "nomatch":

1652858800142.png
 
  • Like
Reactions: SaimenSays
@shrdlicka Oh thanks, missed that tickbox!
the "nomatch" is shown as exclamation mark in the IP set, so they might have allowed this sign in the string as well :D
1652899091261.png
 
Tried it, but does not seem to work. Can't ping any wepage anymore when using following rule with output policy DROP and IPSet set as screenshot above.
What I am missing?
1652906673704.png
 
I just reread what ipset "nomatch" does. and it is not what I was expecting.

Code:
   nomatch
       The  hash  set types which can store net type of data (i.e. hash:*net*)
       support the optional nomatch option when adding entries. When  matching
       elements  in the set, entries marked as nomatch are skipped as if those
       were not added to the set, which makes possible to build up  sets  with
       exceptions. See the example at hash type hash:net below.

       When elements are tested by ipset, the nomatch flags are taken into ac‐
       count. If one wants to test the existence of an element marked with no‐
       match in a set, then the flag must be specified too.

What I did in the past instead of inverse matching is allow traffic from everywhere and then drop the local stuff.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!