Setup Linux to Read Dns Names Dynamicallyh

Parent page: Internet and Networking

Contents

  1. Dynamic DNS Introduction
  2. Registering with a Dynamic DNS provider
  3. Setting up Dynamic DNS service updates
    1. Using a software utility to perform Dynamic DNS Updates
      1. ddclient
        1. Troubleshooting
          1. Running ddclient with cron
      2. Now-IP with Ringlet
      3. Namecheap & Python
      4. no-ip
      5. inadyn
      6. Using dy.fi by cron tab
    2. Using your Modem/Router to perform Dynamic DNS Updates
  4. Redirecting a registered hostname to a dynamic DNS name
    1. CNAME aliases
  5. Other resource

Dynamic DNS Introduction

Every estimator attached to the Net has an IP accost. Proper name Translation is the procedure of relating a proper name (like 'www.google.com') to an IP address (like '74.125.19.103') so that a website (or other service) on a estimator tin exist accessed using an easily remembered name, rather than the IP accost number of the estimator. Name Translation is implemented via a distributed database known as the Domain Name System.

This database is implemented on the Internet by DNS name servers which continue rails of DNS records and commutation this data between each other to maintain consistency. Every request for a name (ie. a spider web browser) is then directed to one of these proper name servers.

Most servers on the Internet have a fixed (static) IP accost that never changes. The DNS record for this node will but change infrequently.

However, many dwelling users are assigned an IP address that changes more frequently. These dynamic IP addresses are assigned by an ISP. This makes it a claiming to interpret a Proper noun to one of these IP addresses.

A number of DNS name servers offering a method to update the DNS database with dynamic IP name translations. This is accomplished by using a pocket-sized software utility on their computer or a local router.

These Dynamic DNS services permit the user to cull a hostname and fix an initial IP address to stand for to that hostname. The software utility then periodically checks for a alter to the estimator's IP address, and when a new IP address is discovered, it updates the Dynamic DNS database to reverberate that alter.

Registering with a Dynamic DNS provider

DNS requires that a name server somewhere on the Internet continue rails of 'where you are' (i.e. your electric current IP address). That is, its database must ever be updated to make certain your hostname always corresponds to your current IP address.

In order to use one of these Dynamic DNS services, registration is required first. Here is a choice of these services (a full listing is available at DMOZ and at Dynamic DNS):

  • DynDNS.com

  • No-IP

  • Dynu.com(gratuitous)

  • EasyDNS

  • ZoneEdit

  • DNSPark

  • NameCheap

  • DSLReports

  • FreeDNS (Agape.org)

  • OpenDNS

  • dy.fi (Finland only)

  • deSEC

  • DNS Made Easy

  • Now-IP

Upon registering, yous will select a username and password, every bit well every bit a hostname that you will employ as the DNS name (to allow external admission to your automobile using the hostname).

Many Dynamic DNS providers offer a selection of hostnames bachelor for gratuitous use with their service. However, with a paid program, whatever hostname (including your ain registered domain proper name) tin can be used.

Setting up Dynamic DNS service updates

Once you lot take chosen a Dynamic DNS service provider, you need to ready a way that your IP accost record will exist updated whenever it is changed. There are two ways of doing this:

  • using a dynamic DNS software utility that is installed on your calculator
  • using the built-in capabilities of a cablevision/DSL modem/router

Many router/modems support Dynamic DNS reporting/notification/updating directly. If your router'due south configuration is accessible from a web browser, endeavour accessing it by logging into the local IP accost of your router (for example, http://10.one.one.1/ or http://192.168.0.1/ ) and look for the Dynamic DNS (DDNS) settings.

Nonetheless, even if your modem/router does back up dynamic DNS reporting, there are cases in which y'all may wish to use a software utility on your computer to perform the updates anyway:

  • y'all are using several Dynamic DNS services at one time (most routers but accommodate i service at a fourth dimension)
  • the router does not back up your detail Dynamic DNS service
  • your server is on a mobile calculator (e.g. laptop) which is non always connected to the same network/router/modem.

Using a software utility to perform Dynamic DNS Updates

There are several bachelor utilities. Each Dynamic DNS service may work ameliorate with a item utility. (Y'all may demand to add the Ubuntu Universe to your gear up of software repositories to install some of these utilities. See InstallingSoftware.)

ddclient

ddclient is the original Linux utility for dynamic DNS updates. The ddclient wiki lists some configurations for several Dynamic DNS services. More info can exist found on the ddclient forums. The post-obit department has been adapted from Ubuntuguide.org Dynamic IP servers.

  • Install ddclient using a software package manager, or using the command-line interface:
          sudo apt-become install ddclient

If this is the commencement time you have installed ddclient, you lot will exist prompted by the installation script for the hostname(s) that you registered with DynDNS (or other Dynamic DNS service). You will also exist prompted for the username/password your registered with your Dynamic DNS service. Lastly, yous will be asked which ethernet port you primarily use to connect to the Internet (eth0 for wired or wlan0 for wireless, ordinarily). Most of the fourth dimension this is all y'all volition need to do for the utility to function correctly.

You tin can also later edit the ddclient configuration file, however, to suit your specific needs (or if y'all make changes to your service, hostname, or other variables).

  • Edit the ddclient configuration file (using kate instead of nano in Kubuntu, or gedit instead of nano in Ubuntu):
                    sudo nano /etc/ddclient.conf
  • To set the number of seconds between updates, I add the line
                    daemon=3600

My dynamic IP only changes rarely, so I only bank check it hourly (3600 seconds in an hour).

  • To apply secure SSL communications, I add the line
                    ssl=yes
  • To use the DynDNS checkip service (which will autodetect your current IP address), I add the line
                    use=web, web=checkip.dyndns.com/, web-skip='IP Address'

My configuration file now looks like:

                    # Configuration file for ddclient generated by debconf                    #                    # /etc/ddclient.conf                    #                    # Check the current IP address. Either check the eth0 port for its electric current IP address (tin can't be used on a LAN),                    # or use the DynDNS IP checking service.                    daemon=3600                    pid=/var/run/ddclient.pid                    #use=if, if=eth0                    use=web, web=checkip.dyndns.com/, web-skip='IP Address'                    #                    # Login and alter the values at the DynDNS site, using SSL.                    protocol=dyndns2                    ssl=aye                    server=members.dyndns.org                    login=myDynDNSusername                    password='myDynDNSuserpassword'                    mysite_1.dynds.org,mysite_2.dyndns.org,mysite_3.dyndns.org

Note: if this doesn't piece of work, try irresolute spider web-skip to 'Current Address'

Notation that the password must exist enclosed in quotation marks, e.g 'myDynDNSuserpassword' for DynDNS.

To use ddclient with Dynu costless dynamic DNS service, the configuration file is as followed:

          # ddclient configuration for Dynu          #          # /etc/ddclient.conf          daemon=60                                                # Check every 60 seconds.          syslog=yes                                               # Log update msgs to syslog.          mail=root                                                # Mail all msgs to root.          mail-failure=root                                        # Mail failed update msgs to root.          pid=/var/run/ddclient.pid                                # Record PID in file.          utilize=spider web, web=checkip.dynu.com/, web-skip='IP Address'    # Get ip from server.          server=api.dynu.com                                      # IP update server.          protocol=dyndns2          login=myusername                                         # Your username.          password=YOURPASSWORD                                    # Password or MD5 of password.          MYDOMAIN.DYNU.COM                                        # Listing one or more hostnames ane on each line.          MYDOMAIN.COM

Note: refer to this setup page for more information most updating subdomains.

  • Ensure that the configuration is working:
                    sudo ddclient -daemon=0 -debug -verbose -noquiet
  • Notation that you can add together boosted services and/or domain names to exist updated just by calculation an boosted block to the configuration file (appropriate for the service). Here is an case (encounter below for references to boosted examples).
                    protocol=otherDDNSservice                    server=any.ddnsservice.org                    login=MyOtherDDNSserviceusername                    password=MyOtherDDNSservicepassword                    mysite4.dnsservice.org, mysite5.dnsservice.org

Troubleshooting

The following details a troubleshooting method used to repair a ddclient setup.

  • Remove/purge all of the previous install attempts:
          sudo apt-get remove --purge ddclient
  • Install ssh & ssh socket and then that you lot tin ship your password via ssh instead of in the articulate:

          sudo apt-get install ssh libio-socket-ssl-perl

Note: ssh w/ddclient won't piece of work without libio-socket-ssl-perl, so make sure that you install that even if y'all have ssh already installed.

  • Reinstall a current ddclient package from the repositories:
          sudo apt-go install ddclient

At the prompts enter the appropriate values, for instance:

  • Dynamic DNS service provider: www.dyndns.com

  • DynDNS fully qualified domain names: your-hostname.dyndns.org

  • Username for dynamic DNS service: your-username

  • Countersign for dynamic DNS service: your-password

  • Interface used for dynamic DNS service: spider web

  • Modify the /etc/ddclient.conf to send the countersign using ssh and to properly check for the IP address:
          sudo gedit /etc/ddclient.conf

Add entries for "daemon", "ssl" and replace "use=if, if=web" with "use=web" to lucifer the following instance:

          # Configuration file for ddclient generated by debconf          #          # /etc/ddclient.conf                    daemon=300          pid=/var/run/ddclient.pid          ssl=yes          employ=spider web, web=checkip.dyndns.com/, spider web-skip='IP Accost'          login=your-username          password=your-password          protocol=dyndns2          server=members.dyndns.org          your-hostname.dyndns.org

Reference for secure updates: https://www.dyndns.com/support/kb/using_ddclient_with_dyndns_services.html

Now ddclient is ready to run every bit a daemon. Because you had other ddclient configs previously, check:

          sudo gedit /etc/default/ddclient

Check to make sure it contains the following lines:

          run_ipup="false"          run_daemon="true"          daemon_interval="300"

Note: you can set the interval shorter or longer, just if you do, besides reset your /etc/ddclient.conf to friction match. https://bugs.launchpad.net/ubuntu/+source/ddclient/+issues/152875

Now, simply to be sure everything sticks I generally reboot at this signal, then check the status afterward:

          sudo /etc/init.d/ddclient condition

You should run across:

          Status of Dynamic DNS service update utility: ddclient is running

However, that may not ever catch problems in the ddclient.conf file, and then issue:

          sudo /etc/init.d/ddclient restart

if y'all exercise not get an error similar to the following yous probably are expert to go:

          Warning: file /etc/ddclient.conf, line 10

And then I obtain a new IP accost/lease from my service provider (shutting off the modem, having my router request a new lease, whatever) & monitor https://world wide web.dyndns.com/business relationship/services/hosts/ to run across if the change actually makes information technology to dyndns. Besides monitor /var/log/syslog to watch the changes there as well.

As well note that there is a password length limitation.

  • Not very well tested, but passwords >=64 characters in length seem to fail. If you accept a fairly long password, try changing it something shorter temporarily (try viii characters) to see if that'due south the problem.

Running ddclient with cron

Cron is the automatic task scheduler for Linux systems. Although ddclient runs as a daemon, for various reasons I have establish it necessary to force an update at to the lowest degree once a day. This can exist done every bit a daily scheduled task, using cron.

  • Edit the crontab with administrative (root) privileges:
                    sudo crontab -e
  • Add the line:
                    45 04 * * * /usr/sbin/ddclient --force

This will run ddclient and force an update daily at 04:45. See here for a full description of cron and its options or Ubuntu Community Aid -- Cron.

Now-IP with Curl

Updating from Ubuntu is easy using just curl and Now-IP

          coil -u <email>:<password> "https://now-ip.com/update?hostname=<hostname>"

Namecheap & Python

You tin update with namecheap and python with the following script. Utilise your prefered editor and create the file /domicile/USERNAME/update_dns

          # -*- coding: utf-8 -*-          import urllib2                    urllib2.urlopen("http://dynamicdns.park-your-domain.com/update?host=%s&domain=%s&password=%s" % ("@", "YOURDOMAIN", "YOURPASSWORD"))

Enter into the concluding

          crontab -eastward

and add the post-obit line

          * */ane * * * python /abode/USERNAME/update_dns

This will update every hour.

no-ip

This is another Dynamic DNS reporting client. Install the noip2 parcel from a software parcel managing director, or from the control-line interface:

          sudo apt-get install noip2
  • Run no-ip and follow the installation prompts:
          sudo no-ip -C          Please enter the login/email cord for no-ip.com: <your_login>          Please enter the password for user 'your_login': <your_password>          Delight enter an update interval:[30] <interval time in minutes>          Exercise you wish to run something at successful update?[Due north] <North>
  • Kickoff the no-ip client
          sudo no-ip

inadyn

  • Install the inadyn parcel using a software bundle manager, or from the command-line interface:

          sudo apt-get install inadyn
  • Edit the file /etc/inadyn.conf:
          sudo gedit /etc/inadyn.conf

It should incorporate something similar:

          --username myusername          --password mypassword          --update_period 60000          --allonym myhost.dyndns.org          --background
  • Examination that it works:
          sudo /usr/sbin/inadyn

* Add inadyn to your 'crontab':

          consign EDITOR=gedit && sudo crontab -e

Edit the file to add the post-obit line:

          @reboot /usr/sbin/inadyn
  • Verify using:
          sudo crontab -l
  • When you reboot, you should see indyn listed when you lot blazon:
          ps -A | grep inadyn

You should be able to log in to your Dynamic DNS provider'southward website and verify that the DNS entry is being updated. Certainly this is possible with www.dyndns.org, in any case. Alternatively you lot tin blazon your hostname into a service similar http://www.dnsstuff.com/.

Using dy.fi by cron tab

Edit crontab:

          sudo crontab -e

Add lines To update ddns at 0610 monday-sat:

          10 06 * * 1-half dozen wget --delete-after --no-check-document --no-proxy --user=yourname@yourmail.fi --password=countersign 'http://www.dy.fi/nic/update?hostname=yourdomain'

Add lines To redirect ddns and stop pointing 5.10pm mon-sat:

          10 17 * * ane-6 wget --delete-later --no-cheque-certificate --no-proxy --user=yourname@yourmail.fi --password=countersign 'http://www.dy.fi/nic/update?hostname=yourdomain&offline=yes'

Another method is to install the perl script dyfi-update.pl from http://world wide web.dy.fi/page/clients

Using your Modem/Router to perform Dynamic DNS Updates

Hither are some case screenshots from Wireless Routers that support dynamic DNS updates:

Netgear router instance:

  • dyndns.jpg

D-Link router example:

  • routerdyn.jpg

Linksys/Cisco router example:

  • linksysdyndns.jpg

Redirecting a registered hostname to a dynamic DNS proper name

A user may already have a hostname registered with a name server that does not have Dynamic DNS capabilities. Most DNS services let URL forwarding, however. That makes it possible to set upwards a free Dynamic DNS service (using the instructions in a higher place) with a free hostname (URL) and and then forward the previously-registered static hostname (URL) to the Dynamic DNS hostname (URL).

For example, I set up a gratis Dynamic DNS hostname URL at DynDNS.com that is foobar.dyndns.org. I prepare my software utility (DynDNS likes ddclient or inadyn) to constantly update the Dynamic DNS database for foobar.dyndns.org.

However, I have used example.myoriginalfoobar.com as a registered hostname (URL) for years, with a static DNS service (DinosaurDNS.org) that doesn't have Dynamic DNS capabilities. I login to DinosaurDNS.org and set my DNS tape for example.myoriginalfoobar.com to forward (using a CNAME (Alias) tape) to foobar.dyndns.org.

At present anyone trying to admission example.myoriginalfoobar.com volition be redirected to foobar.dyndns.org, which volition then redirect them to whichever IP accost my Dynamic DNS updating utility has specified.

Using forwarding rules, an infinite number of URLs can be forwarded to a unmarried dynamic URL. (The primary host that resides at the destination IP address must then resolve the forwarded URLs (using virtual host or .htaccess files) and direct them to the appropriate server on the reckoner (or LAN).) For this reason, it is simply necessary to accept one dynamic DNS URL for your computer (or LAN).

CNAME aliases

Different DNS registrars take different methods of forwarding a URL, merely in full general there is i method common to all of them: CNAME aliases.

If you have a URL registered with a DNS registrar, go to the DNS settings for your domain name. Delete whatsoever A records (or other entries) and use only CNAME entries.

For example, allow'southward say my complimentary Dynamic DNS URL is foobar.dyndns.org (at DynDNS.com). My domain URL is myoriginalfoobar.com, registered at DinosaurDNS Registrar.

Logging into DinosaurDNS Registrar, I edit the DNS settings for myoriginalfoobar.com (which in my control panel is establish under Manage DNS). I make certain I have these entries:

                    Name Type Content                    @ CNAME foobar.dyndns.org.                    world wide web CNAME foobar.dyndns.org.                    example CNAME foobar.dyndns.org.

The period ("full stop") at the end of the URL is important to designate that the CNAME is a FQDN (fully qualified domain name). A CNAME should not have "http://" in information technology. The @ symbol indicates a URL name without the showtime segment, e.g. the URL myoriginalfoobar.com by itself. In this case, I am forwarding myoriginalfoobar.com, www.myoriginalfoobar.com, and example.myoriginalfoobar.com.

Using CNAME aliasing, the original URL is retained in the browser. It is upwards to you lot (using virtual host files or Rewrite rules in the .htaccess files of Apache, for example) if yous wish to massage the URL at your server (to change it to a canonical proper noun) or redirect it.

Other resources

Much of this page was adapted from the original articles at:

  • Ubuntuguide.org Dynamic IP servers -- information about Dynamic DNS and setting up one or more than webservers using Dynamic DNS with ddclient

  • Kubuntuguide Dynamic IP servers -- information virtually Dynamic DNS and setting upward one or more than webservers using Dynamic DNS with ddclient


CategoryInternet CategoryNetworking

moralezliamed.blogspot.com

Source: https://help.ubuntu.com/community/DynamicDNS

0 Response to "Setup Linux to Read Dns Names Dynamicallyh"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel