Block website using iptables

I want to block specific websites for the clients connected to my openwrt device using iptables . Right now iptables only able to block the websites for the pc clients , not for the mobile devices when the ip is static and dns is static like 8.8.8.8. How can i do that and why its happening.

If you block 8.8.8.8, some devices will complain about not being able to connect to internet.

Because it's the way googled designed them/their OS.

Be aware that modern OpenWrt (all supported versions) use nftables, instead of iptables (at least by default).

1 Like

can't i block the website for all devices and for any dns used using iptables ?

you can, but if you block it, the devices will become unusable, is that what you want ?
if it is, why not simply remove them ?

did you even try searching for "iptables block 8.8.8.8", here at the forum ?

i want that user can use the static dns and still not able to access the website which is being blocked by the admin using iptables on the opnwrt router

if you block it, they'll just switch to another public DNS.

you want to intercept all outgoing DNS requests from the clients https://openwrt.org/docs/guide-user/firewall/fw3_configurations/intercept_dns#command-line_instructions

1 Like