How-To serve website behind DHCP address.

jove

Member
Hello,
I do not know the best forum to post the following how-to item.

Our only DSL provider in town gives DHCP IP addresses to home accounts. Static IPs are given to the much more expensive business accounts. Every home account gets a free web sit on their servers; a paltry useless 3MB site. You can spend more money to increase the size.

We wanted to serve large pictures and video to family and friends. We wanted to serve those large items from our own computers. How do you serve a website behind an unnamed DHCP address? The following works and if you want any of the code, send me a personal message.

The first and easy step was to set up my wife's iMac as a Web Server. It was assigned a static LAN IP address and our Linksys router forwards HTTP requests (port 80) to the iMac. If an individual knows the dynamic WAN address of the router, then they can see the site. Not very useful; no name and the IP address can change.

We put a very simple redirect HTML page on the ISP's supplied site. It redirects to our home site. If somebody goes to the named web site they would be redirected to my wife's iMac. Not very useful if our IP changes.

I wrote a unix script that retrieved the WAN IP address of the router (difficult but possible). If it changed then a newly constructed redirect HTML page is FTPed to the ISPs web site.

Using the freeware program Cronnix (sp?), the iMac every hour, on the hour, runs the script to automate the update of the named static website.

Getting the WAN IP address from our router required some programming. According to the folks at Linksys the only way to view the WAN IP from a LAN client is to go to the status web page using a browser. The code I wrote creates a network socket to the router. It does an HTML GET with Basic Authentication. An in-memory buffer is returned with the HTML. The HTML is then parsed to extract the WAN IP. If Linksys were to change the layout of the status page, the code would need to be rewritten.

If anybody else wants to do something similar and needs help, let me know.
 
Sounds like you've already solved everything but the non-static IP address issue.

Here is how I tackled that. I wrote an Applescript that looks at www.myipaddress.com to get the WAN address. When you contact that site it sends back a page including your IP address. I extract the IP address and store it in a log file. So far, I've only looked at this for a few weeks but our address hasn't changed yet.

I can't give you the details but I recently ran across a brief reference by someone to a company that provides the same service you are describing. Somehow, they track your IP address and then offer an up-to-date redirect to your current IP address. You could probably find it by searching for it.

Curiously, our ADSL address at home didn't change even though I forced the modem to reconnect. I wonder if they are assigning IP addresses based on something like the phone number or account number?
 
Interesting,

The non-static IP address issue is solved by the C++ program. But www.myipaddress.com option will simplify and generalize code. Currently it has to deal with an HTTP authenticate and a more complicated search algorithm.

Our WAN address changes whenever the router's power is shut off. I do not know if it will do an IP address refresh if only the modem is turned off.

But why pay for a service if you can do it for yourself and learn something? :)
 
Man that was easy. Just register, create a host name, and run a nicely made MacOSX client. The client SW is $10 shareware. The dyndns org would like a donation. Registering a custom full domain name is a one time $30 cost.

Thank you Steve for the suggestion.

If you want to see the cutest 7 month old girl then go to

victoria.dyndns.tv
 
Back
Top