Link to home
Start Free TrialLog in
Avatar of Goutham
GouthamFlag for India

asked on

how to convert static zones to dynamic in ubuntu ddns linux

Dear Experts:

I am having DDNS server (ubuntu server) working as DDNS wherein as of now have static zones

 please help me how to  convert static zones tot the dynamic

Thanks in advance.
Avatar of Papertrip
Papertrip
Flag of United States of America image

Converting a zone to dynamic is straight forward to do and you should already have a similar config in place for your zones that are being updated by DHCPD.

Check out the allow-update and update-policy options at http://www.zytrax.com/books/dns/ch7/xfer.html#allow-update
Avatar of Jan Bacher
The syntax is:

# nsupdate -y keyname:secret
    update add host.example.com 3600 A 192.168.1.1
    update add host2.example.com 3600 a 192.168.1.2
    update add 1.1.168.192.in-addr.arpa 3600 in ptr host.example.com
    update add 2.1.168.192.in-addr.arpa 3600 in ptr host2.example.com
    send

Make a comma delimited list of all of your forward and inverse addresses in this format with a sample filename of ddns.txt:

host.example.com,A,192.168.1.1
host2.example.com,A,1921.68.1.1
1.1.168.192.in-addr.arpa,in ptr,host.example.com
2.1.168.192.in-addr.arpa,in ptr,host2.example.com

Remove all of the static hosts in your zone files and reload your DNS server.

cat ddns.txt | while read line
  do
  set $line
  FIRST=`echo $line | cut -d "," -f1
  SECOND=`echo $line | cut -d "," -f2
  THIRD=`echo $line | cut -d "," -f3
  nsupdate -y keyname:secret
  update add $FIRST 3600 $SECOND $THIRD
  send
  quit
 done
There is no need to recreate the zone using nsupdate, just add either allow-update or update-policy options depending on your needs to the zone config block and reload.
If the host already has an ip address assigned, it's past the ddns update stage in the dhcpd.conf file.
Avatar of Goutham

ASKER

Please find the below /etc/bind/named.conf.local:

include "/etc/bind/rndc.key";
//include "/etc/bind/ddns.key";

controls {
        inet 127.0.0.1 port 953
                allow {127.0.0.1; } keys { "rndc-key"; };
};

zone "shriramdb.com" {
        type master;
        file "/var/cache/bind/db.shriramdb.com";
        update-policy local;
};
zone "1.168.192.in-addr.arpa" {
        type master;
        notify no;
        file "/var/cache/bind/db.1.168.192.in-addr.arpa";
        update-policy local;
};

zone "shriramproperties.com" {
        type master;
        file "/var/cache/bind/db.shriramproperties.com";
        update-policy local;
};

//## dynamic zones (updated by DDNS) ##

zone "dyn.shriramdb.com" {
        type master;
        file "/var/cache/bind/dynamic/db.dyn.shriramdb.com";
        allow-update { key "ddns-key"; };
};
-------------------------------------------------------------

After this i started adding entries like by executing
nsupdate -l

> update add gateway.example.local 38400 A 192.168.1.254
 >
 > update add 254.1.168.192.in-addr.arpa. 38400 PTR gateway.example.local.
 >
 > quit
-----------------------------------------

Please check my above config ,now tht waht ever entries made by entering nsupdate and add A and PTR records those have to be manually assigned to that particular host.

Please correct me if i am wrong. Thanks in advance.
Please check my above config ,now tht waht ever entries made by entering nsupdate and add A and PTR records those have to be manually assigned to that particular host.

I'm not sure what you mean.  DHCP can still give out addresses to those hosts, but any zones that have update-policy local and/or do not have allow-update with ddns-key will not be updated by DHCPD.  

Is that what you are asking?
Avatar of Goutham

ASKER

Sir, this is what exactly happening DHCP is still giving out the address to those hosts this has to be fixed, please tell me what to be done.
Your DHCP server is not looking at the zone file before assigning IP's, it's only updating the zone with record from IP's that it does assign (as long as allow-update with the proper key is configured).

If you don't want specific addresses being handed out by DHCP you need to exclude them from the subnet declaration in dhcpd.conf.
Avatar of Goutham

ASKER

HI, Sir , thanks for the reply,  I could observe even after assigning IP , Subnet, GW and DNS entries manually on to the host but the same host entries are not yet added to the static zones of NS in this case DHCP is assiging the IP to these host.

Please  suggest me  why this is happening. Please help.
I'm not clear on what you are saying.

First you say that you manually assigned all the network info to the host, then you say DHCP is assigning it the IP?

Either you configure the client manually or you let DHCP take care of it... which are you doing?  What OS are these clients running?

In regards to configuring a host manually and then not seeing the changes reflected in the static zone, well that is because you are configuring it manually and not using DHCP to provide the network info and update a dynamic zone.
Avatar of Goutham

ASKER

Sir,

i tried like extecuting like below

sudo cat ddns.txt | while read line
> do
> set $line
> FIRST=`echo $line | cut -d "," -f1
> SECOND=`echo $line | cut -d "," -f2
> THIRD=`echo $line | cut -d "," -f3
> nsupdate -l
> update add $FIRST 3600 $SECOND $THIRD
> send
> quit
> done

 ----------------------
terminal is not coming out from the loop  it stays > to come out should use CTL C
-------------------------------

Please suggse tme in this. Thanks in advance.
ddnstxt.txt
Woops have to run will finish this reply later.
Avatar of Goutham

ASKER

Hi sir , execute while and do statements for the attached zones after keying in done prompt does not come out it requires ctrl c.  Please help.
zone-forward.txt
zone-reverse.txt
Avatar of Goutham

ASKER

Hi,  Papertrip sir as per previous post iam bringing this request, please help.
Hey D,

Sorry man I just haven't had time to reply to this question.  The good news however is that I do now have time and will have a proper reply shortly.
ASKER CERTIFIED SOLUTION
Avatar of Papertrip
Papertrip
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial