THTTPD from WAN

From WL-HDD Wiki

Jump to: navigation, search
WL-HDD Contents
What is the WL-HDD
Features
Pro's/con's
Reviews
Hacking
Inserting the HDD
Hacking Guides
Basic setup guides
Packages guides
Requests
Troubleshooting
This Wiki
Credits
Editing help
Contact Me

Contents

Prerequisites

To complete this guide, the following is assumed:

You are running Oleg's firmware (1.9.2.7-6b or later)
You have harddisk partitions up and running with an extended filesystem mounted to /opt
You have installed the Ipkg package system.
You have configured your partitions to automount.

Changing the IPtables

First of all, we need to create a rule in iptables that allows external access to port 81 on the WL-HDD.

nano /usr/local/sbin/post-firewall

Add the following lines below the

#!/bin/sh

that must be at the top of the file

iptables -D INPUT -j DROP
iptables -A INPUT -p tcp --dport 81 -j ACCEPT
iptables -t nat -A PREROUTING -i $1 -p tcp --dport 81 -j DNAT --to-destination $4:81
iptables -A INPUT -j DROP

Save changes and exit

Ctrl + O
Ctrl + X

Make changes permanent

flashfs save
flashfs commit
flashfs enable

Reboot

reboot

Changing your Routers' Firewall

You will need to do the following changes in your router (not the WL-HDD) configuration pages.

Different routers have different names for port forwarding (such as virtual server). They also have different entry fields. You will have to figure this out for yourself. Read your routers user manual!

Add the following Rule:

Port Range 81 to 81 (or just 81 if available)
Local IP (your WL-HDD) eg.192.168.1.8
Local Port (or Port Map) 81
Protocol TCP

and a description: eg. WL-HDD webserver

So your THTTPD webserver will be accessible via WAN at:

eg. http://wlhdd.hopto.org:81 or your webhop address

Testing the webserver

Very few network setups will allow you to try and view your website on the external IP address(provided by your ISP) from within the LAN.

Do not   try to connect to your webserver using the external IP address
unless you connect to the internet via a proxy server.

First of all, find out your Routers IP address, this is the address given to you by your ISP.

  • Go to http://www.whatismyip.com and copy down the IP address given. Unless you have a static IP address, this address will change periodically.
  • Now, go to http://www.google.com/language_tools?hl=en and enter http://youripaddress:81 in the translate a webpage box.
  • Leave the google translator on any language setting, this is not particularly important, all we want to see is if the page is accessible.
  • If you can view the page (in whatever language) then your server is externally accessible. Success.
  • If you want to have a domain name for your webserver, see the DynamicDNS and webhop guides.
Personal tools