image
image

Go Back   macosx.com > Content & Information > Apple News, Rumors & Discussion

Reply
 
Thread Tools
  #1  
Old June 2nd, 2002, 04:09 PM
jove's Avatar
Member
 
Join Date: Nov 2000
Posts: 555
Thanks: 0
Thanked 0 Times in 0 Posts
jove is on a distinguished road
Lightbulb How-To serve website behind DHCP address.

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.
__________________
Jove
Talk doesn't cook rice.
Reply With Quote
  #2  
Old June 2nd, 2002, 04:33 PM
Registered User
 
Join Date: Sep 2001
Location: San Francisco Bay Area
Posts: 121
Thanks: 0
Thanked 0 Times in 0 Posts
neutrino23 is on a distinguished road
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?
Reply With Quote
  #3  
Old June 2nd, 2002, 08:54 PM
jove's Avatar
Member
 
Join Date: Nov 2000
Posts: 555
Thanks: 0
Thanked 0 Times in 0 Posts
jove is on a distinguished road
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? :-)
__________________
Jove
Talk doesn't cook rice.
Reply With Quote
  #4  
Old June 3rd, 2002, 01:06 AM
Registered User
 
Join Date: Sep 2001
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Steve Bosell is on a distinguished road
have you considered dyndns?
Reply With Quote
  #5  
Old June 4th, 2002, 12:19 AM
jove's Avatar
Member
 
Join Date: Nov 2000
Posts: 555
Thanks: 0
Thanked 0 Times in 0 Posts
jove is on a distinguished road
dyndns ROCKS!!!

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
__________________
Jove
Talk doesn't cook rice.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Modem and reboot kgraph Mac OS X System & Mac Software 10 March 22nd, 2003 08:20 AM
changing IP address (DHCP)??? iknownotwhoiam Mac OS X System & Mac Software 5 November 11th, 2001 04:20 PM
changing IP address (DHCP)??? iknownotwhoiam Mac OS X System & Mac Software 1 November 9th, 2001 04:34 PM
How can I get apache to serve my local website without a network connection?? ms_kle Hardware & Peripherals 7 October 15th, 2001 03:03 PM


All times are GMT -5. The time now is 01:51 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.