One guess, it’s not random and internet in fact works, only DNS doesn’t. More specifically, those computers that don’t work use router as DNS resolver (it’s probably configured in DHCP server) and those that do work use something else. You can try to add (before the last rule):
It’s important to limit access only to devices in LAN, that’s the in-interface parameter. Alternatively it can be in-interface-list if you have interfaces defined there.
Other than that, firewall rules are processes in order, so to make it more efficient, it would be better to sort rules differently: #3 and #4 can be merged into one, #2, #0, new ones for DNS, #5. Not that you’d see much difference with only few rules. Also since default action is access, you effectively don’t have any firewall in forward chain.