PDA

Bekijk de volledige versie : WAN Webserver on port 80



alpha5
15-08-2004, 11:38
Tested on my wl-500g running 1.9.2.7-2[Oleg]

alpha5
05-01-2005, 16:00
okay, new year, new firmware, new howto :)

Since few days i´m using 1.9.2.7-2 from Oleg.
Like in changelogs promised there are some changes in iptables since 1.6.x.x.
These changes are effecting on my last howto about the wan webserver.
So lets start:

At first you need "webspace" f.e. a usb memory stick, or an usb harddisk. How to install this is explained in your asus manual. If there are problems with it, use the search function of this forum! :p
Optional you can use a service like "dyndns.org" to be aviable allways under the same hostname on internet. F.e. ernstl.dyndns.org. To update your ip on connect use the internal updating client. (see asus manual)

If not done yet, connect to your aus device with a telnetclient of your choise, and login with username and password.
So far... After installing the usb memory device will be mounted as /tmp/harddisk on your asus device.
Now you should creat a seperated directory for your web files with this command:


mkdir /tmp/usbmount/web

If not allready exist, create the post-boot and post-firewall scripts:


touch /usr/local/sbin/post-firewall
touch /usr/local/sbin/post-boot

Now open the vi editor by typing "vi /usr/local/sbin/post-boot". In vi press "i" to enter a simple insert mode. Type ore paste in the following lines, to make busybox_httpd automaticly started, and mount usb device bevore:

[CODE]
mount /dev/discs/disc0/part1 /tmp/harddisk -t vfat
busybox_httpd -p 81 -h /tmp/harddisk/web[CODE]

Press "ESC" to leave inser mode. Now type ":wq!" followed by "return" to write changes and quit vi.

Now open the post-firewall file with vi (vi /usr/local/sbin/post-firewall).
Press "i" and fill in the following line

[CODE]
iptables -D INPUT -j DROP
iptables -A INPUT -p tcp --dport 81 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 80 -j DNAT --to-destination 192.168.1.1:81
iptables -A INPUT -j DROP
[CODE]

Then "ESC" and ":wq!". Files should now be saved.
To vertify the the files are filled with our informations "cat" the files with the command "cat [filename]".

To store changes in flash enter the following commands in your shell:

[CODE]
flashfs enable
flashfs save
flashfs commit
[CODE]
Necesarry!!!


After reboot busybox_httpd should be startet automaticly on port 81, by the post-boot. Iptables makes it aviable on port 80 for wan site.
To access the webserver from lan site, you need to connect on port 80. F.e.:
http://192.168.1.1:81

If you have problems do not hesitate to message me or post in Q&A forum!