-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refer to range of IPs and use of wildcards #113
Comments
Comments:
Conceptually, it's just something like this ran in a cronjob or on TTL expirations: host -t a example.com | awk '{print $4}' | npfctl table "my-domain" replace - It could be integrated into |
Thank you so much for considering this.
Ok! This seems reasonable, npf does not know (and maybe should not now) anything about namespaces.
However, IIUC, |
I wanted to use ranges too. This script calculates the network blocks delegated per country. https://github.com/georgalis/pub/blob/master/sub/cc2netblock.sh It is mostly CIDR net/mask blocks, but there are many non-CIDR ranges too. I've not seen a range that is not just a bunch of adjacent /16 and those would be easy to script into CIDR. I don't have an idea to convert arbitrary ranges to CIDR blocks, is their a program or recipe for that somewhere? |
It turns out, ipcalc handily deaggregates ip ranges into CIDR blocks. I've incorporated the tool into the cc script and no longer have a need to ingest ranges with nfp, thanks! |
Hello!
I am not sure about the category of this issue (bug report, improvement suggestion, ...), so I chose to create a blank one.
Using npf in NetBSD 9.0 (release), I did not manage to refer to a range of IPs in the filter syntax. I tried:
block in family inet4 proto tcp from <source_host_IP> to <first_IP_of_range>-<last_IP_of_range>
but this generated a syntax error. My intention was to refer to a range like
192.168.1.10-192.168.1.20
, which does not necessarily correspond to a subnet, and which therefore is completely custom.I avoided the use of a table because I may need to refer to a huge number of IPs, for example
10.0.0.50-10.0.1.251
, and writing each of them in a table seems quite inefficient.Similarly, I tried to refer to any third-level domain in (e.g.) example.org:
block in family inet4 proto tcp from <source_host_IP> to *.example.org
but this provoked a syntax error, too.
Am I using the wrong syntax and some other wildcard characters are needed, or does npf not have these capabilities?
If it's the second case, is there a chance that they will be added in a future?
The text was updated successfully, but these errors were encountered: