Last active
August 29, 2015 14:02
-
-
Save abbotto/f4c9e3a3c7e095b4b269 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTICE: SSH ACCESS REQUIRED | |
# INSTALL nano AS AN ALTERNATIVE TO vi | |
opkg install nano | |
# PASTE THIS INTO /etc/rc.local BEFORE exit 0 | |
sed -i -e `$i \logger _____Initializing the blocklist... &\n` /etc/rc.local | |
sed -i -e `$i \wget -O - "http://pgl.yoyo.org/as/serverlist.php?hostformat=dnsmasq&mimetype=plaintext" | sed 's/127.0.0.1/192.168.1.254/g' | grep -vE 'example.com' > /etc/dnsmasq.conf && /etc/init.d/dnsmasq restart &\n` /etc/rc.local | |
# CREATE /tmp/block.init | |
touch /tmp/block.init | |
# CONFIGURE ROUTING FOR pixelserv | |
# ASSUMES GATEWAY IP ADDRESS IS: 192.168.1.1 | |
# SOURCE: https://forum.openwrt.org/viewtopic.php?id=49640 | |
# PASTE THE FOLLOWING INTO /tmp/block.init | |
uci add network alias | |
uci set network.@alias[-1].interface=lan | |
uci set network.@alias[-1].proto=static | |
uci set network.@alias[-1].ipaddr=192.168.1.254 | |
uci set network.@alias[-1].netmask=255.255.255.0 | |
uci commit | |
uci add uhttpd uhttpd | |
uci rename uhttpd.@uhttpd[-1]=pixelserv | |
uci add_list uhttpd.@uhttpd[-1].listen_http=0.0.0.0:88 | |
uci set uhttpd.@uhttpd[-1].home=/www2 | |
uci set uhttpd.@uhttpd[-1].rfc1918_filter=1 | |
uci set uhttpd.@uhttpd[-1].max_requests=3 | |
uci set uhttpd.@uhttpd[-1].error_page=/blank.gif | |
uci set uhttpd.@uhttpd[-1].index_page=blank.gif | |
uci set uhttpd.@uhttpd[-1].network_timeout=30 | |
uci set uhttpd.@uhttpd[-1].tcp_keepalive=1 | |
uci commit | |
mkdir /www2 | |
wget -O /www2/blank.gif http://upload.wikimedia.org/wikipedia/commons/c/c0/Blank.gif | |
uci add firewall redirect | |
uci set firewall.@redirect[-1].target=DNAT | |
uci set firewall.@redirect[-1].src=lan | |
uci set firewall.@redirect[-1].proto=tcp | |
uci set firewall.@redirect[-1].src_dip=192.168.1.254 | |
uci set firewall.@redirect[-1].src_dport=80 | |
uci set firewall.@redirect[-1].dest_ip=192.168.1.1 | |
uci set firewall.@redirect[-1].dest_port=88 | |
uci set firewall.@redirect[-1].name=Pixelserv | |
uci commit | |
# GIVE PERMISSIONS AND EXECUTE /tmp/block.init | |
chmod +x /tmp/block.init && /tmp/block.init && reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment