0

Let's say I want to apply a rule to ip daddr { 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 }, but I want to exclude two more specific IPv4 addresses from that. How do I do that?

I was hoping for some more elegant way of doing this:

ip daddr { 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 } \
  ip daddr != 10.0.1.2 \
  ip daddr != 10.0.2.3

as explained in the nft manpage for negation of addresses or ranges, but it does not show a way to do that with sets.

2

It appears that negations of sets are working as expected (undocumented):

ip daddr { 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 } \
  ip daddr != { 10.0.1.2, 10.0.2.3 }
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.