Using an OpenWRT router as an "advertised service" web page server for your AREDN node |
BTW, I tried this with a DD-WRT router, but I'd get "400 Bad Request Cross Site Action detected!" errors when trying to load web pages on the DD-WRT router via the mesh status page of my AREDN mesh node. Using an OpenWRT router to store the web pages seems to avoid this problem.
Example of a OpenWRT server on an AREDN node:
Do be aware that you can't change these files without flash memory waste (as a deleted file still ties up the memory space used to store it, until you wipe the entire OpenWRT flash by doing a hardware reset, which wipes the router of everything setting it back to default, but you get back the flash memory).
A web page announcing club meetings that has changing information would be a poor choice unless you store it in RAM memory. See the bottom of this page on how to do this. Another approach is to use a USB stick attached to an OpenWRT router, but that's more involved.
But small web pages that never change will work fine in the flash memory. Things like how to build yet another Jpole, hints and mods, tables of coax data, pictures of your pets, and such. As flash memory is limited, you want to keep any image files as small as practical, without sacrificing clarity of information. See if the same image file is smaller but clear enough as a gif vs a jpg file, for example. And instead of uploading thumbnail image files of existing image files you already uploaded into the OpenWRT flash for other web pages, have the browser create it with adding this html code
<img src="imagefilename.xxx" width="170px" height="auto">
(the 170 here is the number of pixels tall the thumbnail will display)
The 'auto' automatically preserves the image's aspect ratio. Do a 'View Page Source" in Firefox to see it here in action.
An example using a big image file used further down this page:
You should set up a folder on your PC where you do the writing and editing of the html file,
along with the image files you intend to use in the web page. Test the html code with your Firefox
or whatever browser while it's in that folder in your PC until you have it the way you want it,
without misspelled words (like 'teh') or html coding errors and such.
If you did this in the OpenWRT router's flash memory, each edit and save wastes flash memory,
as all the old versions tie up flash memory forever until you do a hardware router reset
(which wipes the router of everything setting it back to default).
Once you have it fully polished, use a program like SmarTTY to SSH into your node. SmarTTY has a
feature, SCP, that allows you to upload files right into the node's flash memory. Once you are
logged in, do a
cd /www
(don't forget the / else it doesn't find the www directory). Then do a 'ls' and you should see
something like this:
(all this tested in Backfire 10.03.1, r29592)
You can see some of the files for some web pages already
here, before this one was loaded. And you can keep tabs on memory usage by doing 'df'.
To upload a file to this directory you mouse up to the SCP selection on the
SmarTTY window's task bar up top
Once you have all the files for your new web page uploaded, you now need to 'advertise' it to
the mesh network:
First step is to give your OpenWRT router a hostname under 'DHCP Address Reservations'. Hopefully, you'll find your OpenWRT router under 'Current DHCP Leases', in which case you can copy the MAC address, and select its IP address to fill in the blanks. And you have to make up a hostname, best to use something that will be unique to the entire mesh network, something with your callsign in it. Click 'add' and then 'save changes'.
Now the advertised service config: the 'name' is what will show up on other mesh nodes as the name of your service. Check 'link'. Put 'http' in the next blank. The 'URL' should have as a selection your new hostname. In the next blank put '80'. And in the last blank you put the filename of the html file that is your web page. Click 'add' and then 'save changes'.
You may have to do a reboot of the node. After that, go to 'mesh status' and you should see, at the top, under 'Local hosts', your advertised service. You should be able to go to it when you click this link. And other hams on the mesh network you're a part of should see and be able to click it as well.