I haven't tried the uninstall / reinstall so, no problem, neither am I looking for oneThe install and uninstall is very light. I don’t see the harm in uninstalling and reinstalling. Have you had any issues?

I haven't tried the uninstall / reinstall so, no problem, neither am I looking for oneThe install and uninstall is very light. I don’t see the harm in uninstalling and reinstalling. Have you had any issues?
You mean like the beta version in GitHub dev?Views would work something like this for same scenario?
Code:# Client 10.88.8.111 is blocked from accessing YouTube, but all other LAN clients' DNS requests for YouTube are allowed as normal. # Create the view clause to reject requests to www.youtube.com with rcode REFUSED view: name: "NoYouTube" local-zone: "www.youtube.com" refuse # Associate the client(s) with the view clause (NoYouTube) access-control-view: 10.88.8.111/32 "NoYouTube" # Alternatively redirect the blocked YouTube client to a custom polite internal block page view: name: "NoYouTube" local-zone: "www.youtube.com" redirect local-data: "www.youtube.com IN A 10.88.8.xxx"
unbound-control --help
<snip>
view_list_local_zones view list local-zones in view
view_list_local_data view list local-data RRs in view
view_local_zone view name type add local-zone in view
view_local_zone_remove view name remove local-zone in view
view_local_data view RR... add local-data in view
view_local_datas view add list of local-data to view
one entry per line read from stdin
view_local_data_remove view name remove local-data in view
view_local_datas_remove view remove list of local-data from view
one entry per line read from stdin
Nicely done sir.... as always ahead of the game, although trying to add an IP address to a view threw an arithmetic error for me until i remembered i had to add the CIDR notation....maybe adding a test for "dumbass" entries would be useful down the road. Advanced user in my case only means advanced in years.....You mean like the beta version in GitHub dev?
Unlike for managing 'tags:', unbound-control makes several 'views:' related commands available:
although one to actually list the names of ALL the configured 'views:' seems to be missing?Code:unbound-control --help <snip> view_list_local_zones view list local-zones in view view_list_local_data view list local-data RRs in view view_local_zone view name type add local-zone in view view_local_zone_remove view name remove local-zone in view view_local_data view RR... add local-data in view view_local_datas view add list of local-data to view one entry per line read from stdin view_local_data_remove view name remove local-data in view view_local_datas_remove view remove list of local-data from view one entry per line read from stdin
![]()
I've now added auto-CIDR to the latest beta, so if a single LAN device 192.168.1.55 is to be added to 'view:' "NoYouTube"Nicely done sir.... as always ahead of the game, although trying to add an IP address to a view threw an arithmetic error for me until i remembered i had to add the CIDR notation....maybe adding a test for "dumbass" entries would be useful down the road. Advanced user in my case only means advanced in years.....
views NoYouTube 192.168.1.55
auto-converted to
views NoYouTube 192.168.1.55/32
unbound normally listens on ALL interfaces, so if you only have one outgoing interface available i.e. WAN, then the 'bind' command is irrelevant.What is the meaning of BIND WAN options? disable / debug / debug show?
Do not quite understand![]()
That begs the question why 2 commands? Wouldn't it be simpler to have one bind command with WAN, VPN 1-5 as parameters?unbound normally listens on ALL interfaces, so if you only have one outgoing interface available i.e. WAN, then the 'bind' command is irrelevant.
However, for those that have one or more VPN Client tunnels, then they may wish to bind unbound's outbound requests to the Root DNS to a specific VPN Client tunnel, or they may wish to force unbound to use the fastest interface which is usually the WAN.
The optional 'debug/show' options are simply provided to prove if the bind has been applied to the desired outbound interface.
I thought it is related to BIND VPN, but then why seperate option. Yes grouping makes sense. +1That begs the question why 2 commands? Wouldn't it be simpler to have one bind command with WAN, VPN 1-5 as parameters?
And on a related topic: would it be acceptable and possible to group the advanced menu items by topics? i.e the DNS related commands as DisableFirefoxDoH, DOT, stubby, dnsmasq on one side of the isle? Then adblock, youtube, ew commands grouped together etc. The same layout as the creator intended with a scent of grouping; that's all...
I've now added auto-CIDR to the latest beta, so if a single LAN device 192.168.1.55 is to be added to 'view:' "NoYouTube"
e.g. if you "forget" to add the CIDR suffix for the single IP Address
Code:views NoYouTube 192.168.1.55 auto-converted to views NoYouTube 192.168.1.55/32
A:Option ==> views NoYouTube 10.10.11.25
grep: /opt/share/unbound/configs/unbound.conf.views: No such file or directory
sed: /opt/share/unbound/configs/unbound.conf.views: No such file or directory
View: 'NoYouTube' added 10.10.11.25/32
Can you issueCode:A:Option ==> views NoYouTube 10.10.11.25 grep: /opt/share/unbound/configs/unbound.conf.views: No such file or directory sed: /opt/share/unbound/configs/unbound.conf.views: No such file or directory View: 'NoYouTube' added 10.10.11.25/32
head -n4 /jffs/addons/unbound/unbound_manager.sh
e = Exit Script [?]
A:Option ==> views
Options syntax: [ { uninstall | viewname { '?' | 'uninstall' } ] | {viewname url [ ip_address] } | {viewname ip_address ['del']} ]
e = Exit Script [?]
A:Option ==> views uninstall
views NoYouTube www.youtube.com 10.10.11.25
views NoYouTube 10.10.11.xxx
views NoYouTube ?
viewsv
or
viewsx
Can you issue
The script should check if the file exists before checking for existing duplicate 'view:' name....Code:head -n4 /jffs/addons/unbound/unbound_manager.sh
However I suspect you have misinterpreted the command syntax...
So you have not supplied the blocked domain/URL to be associated with the 'view'Code:e = Exit Script [?] A:Option ==> views Options syntax: [ { uninstall | viewname { '?' | 'uninstall' } ] | {viewname url [ ip_address] } | {viewname ip_address ['del']} ]
I suggest you start again
thenCode:e = Exit Script [?] A:Option ==> views uninstall
To add another client to the view then use the following syntaxCode:views NoYouTube www.youtube.com 10.10.11.25
Check the 'view:' blocking ruleCode:views NoYouTube 10.10.11.xxx
or view/edit the file usingCode:views NoYouTube ?
Code:viewsv or viewsx
#!/bin/sh
# shellcheck disable=SC2086,SC2068,SC1087,SC2039,SC2155,SC2124,SC2027,SC2046
VERSION="3.17b"
#============================================================================================ © 2019-2020 Martineau v3.17b8
# View: NoYouTube Clients
access-control-view: 10.10.11.25/32 "NoYouTube"
access-control-view: 10.10.11.1/32 "NoYouTube"
view:
name: "NoYouTube"
view-first: yes
local-zone: "www.youtube.com." refuse
# EndView: NoYouTube
include: "/opt/share/unbound/configs/unbound.conf.addViews"
include: "/opt/share/unbound/configs/unbound.conf.views"
Code:#!/bin/sh # shellcheck disable=SC2086,SC2068,SC1087,SC2039,SC2155,SC2124,SC2027,SC2046 VERSION="3.17b" #============================================================================================ © 2019-2020 Martineau v3.17b8
Code:# View: NoYouTube Clients access-control-view: 10.10.11.25/32 "NoYouTube" access-control-view: 10.10.11.1/32 "NoYouTube" view: name: "NoYouTube" view-first: yes local-zone: "www.youtube.com." refuse # EndView: NoYouTube
Yes 'unbound.conf.addViews' is obsolete.the view i created previously was in a file called unbound.conf.addViews which i assume is redundant now? The new views file is unbound.conf.views
I try to make the syntax 'logical' but also flexible without forcing the user to explicitly prefix the parameters e.g. domain/url value i.e. 'url=www.you.tube.com'Seems to be working now.... i think its the missing domain issue as you said …
May 27 16:44:11 unbound[2185:0] query: 10.88.8.114 www.youtube.com. A IN
May 27 16:44:11 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@52185 www.youtube.com. A IN
May 27 16:44:11 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@52185 www.youtube.com. A IN
May 27 16:44:11 unbound[2185:0] query: 10.88.8.114 www.youtube.com. A IN
May 27 16:44:11 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@65060 www.youtube.com. A IN
May 27 16:44:11 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@65060 www.youtube.com. A IN
May 27 16:44:40 unbound[2185:0] query: 10.88.8.114 www.youtube.com. A IN
May 27 16:44:40 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@52043 www.youtube.com. A IN
May 27 16:44:40 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@52043 www.youtube.com. A IN
May 27 16:44:40 unbound[2185:0] query: 10.88.8.114 www.youtube.com. A IN
May 27 16:44:40 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@53064 www.youtube.com. A IN
May 27 16:44:40 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@53064 www.youtube.com. A IN
May 27 16:44:40 unbound[2185:0] query: 10.88.8.114 www.youtube.com. A IN
May 27 16:44:40 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@53644 www.youtube.com. A IN
May 27 16:44:40 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@53644 www.youtube.com. A IN
May 27 16:44:41 unbound[2185:0] query: 10.88.8.114 www.youtube.com. A IN
May 27 16:44:41 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@56079 www.youtube.com. A IN
May 27 16:44:41 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@56079 www.youtube.com. A IN
May 27 16:44:41 unbound[2185:0] query: 10.88.8.114 www.youtube.com. A IN
May 27 16:44:41 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@58237 www.youtube.com. A IN
May 27 16:44:41 unbound[2185:0] info: www.youtube.com. refuse 10.88.8.114@58237 www.youtube.com. A IN
May 27 16:44:42 unbound[2185:0] query: 10.88.8.92 www.youtube.com. A IN
May 27 16:44:42 unbound[2185:0] reply: 10.88.8.92 www.youtube.com. A IN NOERROR 0.062516 0 291
May 27 16:44:42 unbound[2185:0] query: 10.88.8.111 www.youtube.com. A IN
May 27 16:44:52 unbound[2185:0] reply: 10.88.8.111 www.youtube.com. A IN NOERROR 0.000000 1 291
I try to make the syntax 'logical' but also flexible without forcing the user to explicitly prefix the parameters e.g. domain/url value i.e. 'url=www.you.tube.com'
Adding 10.10.11.0 to include the whole subnet without adding the /24 CIDR notation auto generates 10.10.11.0/32
Could the script cater for the whole subnet scenario?
No i didn't mean that..... I was just thinking that if the last octet is zero thats a reserved address so the intention was most likely to include the whole subnet. I guess there is no way to help in that regard because theres no way to infer the CIDR from the rest of the address.So if the last octet of the IP Address is 0 you want the script to always assume/append subnet mask CIDR notation '/24' ?
tOmsK@RT-AC68U-4690:/tmp/home/root# ip route
192.168.0.1 dev eth0 proto kernel scope link
10.11.12.0/24 dev wl1.1 proto kernel scope link src 10.11.12.1
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.164
10.10.10.0/24 dev br0 proto kernel scope link src 10.10.10.1
10.10.11.0/24 dev wl0.1 proto kernel scope link src 10.10.11.1
127.0.0.0/8 dev lo scope link
default via 192.168.0.1 dev eth0
Sorry I may be dense, but although adding the '/32' suffix to a single IP Address is effectively redundant in most cases (but I did add this auto-CIDR for your convenience as it made sense), the last octet when specifying the '/24' suffix is invariably almost always '0' - as evidenced in your output above.No i didn't mean that..... I was just thinking that if the last octet is zero thats a reserved address so the intention was most likely to include the whole subnet. I guess there is no way to help in that regard because theres no way to infer the CIDR from the rest of the address.
I can see the CIDR of the subnet if i use ip route ... would that be a good place to grab it?
Code:tOmsK@RT-AC68U-4690:/tmp/home/root# ip route 192.168.0.1 dev eth0 proto kernel scope link 10.11.12.0/24 dev wl1.1 proto kernel scope link src 10.11.12.1 192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.164 10.10.10.0/24 dev br0 proto kernel scope link src 10.10.10.1 10.10.11.0/24 dev wl0.1 proto kernel scope link src 10.10.11.1 127.0.0.0/8 dev lo scope link default via 192.168.0.1 dev eth0
10.10.11.0/29
Sorry I may be dense, but although adding the '/32' suffix to a single IP Address is effectively redundant in most cases (but I did add this auto-CIDR for your convenience as it made sense), the last octet when specifying the '/24' suffix is invariably almost always '0' - as evidenced in your output above.
Not quite sure why you can't explicitly specify the subnet mask in CIDR notation i.e. you may actually wish to use only the first 7 (technically 8) IP Addresses
e.g.
in which the script would get it wrong.Code:10.10.11.0/29
Anyway all of this discussion is moot unless you can confirm that the unbound 'NoYouTube' 'view:' does allow you to alter the DNS response based on the source IP address - in this block access to YouTube for any LAN device defined to the 'NoYouTube' 'view:'
# View: NoYouTube Clients
access-control-view: 10.11.12.0/24 "NoYouTube"
view:
name: "NoYouTube"
view-first: yes
local-zone: "youtube.com." refuse
# EndView: NoYouTube
May 28 14:27:58 RT-AC68U-4690 unbound: [9527:0] query: 10.11.12.168 m.youtube.com. A IN
May 28 14:27:58 RT-AC68U-4690 unbound: [9527:0] info: youtube.com. refuse 10.11.12.168@59565 m.youtube.com. A IN
May 28 14:27:58 RT-AC68U-4690 unbound: [9527:0] reply: 10.11.12.168 m.youtube.com. A IN REFUSED 0.000000 1 31
May 28 14:28:14 RT-AC68U-4690 unbound: [9527:0] query: 10.11.12.196 m.youtube.com. A IN
May 28 14:28:14 RT-AC68U-4690 unbound: [9527:0] info: youtube.com. refuse 10.11.12.196@62508 m.youtube.com. A IN
May 28 14:28:14 RT-AC68U-4690 unbound: [9527:0] reply: 10.11.12.196 m.youtube.com. A IN REFUSED 0.000000 1 31
Brilliant!Seems to work
Code:# View: NoYouTube Clients access-control-view: 10.11.12.0/24 "NoYouTube" view: name: "NoYouTube" view-first: yes local-zone: "youtube.com." refuse # EndView: NoYouTube
Code:May 28 14:27:58 RT-AC68U-4690 unbound: [9527:0] query: 10.11.12.168 m.youtube.com. A IN May 28 14:27:58 RT-AC68U-4690 unbound: [9527:0] info: youtube.com. refuse 10.11.12.168@59565 m.youtube.com. A IN May 28 14:27:58 RT-AC68U-4690 unbound: [9527:0] reply: 10.11.12.168 m.youtube.com. A IN REFUSED 0.000000 1 31 May 28 14:28:14 RT-AC68U-4690 unbound: [9527:0] query: 10.11.12.196 m.youtube.com. A IN May 28 14:28:14 RT-AC68U-4690 unbound: [9527:0] info: youtube.com. refuse 10.11.12.196@62508 m.youtube.com. A IN May 28 14:28:14 RT-AC68U-4690 unbound: [9527:0] reply: 10.11.12.196 m.youtube.com. A IN REFUSED 0.000000 1 31
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!