wykonałem kolejne czynności wg. opisu
root@TL-WR1043ND:~# crontab -e
0 0,4,8,12,16,20 * * * date -u +"%Y.%m.%d-%H:%M:%S" >/usr/data/time_backup
0,1,11,21,31,41,51 * * * * /usr/bin/set_kernel_timezone >/dev/null 2>&1
0 0,4,8,12,16,20 * * * /tmp/bw_backup/do_bw_backup.sh
0 3 * * 0 /mnt/bin/adblock.sh reload
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
root@TL-WR1043ND:~# uci add network alias
cfg0b4d8f
root@TL-WR1043ND:~# uci set network.@alias[-1].interface=lan
root@TL-WR1043ND:~# uci set network.@alias[-1].proto=static
root@TL-WR1043ND:~# uci set network.@alias[-1].ipaddr=192.168.1.2
root@TL-WR1043ND:~# uci set network.@alias[-1].netmask=255.255.255.0
root@TL-WR1043ND:~# uci commit network
root@TL-WR1043ND:~# /etc/init.d/network restart
Configuration file: /var/run/hostapd-phy0.conf
Using interface wlan0 with hwaddr mój mac and ssid "Yango"
root@TL-WR1043ND:~# mkdir /www_pixelserv
root@TL-WR1043ND:~# wget -O /www_pixelserv/blank.gif http://probablyprogramming.
com/wp-content/uploads/2009/03/tinytrans.gif
Connecting to probablyprogramming.com (173.255.197.65:80)
blank.gif 100% |*******************************| 43 0:00:00 ETA
root@TL-WR1043ND:~# httpd_gargoyle -d /www_pixelserv -p 81 -PNF /blank.gif &
root@TL-WR1043ND:~# bind: Address already in use
root@TL-WR1043ND:~# httpd_gargoyle -d /www_pixelserv -p 81 -PNF /blank.gif &
[1]- Done httpd_gargoyle -d /www_pixelserv -p 81 -PNF /blank.gif
root@TL-WR1043ND:~# uci add firewall redirect
cfg263837
root@TL-WR1043ND:~# uci set firewall.@redirect[-1].target=DNAT
root@TL-WR1043ND:~# uci set firewall.@redirect[-1].proto=tcp
root@TL-WR1043ND:~# uci set firewall.@redirect[-1].src=lan
root@TL-WR1043ND:~# uci set firewall.@redirect[-1].src_dip=192.168.1.2
root@TL-WR1043ND:~# uci set firewall.@redirect[-1].src_dport=80
root@TL-WR1043ND:~# uci set firewall.@redirect[-1].dest=lan
root@TL-WR1043ND:~# uci set firewall.@redirect[-1].dest_ip=192.168.1.2
root@TL-WR1043ND:~# uci set firewall.@redirect[-1].dest_port=81
root@TL-WR1043ND:~# uci set firewall.@redirect[-1].name=pixelserv
root@TL-WR1043ND:~# uci commit firewall
root@TL-WR1043ND:~# /etc/init.d/firewall restart
Warning: Section @zone[1] (wan) cannot resolve device of network 'wan6'
Warning: Section 'redirect_enabled_number_0' has no target specified, defaulting to DNAT
Warning: Section 'redirect_enabled_number_1' has no target specified, defaulting to DNAT
Warning: Section 'redirect_enabled_number_2' has no target specified, defaulting to DNAT
Warning: Section 'redirect_enabled_number_3' has no target specified, defaulting to DNAT
Warning: Section 'redirect_enabled_number_4' has no target specified, defaulting to DNAT
Warning: Section 'redirect_enabled_number_5' has no target specified, defaulting to DNAT
Warning: Section 'redirect_enabled_number_6' has no target specified, defaulting to DNAT
* Flushing IPv4 filter table
* Flushing IPv4 nat table
* Flushing IPv4 mangle table
* Flushing IPv4 raw table
* Flushing conntrack table ...
* Populating IPv4 filter table
* Zone 'lan'
* Zone 'wan'
* Rule 'Allow-DHCP-Renew'
* Rule 'Allow-Ping'
* Redirect 'VNC'
* Redirect 'VNC'
* Redirect 'VNC_2'
* Redirect 'VNC_2'
* Redirect 'WOL'
* Redirect 'uTorent'
* Redirect 'uTorent'
* Redirect 'pixelserv'
* Forward 'lan' -> 'wan'
* Populating IPv4 nat table
* Zone 'lan'
* Zone 'wan'
* Redirect 'VNC'
* Redirect 'VNC'
* Redirect 'VNC_2'
* Redirect 'VNC_2'
* Redirect 'WOL'
* Redirect 'uTorent'
* Redirect 'uTorent'
* Redirect 'pixelserv'
* Populating IPv4 mangle table
* Zone 'lan'
* Zone 'wan'
* Populating IPv4 raw table
* Zone 'lan'
* Zone 'wan'
* Set tcp_ecn to off
* Set tcp_syncookies to on
* Set tcp_window_scaling to on
* Running script '/etc/firewall.user'
* Running script '/usr/lib/gargoyle_firewall_util/gargoyle_additions.firewall'
* Running script '/usr/share/miniupnpd/firewall.include'
* Running script '/etc/openvpn.firewall'
root@TL-WR1043ND:~#
Na koniec zrestartowałem router. Efekt końcowy jest taki:
Wpisuje adres onetu, zasypuje mnie reklamami
Wpisuje adres phorm.kr wyciągnięty z pliku host.deny który miał być blokowany, strona się ładuje
adresy
http://192.168.1.2/jakaś_nieistniejąca_podstrona - nie wyświetla strony
http://192.168.1.1/jakaś_nieistniejąca_podstrona - wyświetla dostęp do routera
http://192.168.1.1:81/jakaś_nieistniejąca_podstrona - jest gif
http://192.168.1.1:80/jakaś_nieistniejąca_podstrona - wyświetla dostęp do routera
http://192.168.1.2:81/jakaś_nieistniejąca_podstrona - wyświetla dostęp zabroniony
http://192.168.1.2:80/jakaś_nieistniejąca_podstrona - nie wyświetla strony