Remove All Advertisements for OpenWRT wifi clients with Privoxy

Privoxy is an ad removing proxy that disallows your web browser from accessing content located on ad networks for both ad display and browser tracking. Normal setup involves changing your web browser’s proxy settings to point to privoxy on port 8118, but it can be installed on routers like OpenWRT to transparently block all advertising for all clients connecting to the internet through that router.

The following setup for OpenWRT only works on HTTP request through port 80, HTTPS requests through port 443 will not be intercepted.

Install Privoxy on Openwrt

edit /etc/privoxy/config

the important setting is allowing Privoxy to intercept traffic

setting the lan ip address of the router as the listening port is optional (this allows clients to manually set the proxy in the browser while connected through your router so that even HTTPS requests are intercepted).

permit-access $FIRST_THREE_OCTETS_OF_LAN_IP.0/24

setup privoxy to start on boot

/etc/init.d/privoxy start

edit /etc/config/firewall

        option src              lan
        option proto            tcp
        option src_dport        80
        option dest_ip          $ROUTER_LAN_IP
        option dest             lan
        option dest_port        8118