Image courtesy of Renjith Krishnan / FreeDigitalPhotos.net
Update: You can try our newer and easier guide which uses dns4e.com here
You might have recently setup your Raspberry Pi or your Linux box as a 24 x 7 torrent downloader, or a small Web server to host your own website. And just then you realize that your ADSL or Cable Internet connection has a dynamic IP address which changes frequently and every time you reconnect. Thus, it becomes hard to access your box with a fixed Domain name or IP address.
You might have recently setup your Raspberry Pi or your Linux box as a 24 x 7 torrent downloader, or a small Web server to host your own website. And just then you realize that your ADSL or Cable Internet connection has a dynamic IP address which changes frequently and every time you reconnect. Thus, it becomes hard to access your box with a fixed Domain name or IP address.
To solve this problem you can setup a Dynamic DNS which will update your IP to a DNS name everytime it changes and you can access you hosted website, or ssh into it to monitor torrent downloads with ease.
While there are many paid dynamic dns service providers available, but here you will see one way to do it for **FREE** [Thanks to freedns.afraid.org]
Step 1
Register for a Free domain at http://freedns.afraid.org/signup/
[We will take techhome.homenet.org in this guide]
Step 2
Logon to FreeDNS (where you just registered) and goto http://freedns.afraid.org/dynamic/
Or, simply click on "Dynamic DNS" link from the left navigation menu
Right click on "Direct URL" and copy the URL and paste it somewhere.
You should notice a large and unique alpha-numeric key in the URL, make a note of it as shown below:
http://freedns.afraid.org/dynamic/update.php?[alpha-numeric-key]
Step 3
Install inadyn using the following command:
sudo apt-get install inadyn
Step4
Configure inadyn using the below steps:
And add the following contains in it replacing the actual values:
Step 4
Now, we need to ensure that the DNS updater (Inadyn) runs automatically after every re-boot
export EDITOR=gedit && sudo crontab -e
Add the following line:
@reboot /usr/sbin/inadyn
Step 5
Reboot system and then run the following command to ensure inadyn is running:
ps -A | grep inadyn
Now your host is ready and up for accessing from internet...
You can trying ssh-ing from another computer over the internet
ssh username@techhome.homenet.org
Or, if any web server is running, then simply browse to http://techhome.homenet.org
Or, you can just ping it to test ping techhome.homenet.org
To check the logs you can use this:
more /var/log/messages |grep INADYN
This has been re-tested to be working perfectly with inadyn 1.96.2-1 on Raspbian 3.12.22+
Register for a Free domain at http://freedns.afraid.org/signup/
[We will take techhome.homenet.org in this guide]
Step 2
Logon to FreeDNS (where you just registered) and goto http://freedns.afraid.org/dynamic/
Or, simply click on "Dynamic DNS" link from the left navigation menu
Right click on "Direct URL" and copy the URL and paste it somewhere.
You should notice a large and unique alpha-numeric key in the URL, make a note of it as shown below:
http://freedns.afraid.org/dynamic/update.php?[alpha-numeric-key]
Step 3
Install inadyn using the following command:
sudo apt-get install inadyn
Step4
Configure inadyn using the below steps:
sudo nano /etc/inadyn.conf
And add the following contains in it replacing the actual values:
--username techhome --password mypassword --update_period 3600 --forced_update_period 14400 --alias techhome.homenet.org,alphanumeric key --background --dyndns_system default@freedns.afraid.org --syslog
Step 4
Now, we need to ensure that the DNS updater (Inadyn) runs automatically after every re-boot
export EDITOR=gedit && sudo crontab -e
Add the following line:
@reboot /usr/sbin/inadyn
Step 5
Reboot system and then run the following command to ensure inadyn is running:
Now your host is ready and up for accessing from internet...
You can trying ssh-ing from another computer over the internet
ssh username@techhome.homenet.org
Or, if any web server is running, then simply browse to http://techhome.homenet.org
Or, you can just ping it to test ping techhome.homenet.org
To check the logs you can use this:
more /var/log/messages |grep INADYN
This has been re-tested to be working perfectly with inadyn 1.96.2-1 on Raspbian 3.12.22+
I would recommend https://dns4e.com/ to use as a Dynamic DNS service. Ir provides very simple API to update DNS record with your public, or any other IP. You need cron and curl, which are most likely already installed. Just execute crontab -e and enter a line like this:
ReplyDelete*/10 * * * * curl 'https://api.dns4e.com/v7/me.dns4e.net/a' --user 'PublicKey:SecretKey' -X POST
It will update your IP on 10 minutes, or less if you change the first number. Also you can configure your own domain, or select a free subdomain under dns4e.net.
awesome api... no issues for now... very fast...
DeleteHi there. Thanks for the tip. I'm a super noob when it comes to CRON and I want to use this to keep a Raspberry Pi Domoticz server updated. I'm assuming you change the 'me' wording to the domain you registered with dns4e? When saving the Cron file, do you have to give it a name or just accept the defaults?
DeleteAwesome! Simple and working 100%!
DeleteOutstanding! Works perfectly.
DeleteThank you, useful!
DeleteReceived email from DN4E that "DNS4E will be working till April 15, 2015 and will stop providing services indefinitely". I switched to dynu.com instead. Free,IP update time is less than 1 miunte,free subdomain and custome domain names supported.
DeleteGood tutorial, but I didn't understand how to register for a free domain with FreeDNS. I created an account and then followed your link, but there was no domain created. Could you please explain what you mean by "Register for a free domain"? There are quite a few options there.
ReplyDeleteFrom the left hand navigation menu on FreeDNS website click on subdomain, and choose a subdomain of your choice of Type: A
DeleteYour address would be like .subdomain.com and this will point to your public IP address of your RasPi
Hello Abhishek,
DeleteI read your really useful articles about creating owncloud for Raspberry Pi. Since I wanted to access OwnCloud through Dynamic DNS from freedns.afraid.org, I first obtained one domain name based on your article. I can ping to this IP address and domain name fine. But I cannot login to Owncloud,
INADYN gives following error messages:
W:INADYN: Main: error ‘RC_DYNS_RSP_NOTOK’ (0x48).
INADYN: Started ‘INADYN version 1.96.2’ –dynamic DNS updater.
I:INADYN: IP address for alias ‘xxx.yyyy.com’ needs update to ‘xx.yy.zz.uu.vv’
W:INADYN: Error validating DYNDNS svr answer . Check usr, pass, hostname, abuse,…!
W:INADYN: DYNDNS Server response:#012HTTP/1.1 200 OK#015#012Server:nginx#015#012Date:….
And errors in nginx_start_errors:
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
….
What am I doing wrong? Any help will be highly appreciated. Thank you.
Hello,
DeleteThere are couple of things that might go wrong...
1. Check you have performed everything correctly as in Step. 4
2. If you see everything is right as mentioned in Step.4 then try the following:
Uncomment the following line from nginx.conf
pid /var/run/nginx.pid;
This is probably due to some issue with a few versions of nginx scripts,though I haven't faced this but it appears there are many other users over internet who are troubled.
Good Luck!
Thanks for your tutorial. My problem is that I paid money for my standard dns with DYN, two weeks ago and still I have not managed to use treir service. Can you help?
ReplyDeleteI have not used the paid service from dynDNS or freedns.afraid.org however the concept should be same. You can try reaching out to their helpdesk / support since you're a paid / premium customer.
DeleteYou might want to note that inadyn has to be installed first (and isn't installed in raspbian at least). Apart from that, this worked like a charm, thanks.
ReplyDeleteYou're right... I missed out on mentioning the steps about installing inadyn. The post is updated now. Thanks for the note!
DeleteDoes this require Port Forwarding to be configured on the router to which RPi is attached?
ReplyDeleteI have followed the steps and trying to ssh into RPi from an external computer (different network). I am getting "connection refused" message. I also tried canyouseeme.org and found out the port 22 open test is always timed out. Any insights?
What is your setup that works perfectly?
Thanks.
Yes if your Raspberry Pi is behind a router you will have port forward from your router to your device.
DeleteWhat port do I need to foward?
Deleteif your ssh is running on port 22 (default) then you need to forward that to any unused port on your router. You should try connecting to the port which you have forwarded from your router to your raspberry pi for ssh protocol.
DeleteFor more details on port forwarding please go through some tutorials on google, that might give you a detailed insight.
there is no /etc/inadyn.conf in my raspberry even after I installed the inadyn... whats wrong?
ReplyDeleteYou can try creating the file if missing.
Deletehey , i dont understand what --alias techhome.homenet.org,alphanumeric key?
ReplyDeletecan u share me about alphanumeric key? where i find it
You will get your unique alpha numeric key from step 2 mentioned.
DeleteGreat post and thanks for continuing to answer questions.
ReplyDeleteStep 4 re-opens GNU Nano, which is full of text. Where do I add the extra reboot line?
Add the line at the end of the file, no need to change anything existing.
DeleteI can't find: "Right click on "Direct Link" and copy the URL and paste it somewhere" anywhere. Have they change the site since you made this guide. Or am I blind :/ Thanks for great guides!
ReplyDeleteI have updated that section of the guide with more clarity, Hope this helps you better now.
DeleteSetup and config works like a charm with afraid.org, but keep getting this error:
ReplyDeleteApr 17 23:42:44 raspberrypi INADYN[1936]: W: DYNDNS: Error 'RC_IP_RECV_ERROR' (0x15) when talking to IP server
Apr 17 23:42:44 raspberrypi INADYN[1936]: W:'RC_IP_RECV_ERROR' (0x15) updating the IPs. (it 3)
Do you know if this is due to Inadyn is using checkip.dyndns.org to find my IP-address and this service is responding incorrectly?
Iam getting the same error on an newly updated raspian system:
ReplyDeleteINADYN:IP: Error 0x68 in recv()
W: DYNDNS: Error 'RC_IP_RECV_ERROR' (0x15) when talking to IP server
W:'RC_IP_RECV_ERROR' (0x15) updating the IPs. (it 3)
I think this is a bug in Inadyn...
I am getting same error. Is there other program which could be substituted for Inadyn?
ReplyDeleteI got 2 errors in the log
ReplyDeleteSep 10 16:21:14 raspberrypi INADYN[1910]: INADYN:IP: Error '0xb' resolving host name 'checkip.dyndns.org'
Sep 10 16:21:14 raspberrypi INADYN[1910]: W: DYNDNS: Error 'RC_IP_INVALID_REMOTE_ADDR' (0x12) when talking to IP server
what's wrong?
i can open my surocam program "webiopi" offline. iplocaladdr:8000, then i online use *****.chickenkiller.com or *****.chickenkiller.com:8000 is not working. when i ping *****.chickenkiller.com its working.. can you help me to fix it.?
ReplyDeleteCheck if port forwarding is done properly in case you have a router in between.
DeleteIt's also free at hn.org.
ReplyDeleteAre you able to have 2 different alias lines in the inadyn.conf??
ReplyDeleteIs it just a case of entering -
--alias techhome.homenet.org,alphanumeric key
--alias techhome2.homenet.org,alphanumeric key2
into the file?
Being a newbie, this is an Interesting thread.
ReplyDeleteCan this be used also, having a virtual server setup on the RPi, reporting dyn IP for all the multiple own domains I have on the virtual server?
Sincerely,
Christian
I had to make some changes to the inadyn config to get it working:
ReplyDelete# Service provider
system default@freedns.afraid.org
# Hostname
# Only use url, not alphanumerical key.