14

I recently upgraded my internet to the point that it is much faster and more reliable than my current webhost. I would like to move my current domain to be hosted at home, but my IP address is dynamic. As far as I know, I only get a new IP when I restart my modem and or router (which is almost never) or when cable one (my ISP) pushes out a firmware update (rarely).

There are a few ways I can see doing this:

  1. Convince my ISP to give me a static IP

  2. Assign my router my current IP to force a static IP (which might work?)

  3. Set my DNS record to my current IP address and update it on the rare occasions that it changes.

Obviously I'm hoping that the first one works, but I don't want to pay a lot of extra money (if that's what it takes) to get a static IP address.

Which of these options will work most reliably?

  • 1
    My ISP forced me to upgrade plans simply to open up HTTP and Sendmail ports. Their website said they keep port 80 closed because of something to do with viruses. It's amazing the scare tactics they use to get small businesses owners to pay more. I couldn't get a straight answer from them why they were suggesting viruses spread on port 80 when 99% of the hundreds of millions of websites run on port 80. I doubt your ISP will give you a static IP for free, they'll be pretty awesome if they do though. – Anagio Mar 24 '12 at 6:05
16

You can't simply assign your router a static IP to get a static IP. Most broadband providers allow you to lease a static IP from them for an extra monthly fee. But you're probably better off spending that on a decent webhost, as it'll be cheaper, less hassle, and you'll have better uptime. Plus, most residential broadband connections have really poor upstream speeds. And some even have ToS against running any kind of internet server unless you upgrade to a business plan.

However, if you're still set on hosting the site from home, you can use a dynamic DNS service that will automatically update your DNS records whenever your IP changes. Though there are significant disadvantages to this. For one, unless you set a very short TTL time, the chances of a user being routed to an old IP and not being able to get to your website are high. But if you set a very low TTL, users will have to make frequent DNS requests, which is bad for performance.

  • 2
    I agree, I would pay out for a new host rather than trying to go through the hassle of setting up your own server via a residential connection. – Vince Pettit Mar 21 '12 at 10:17
  • 1
    The subdomain I'm moving is my test development subdomain. It's nothing critical for customers to see (most of them don't even know it's there). I wound up paying my ISP for a static IP address, it only cost $5 / month extra plus they increased my upload speeds for me. – nick Mar 30 '12 at 20:03
  • @nick: In that case, that seems like a reasonable setup/good deal. – Lèse majesté Mar 30 '12 at 21:26
  • You can also use a CNAME to make your home server accessible from a domain that you own (still requires a dynamic dns service). – Andrew Shooner Jan 31 '13 at 21:50
6

I also host a website on my local DHCP server. Even with a DHCP connection like I have my IP doesn't change if I lose power. The protocol works by checking my mac address and trying to give me my old IP back. Anytime the ISP is doing work though I typically lose my IP when my modem goes down.

How I host the site is by using no-ip.com this tells them what my IP address is even when it changes. They manage the DNS records so that when people visit www.mydomain.com it checks no-ip.com's DNS records and see my IP address to route traffic to.

My linksys now forwards www, mysqld, and ftp traffic to an internal server 192.168.15.11 for exmaple. My regular work desktop has 192.168.15.10 this way my web server can run Ubuntu/Nginx serve up the pages and I can still work from another machine on windows.

Anytime your IP changes the windows app from no-ip.com pushes the update to your no-ip.com account and your DNS is kept up to date.

3

Look to use a Dynamic DNS (DDNS) service, such as Dyn. A DDNS provider allows for a static domain name for dynamic IPs. The service is pretty cheap for low traffic sites. The way DDNS works is that you set up your router to periodically update the DDNS service holding your domain name with the current IP. Using DDNS at the router level is more convenient than having some sort of app running server side to essentially do the same thing. Internet users who then enter your domain name will always be redirected by the DDNS provider to the proper IP address. DD-WRT supports many different DDNS provider APIs. DynDNS is probably the most popular and Linksys and Belkin support the DynDNS API in their native firmware.

1

Actually it is possible. And there is an easy way to automate it.

here's how. and a mockup script to get you started (it's fully functional)

  1. Register an account at afraid.org and use them as your name servers. If you want free then you have to allow that others can (either request or use freely) any subdomain on your domain for whatever they want. Select that each request needs your approval, meaning you won't be giving those, and no one else will use your domain. Or just pay 5^

  2. make no-ip or rather dyndns account and pick up one of their free subdomains for your host (since no-ip started doing monthly captcha's for free users) you will use this domain to compare it to ip which your actual domain points to (Note, you can use just your WAN ip if you can get it, I am posting this way because some people can't get it from their routers/modems etc, it's also possible to use something like whatismyip/com/org/net whatever. Or to simply run the update script below periodically)

  3. Create bash or whatever script which looks something like this:

#!/bin/bash
#
#
# don't forget to setup noip service
# RIP var will be our real IP and CIP will be Current IP which afraid org
#nameservers point to. 
#Also if you don't delete or replace the "ip.of.nameserver.here.if.you.want" with 
#actual name server which you want to use instead of a default one. 
#Please kill me

RIP=`nslookup yourhost.dyndns.org ip.of.nameserver.here.if.you.want | grep Address: | awk 'NR==2 {print $2}'`
CIP=`nslookup yourdomain.com ip.of.nameserver.here.if.you.want | grep Address: | awk 'NR==2 {print $2}'`
if [ $RIP = $CIP ] # is ip of your dyndns/no-ip host same as your domain ip
then
echo "yay it's same" #you don't really need this, but just to ilustrate
else
echo "They are not the same, updating..." 
#again you don't need this line either, but the one below uses uri you will get from
#afraid.org which you will use, for example with lynx or however you want, to update your dns entry to your current ip

lynx -dump "http://freedns(dot)afraid(dot)org/dynamic/update.php?YOUR_UNIQUE_UPDATE_CODE_GOES_HERE" > /dev/null
fi

. 3. create cron.d job that runs say once every few minutes and executes the ip.sh script mentioned above. crontab entry should look something like this:

*/10 * * * * /path/to/script/ip.sh >/dev/null 2>&1
  1. ???
  2. Profit! Now you can host your domain on dynamic ip and you've done everything in 5 minutes. I win.
1

Some DNS registrars have an API which lets you update your A record (router IP address) through a web request.

You could then write a script that collects your current public IP address and sends it to the DNS provider through the API and updates the necessary DNS records to match your currentmost IP address.

Then, you could schedule the script to run periodically (e.g. once per day) to maintain the information.

I have written one and it can be used as an example, Github link here.

-1

You can use a service like Noip.com and your sites will be accessible, but I think google's spider's will not crawl your sites. I think they will drop you when they are given the redirect to your site. I hope I am wrong, but that is what I have been told. So, it you need for people to find you on Google's search engine, you might be out of luck. People could still see your business card and go straight to you though.

  • 3
    Noip.com is a dynamic DNS service as suggested by other answers. Googlebot will crawl dynamic DNS sites, so your answer is wrong. I don't see anything about a redirect in the question, so I'm not sure what you are talking about there. – Stephen Ostermiller Jul 10 '17 at 9:41
  • 1
    @Kenny Ray Oxenrider, you've been given incorrect information. I've used no-ip.com for a site; Googlebot crawls and indexes the pages just as with other web crawlers such as Baidu, Yandex, etc. The site's IP address will be looked up by a DNS query to No-IP's DNS servers just as any other site's IP address would be looked up to any other DNS servers. There's no redirect because one is using No-IP for DNS service. – moonpoint Jul 11 '17 at 0:12
  • @StephenOstermiller > "I don't see anything about a redirect in the question" no-ip.com has an option called web redirect which allows a hostname to be redirected to a URL or IPv4 address on a specific port. This is very useful when the ISP blocks the standard port 80. – Mark Messa Oct 16 '18 at 14:53
  • @moonpoint > "There's no redirect because one is using No-IP for DNS service." Depends whether web redirect is set or not. If it is set, google typically will not index. – Mark Messa Oct 16 '18 at 14:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.