{"id":7,"date":"2008-08-17T19:14:27","date_gmt":"2008-08-17T17:14:27","guid":{"rendered":"http:\/\/bassmadrigal.com\/blog\/?p=7"},"modified":"2009-02-10T16:45:36","modified_gmt":"2009-02-10T14:45:36","slug":"opendns-dynamic-ip-update-script-through-linux","status":"publish","type":"post","link":"http:\/\/bassmadrigal.com\/blog\/2008\/08\/opendns-dynamic-ip-update-script-through-linux\/","title":{"rendered":"OpenDNS Dynamic IP Update Script through Linux"},"content":{"rendered":"<p>I recently read a blog post on the How-To Geek about <a title=\"Protect Your Kids Online Using OpenDNS\" href=\"http:\/\/blogs.howtogeek.com\/mysticgeek\/2008\/08\/07\/protect-your-kids-online-with-any-os-using-open-dns\/\" target=\"_blank\">setting up OpenDNS<\/a> and the options it gives you to secure your internet browsing. They have quite a few filtering options including Phishing sites, along with blocking adult-related sites, and about 50 other categories along with a fully redundant DNS nameserver resolving. I decided to try it and set it up on my home network. The problem is that if you have an internet provider that provides you with a dynamic IP (IP address changes occasionally, if you aren&#8217;t sure what you have you probably have a dynamic address), you need to update the IP with OpenDNS. They have a lot of clients out there to do it, but as far as I found there were no linux clients. So I created a short linux script to do just that.<\/p>\n<p>[lang=&#8217;bash&#8217;]#!\/bin\/bash<\/p>\n<p># Copyright (C) 2006 Jeremy Brent Hansen<br \/>\n#<br \/>\n# These are for your OpenDNS username and password. At this time, I do<br \/>\n# not know how to hide this info, so you will need to make sure you have the<br \/>\n# correct file permissions.<br \/>\nusername=your_opendns_username<br \/>\npasswd=your_opendns_password<\/p>\n<p># This is where the log file will be stored. Currently it only logs the current IP<br \/>\n# and the response back from OpenDNS. The log will keep one backup. I<br \/>\n# just used a folder in my home directory (make sure the folder exists).<br \/>\nlog_dir=~\/.opendns<\/p>\n<p># Revolves the log file. Keeps one backup.<br \/>\nmv $log_dir\/log $log_dir\/log.1<\/p>\n<p>while [ 1 ]<br \/>\ndo<\/p>\n<p>\tdate >> $log_dir\/log<br \/>\n\t\/usr\/bin\/curl -i -m 60 -k -u $username:$passwd &#8216;https:\/\/updates.opendns.com\/account\/ddns.php?&#8217; -silent >> $log_dir\/log<br \/>\n\techo -e &#8220;\\n&#8221; >> $log_dir\/log<\/p>\n<p># Resends the info after 5 minutes. Eventually I plan on changing it,<\/p>\n<p># so it only updates when your IP changes.<br \/>\n\tsleep 600<\/p>\n<p>done[\/lang]<\/p>\n<p>So, there you have it. No root permissions are required, so I just have it in my .profile for my normal user. Just run it with the &amp; at the end, so it will background the process.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently read a blog post on the How-To Geek about setting up OpenDNS and the options it gives you to secure your internet browsing. They have quite a few filtering options including Phishing sites, along with blocking adult-related sites, &hellip; <a href=\"http:\/\/bassmadrigal.com\/blog\/2008\/08\/opendns-dynamic-ip-update-script-through-linux\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[22,3,4,29,14],"tags":[16,55,54],"_links":{"self":[{"href":"http:\/\/bassmadrigal.com\/blog\/wp-json\/wp\/v2\/posts\/7"}],"collection":[{"href":"http:\/\/bassmadrigal.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bassmadrigal.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bassmadrigal.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/bassmadrigal.com\/blog\/wp-json\/wp\/v2\/comments?post=7"}],"version-history":[{"count":5,"href":"http:\/\/bassmadrigal.com\/blog\/wp-json\/wp\/v2\/posts\/7\/revisions"}],"predecessor-version":[{"id":10,"href":"http:\/\/bassmadrigal.com\/blog\/wp-json\/wp\/v2\/posts\/7\/revisions\/10"}],"wp:attachment":[{"href":"http:\/\/bassmadrigal.com\/blog\/wp-json\/wp\/v2\/media?parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bassmadrigal.com\/blog\/wp-json\/wp\/v2\/categories?post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bassmadrigal.com\/blog\/wp-json\/wp\/v2\/tags?post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}