OpenWrt Forum Archive

Topic: How to block websites in openwrt (eg: youtube, facebook)

The content of this topic has been archived on 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi All,

I have working on openwrt from last few days. I have enabled wifi and LAN connnections. I able to access internet from WAN to LAN. Now I want to block Websites in client machine's.

For example: I want to block "www.youtube.com & www.facebook.com".

Can anyone have idea on this?

Thanks

Regards,
Thanaraj.

It is OpenWRT, not close one.

Hi,

I'm working on openWrt only for raspberry Pi board. I'm asking how to configure in firewall to block social websites based on URL or IP Address.

Please give clear idea on this.

Regards,
Thanaraj.

(Last edited by thanaraj.s on 6 Nov 2017, 09:51)

The motto of OpenWRT is Wireless FREEDOM, not restriction. You've made mistake in your goal.

thanaraj.s wrote:

Hi,

I'm working on openWrt only for raspberry Pi board. I'm asking how to configure in firewall to block social websites based on URL or IP Address.

Please give clear idea on this.

Regards,
Thanaraj.

tmo26 gave you the answer up above.

Search for 'adblock' here on forum, and tailor the code to your (similar) requirements.

Hi,

I have installed adblock, simple-adblock, squid & privoxy. But I'm not able to configure URL block.
Also iprange is not working with iptables command.

Can you please provide any sample configuration to block websites?. and how to use iprange in iptables?

Regards,
Thanaraj.

do you have:
luci-app-adblock
luci-app-firewall

installed so you can configure in luci gui?

Hi,

Using that, I'm not able to block websites.
Since I'm trying with iptables but I'm getting below error

iptables v1.4.21: Couldn't load match `iprange':No such file or directory

I have enabled kmod-ipt-iprange and installed too, even-though it is throwing error.

root@Tringapps:~# opkg install kmod-ipt-iprange
Package kmod-ipt-iprange (4.4.14-1) installed in root is up to date.
root@Tringapps:~#

Can anyone help me to resolve this issue?

Regards,
Thanaraj.

@Ulmwind
Freedom means also to be free to decide which websites a user wants to see and which not.
And btw, watch your language.

thanaraj.s wrote:

Hi,

Using that, I'm not able to block websites.
Since I'm trying with iptables but I'm getting below error

iptables v1.4.21: Couldn't load match `iprange':No such file or directory

I have enabled kmod-ipt-iprange and installed too, even-though it is throwing error.

root@Tringapps:~# opkg install kmod-ipt-iprange
Package kmod-ipt-iprange (4.4.14-1) installed in root is up to date.
root@Tringapps:~#

Can anyone help me to resolve this issue?

Regards,
Thanaraj.

so you are using :

https://1921.68.1.1/cgi-bin/luci/admin/ … wall/rules

to set up the firewall rules?  obviously substituting your router ip

ulmwind wrote:

You've misunderstood the main principle of OpenWRT: Wireless FREEDOM! You should remove OpenWRT from all your devices, eat shit, and use something different.

This frees you from the application selection and configuration provided by the vendor and allows you to customize the device through the use of packages to suit any application.

opkg update
opkg install kmod-ipt-filter iptables-mod-filter
/usr/sbin/iptables -A FORWARD -m string --algo bm --string "facebook.com" -j DROP
/usr/sbin/iptables -A FORWARD -m string --algo bm --string "youtube.com" -j DROP

The discussion might have continued from here.