Follow us on...
Follow us on Twitter Follow us on Facebook
Register
Results 1 to 5 of 5
  1. #1
    jove's Avatar
    jove is offline Member
    Join Date
    Nov 2000
    Posts
    555
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  2. #2
    neutrino23 is offline Registered User
    Join Date
    Sep 2001
    Location
    San Francisco Bay Area
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  3. #3
    jove's Avatar
    jove is offline Member
    Join Date
    Nov 2000
    Posts
    555
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  4. #4
    Steve Bosell is offline Registered User
    Join Date
    Sep 2001
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts
    have you considered dyndns?

  5. #5
    jove's Avatar
    jove is offline Member
    Join Date
    Nov 2000
    Posts
    555
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

 

 

Similar Threads

  1. Modem and reboot
    By kgraph in forum Mac OS X System & Mac Software
    Replies: 10
    Last Post: March 22nd, 2003, 07:20 AM
  2. changing IP address (DHCP)???
    By iknownotwhoiam in forum Mac OS X System & Mac Software
    Replies: 5
    Last Post: November 11th, 2001, 03:20 PM
  3. changing IP address (DHCP)???
    By iknownotwhoiam in forum Mac OS X System & Mac Software
    Replies: 1
    Last Post: November 9th, 2001, 03:34 PM
  4. Replies: 7
    Last Post: October 15th, 2001, 02:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •