Now I thought of adding Custom User File, but I get error from PBR program.
How is it supposed to work?
Do I need dnsmasq full package?
Use DNSMASQ nft sets Support
The pbr package can be configured to utilize dnsmasq’s nft sets support,
which requires the dnsmasq-full package with nft sets support to be installed
That works, least for me, if you are using nftresolver for domain names you might run into DNS cache problems so it does not seem to work at first.
to be sure reboot router and client.
Usually only doing this on the router will work:
service pbr stop && service dnsmasq stop && service dnsmasq start && service pbr start
Custom user files are just shell scripts, you have to take care of everything yourself.
In that directory there are some examples which can help you make the script you want
FFS, there are two sample scripts which come with every install of pbr and they are even defined (although disabled) in configs, so visible in both uci/config file and the WebUI. How much more visible do they have to be?
I have seen them but they not fits my needs.
One get ASN2906 all IP range for Netflix to pass to wan.
The other get ip to amazonaws.
/etc/pbr/pbr.user.aws: provided to pull the Continental US AWS IPv4 addresses into the WAN IPv4 sets that the service sets up.
/etc/pbr/pbr.user.netflix: provided to pull the Continental US Netflix IPv4 addresses into the WAN IPv4 sets that the service sets up.
I need my own ip's to pass to wan. Therefor I rewrote Netflix script.
I want the ip numbers to pass to the wan and the ip number stored in a file.
I have used Processing Custom User Files (nft mode)
My script works but you can't get it at the top of "chain pbr_prerouting" (Policies) and therefore it doesn't get activated.
Shouldn't "Custom user file includes" be in policies so you can rearrange them as you like. Haven't found how to do it manually.
(Or can you write it in Policies chain?)
It's your custom file, feel free to insert/rearrange nft policies however you like.
The current implementation of pbr doesn't support sorting policies and custom user files within the same big list. First the policies and dns policies get processed and then the custom user files. If you only have a handful of static addresses tho, it's better to create a policy listing them all or linking a local text file like @egc suggested.