I had a Linux/Apache server in my house, a domain name hosted by 1and1 which points to my Comcast public IP (testing only, I know I am not allowed to host a site), and a D-Link router which forwards port 80 to the Linux server. Everything was working perfect.
I then bought a new Linksys router, and things stopped working.
Upon troubleshooting, I found that my home IP no longer matched the IP set in 1and1. Furthermore, the IP set in 1and1 is located hundreds of miles away.
Is this normal? How often will the IP change? Is there anything I can do to prevent?
56 Answers
If you don't purchase a static IP from your ISP, your ISP has no obligation to keep permanent the one it leases to you via DHCP. So you should always treat your IP changing as a possibility regardless of what you or others have observed. Your IP changing is normal if you do not have a static IP from your ISP.
There are "dynamic DNS" services - Dyn (formerly Dyndns) and No-IP being two of them - that will let you create an account, obtain a DNS hostname, and then run an "update client" somewhere on your internal network. The update client will periodically check your external IP and report changes to the service. So then this DNS will resolve to your public IP.
Dyn used to be free, No-IP still is AFAIK (this may have changed).
You'll still need to make sure NAT is set up correctly if you want external requests to reach a specific system inside your network. You also cannot use this DNS to reach hosts from inside to inside your network unless you run your own DNS server and resolve LAN-local names yourself.
2Well this is responding to a very old post but.. I've been collecting Comcast DCHP renewal data for the past 3 years and here are the results:
- Comcast has issued 3 IP addresses via DHCP over the last 3 years
- The longest period I've held the same IP is 850 days
- The shortest is 28 days
- I've currently had the same IP for the last 193 days
- No you can't prevent Comcast from changing your IP address unless you've purchased a Static IP address from them.
- When you change your router/MAC they will likely issue a new IP address.
- In my experience Comcast changes IP addresses every 1 to 3 years
One way to keep your "dynamic IP" in sync with your DNS is by using a service like Dyn or NoIP which provide their proprietary Domain names/Domain names to purchase.
However if you have your own custom domain name that you'd like to use, you can use the DNS services from NameSilo () as your DNS provider and the powershell windows script below along with a scheduled task to replicate the Dyn/NoIP service.
Assuming you're running windows, here's a simple script that you can "schedule" using Task Scheduler to run on StartUp/Logon and then rerun every 6 hours (that way the maximum downtime due to an IP address change is 6 hours).
Save the script below in a file called NameSiloDDNS.ps1
# NameSilo API Dynamic DNS
#Variables
param([string]$APIkey=$(throw "APIKey is required"), [string]$domain=$(throw "Domain is required"), [string]$record)
###Code - Do not edit below this line
# Gather data about the DNS entries in the domain
$listdomains = Invoke-RestMethod -Uri ""
$CurrentIP = $listdomains.namesilo.request.ip
if ($record) { $RecordIP = ($listdomains.namesilo.reply.resource_record|where {$_.host -eq "$record.$domain" -and $_.type -eq "A"}).value $RecordID = ($listdomains.namesilo.reply.resource_record|where {$_.host -eq "$record.$domain" -and $_.type -eq "A"}).record_id
} else { $RecordIP = ($listdomains.namesilo.reply.resource_record|where {$_.host -eq "$domain" -and $_.type -eq "A"}).value $RecordID = ($listdomains.namesilo.reply.resource_record|where {$_.host -eq "$domain" -and $_.type -eq "A"}).record_id
}
$listdomains.namesilo.reply
#Write-Host "CurrentIP $CurrentIP, RecordIP $RecordIP, RecordID $RecordID"
# If the current IP address is not the same as the one in the record it updates it
Write-Host ""
if ($CurrentIP -ne $RecordIP){ if ($record) { Write-Host "Updating $record.$domain with IP $CurrentIP" } else { Write-Host "Updating $domain with IP $CurrentIP" } $update = Invoke-RestMethod -Uri "" $update.namesilo.reply
} else { Write-Host "No need to update $record.$domain, IP $CurrentIP upto date"
}Next save the script below in a file called UpdateDDNSIPv4.bat.
PowerShell -ExecutionPolicy Bypass .\NameSiloDDNS.ps1 <NameSilo_API_Key> somedomain.com
PowerShell -ExecutionPolicy Bypass .\NameSiloDDNS.ps1 <NameSilo_API_Key> somedomain.com subdomainKeep both the files in the same directory. UpdateDDNSIPv4.bat is the batchfile which should be called by Task Scheduler in your recurring task.
Couple of things to note, you will need to Login to your NameSilo account and under API Manager -> Generate an API Key which you need to enter in the batch script above to replace <NameSilo_API_Key>.
This script can be used to update your A DNS records for the main domain (e.g. somedomain.com) and also for your subdomains (e.g. subdomain). You can create one line for each domain/subdomain you want to update.
This script will automatically find your "Public IP Address" and then update your NameSilo DNS A records.
You can find a BASH equivalent of this script here:
A Python equivalent of a script can also be found at:
This script was taken and customized from
Hope this helps
I just got off the phone with an Xfinity representative and they had told me that their dynamic IP addresses are changed every time the modem/router is reset for whatever reason. I asked him to elaborate on that statement and he said that if I chose to hard reset the router myself, if the power went out, or if I had called in to reset the router, that the IP address will be changed to a new one. I also asked if I were to hard reset my router once a week, would this reset the IP address and the answer to this question was, unequivocally YES. This may be the answer to said question. maybe not.
In any event, to those who are saying that they only have had a few changes to their IP addresses, is the reason for this because you did not reset your router at all in the timeframes between IP address changes? are you able to refer to your current IP address and see if it changes after a hard reset to further confirm the reps claims?
I have Time Warner cable, which is probably pretty similar to your Comcast. I'm also running a public web server on my Raspberry Pi, with my domain name pointed to my public IP address. My IP address changes probably less than once per year. The few times it does, I just log into my register.com account and re-point the A record. I very seldom need to actually do that. In the past 5 years it's probably been about 3 times, and at least one of those was because I got a new cable modem. Yes, this is also anecdotal. However, I think there's enough anecdotal evidence out there to suggest that a public IP address from a cable internet provider is not likely to change very often.
Just a quick note with a few observations:
My Comcast IP changes once every couple of years.
Changing to a new router will cause you to get a new IP because of the mac address change. It also often require several modem reboots to get going again.
Extended power outages may trigger an IP change.
Cloning the mac address of the old router can prevent 1 and 2 above. I always do this, and it just generally makes life easier.
Every Comcast line I have ever worked with (many dozens of them) has had a very long lease time. My IP hasn't changed in years.