I'm trying to get a network very restricted, so that only a few domain names are accessible and hopefully their subdomains too!.
Currently I try to implement it through luci:
Dhcp:
config ipset
list name 'aqara'
list domain 'aqara.com'
list domain 'myqcloud.com'
list domain 'devolo.net'
Firewall (the zone aqara does not forward to wan):
config ipset
option name 'aqara'
option family 'ipv4'
list match 'dest_ip'
option counters '1'
config rule
option src 'aqara'
option dest 'wan'
option ipset 'aqara'
option target 'ACCEPT'
option name 'aqara-restrict'
When I resolve even when restarting firewall and dnsmasq it will not populate, it will however populate after a router restart.
Now I got a question about this:
PBR for example is able to use wildcarding on domains I know in the past within the migration of iptables ipset to nftset there were some problems with wildcarding.
However when I lookup the wiki it isn't clear to me wether this ipset function automatically wildcards or not?
I'm afraid not, because I have other networks aswell which I want to let work normally, I want it to be working in a firewall rule.
Basicly aqaranet can only communicate with aqara and subdomains since some of my devices are on a non openwrt repeater with a weaker password I just want to be sure the internet is not so interesting to use, I do have a pcap with dns so that I know which domains to track for a ipset but it would be very convient if it can get wildcard subdomains too which I'm not sure about.
hmm it seem that the wildcarding is not working, I tested this by hardcoding the domains and then it works, not sure if this is intended behaviour or that I should report it as a bug
forum.aqara.com shows multiple A records on nslookup, but aqara.com shows a singular, if I define forum.aqara.com in the ipset it works.
thank you very much for the help and everyone else
I tested it on 24.10.6 with dnsmasq-full 2.90 and it behaves as expected. What version are you running? It’s possible it’s a bug in newer dnsmasq versions. You could enable query logging in dnsmasq temporarily to see what it reports when looking up the subdomain.
root@router:/tmp# nft list set inet fw4 aqara
table inet fw4 {
set aqara {
type ipv4_addr
comment "Aqara test"
}
}
root@router:/tmp# grep nftset /var/etc/dnsmasq.conf.cfg01411c
nftset=/aqara.com/myqcloud.com/devolo.net/4#inet#fw4#aqara
root@router:/tmp# dig aqara.com
; <<>> DiG 9.20.18 <<>> aqara.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38447
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;aqara.com. IN A
;; ANSWER SECTION:
aqara.com. 600 IN A 162.159.135.42
;; Query time: 40 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Thu Mar 26 08:47:46 EDT 2026
;; MSG SIZE rcvd: 54
root@router:/tmp# nft list set inet fw4 aqara
table inet fw4 {
set aqara {
type ipv4_addr
comment "Aqara test"
elements = { 162.159.135.42 }
}
}
root@router:/tmp# dig forum.aqara.com
; <<>> DiG 9.20.18 <<>> forum.aqara.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 3970
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;forum.aqara.com. IN A
;; ANSWER SECTION:
forum.aqara.com. 600 IN CNAME forum.aqara.com.cdn.dnsv1.com.
forum.aqara.com.cdn.dnsv1.com. 600 IN CNAME gyu1usfl.ovslegodl.sched.ovscdns.com.
gyu1usfl.ovslegodl.sched.ovscdns.com. 60 IN A 43.159.77.160
gyu1usfl.ovslegodl.sched.ovscdns.com. 60 IN A 43.159.77.250
gyu1usfl.ovslegodl.sched.ovscdns.com. 60 IN A 101.33.20.216
gyu1usfl.ovslegodl.sched.ovscdns.com. 60 IN A 43.159.77.253
;; Query time: 120 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Thu Mar 26 08:48:00 EDT 2026
;; MSG SIZE rcvd: 195
root@router:/tmp# nft list set inet fw4 aqara
table inet fw4 {
set aqara {
type ipv4_addr
comment "Aqara test"
elements = { 43.159.77.160, 43.159.77.250,
43.159.77.253, 101.33.20.216,
162.159.135.42 }
}
}
Ok, I think it’s a dnsmasq problem. I’ve added another nftset duplicating aqara.com and placed it so it appears first in dnsmasq.conf, and the IP is only added to the first set that specifies the domain. The second one appears to be ignored. So when you add the subdomain directly, it’s considered unique and probably works ok.