Solved

how to set dns to allow the settings of TTL

Posted on 2011-09-27
19
494 Views
Last Modified: 2012-05-12
Hi,
I have a small issue regarding dns, I would like a attributes to set TTL's of record.
Thanks.
0
Comment
Question by:lionel3030
  • 10
  • 9
19 Comments
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714618
Setting TTL's for records should be very straight forward.

Which DNS server are you running?
0
 

Author Comment

by:lionel3030
ID: 36714658
Hi Papertrip,
I used Bind
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714668
OK cool, I know BIND very well so this should be quick and easy.

Your original question is a bit unclear, what exactly are you trying to do?  Do you need to change the TTL of an existing record?  Do you have questions about TTL in general?  Also, are you using dynamic zones?
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:lionel3030
ID: 36714686
Ok what i am trying to do is to learn how to set attribute to set the TTLs of records, its on chef for cloud recipes
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714697
I'm not familiar with Chef -- do you use that to administer your DNS zones, or do you update them manually?
0
 

Author Comment

by:lionel3030
ID: 36714701
I am trying to get chef to take all credentials for route53 (DNS) attributes from encrypted data bags thus updating the record from there.
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714712
Unfortunately I have no experience with Chef.  I did some research on it and I know what it is now, so maybe I can still help you since the underlying server is running BIND.

How are you adding records to DNS via Chef now?  Any information about how you are using Chef + DNS will help a lot.
0
 

Author Comment

by:lionel3030
ID: 36714731
Using the following:
default[:route53][:zone_id] = "ZONE_ID"
default[:route53][:aws_access_key_id] = "KEY"
default[:route53][:aws_secret_access_key] = "SECRET"
So from here I am trying to get all this info in one place and give a attribute to set the TTL's, I have searched around to get this working but for some reason it's beyond me.
Thanks.
0
 

Author Comment

by:lionel3030
ID: 36714736
might be able to use something like # route53 add_record ZONEID db01.mycompanycloud.com CNAME ec2-51-10-11-89.compute-1.amazonaws.com 3600 but not sure it is going to give me exactly what i want.
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714753
OK I did some research on route53, and it looks like you are correct in your guess.

route53 add_record ZONEID db01.mycompanycloud.com CNAME ec2-51-10-11-89.compute-1.amazonaws.com 3600

Open in new window

After you run that, you can test at http://tools.whois.net/dig/  -- The 2nd field you see in the ANSWER SECTION is the TTL value of the record.

If this is a new record, you should see the results almost immediately.  If you are updating an existing record, and the DNS server you are querying still has a cached version of the old record, then your TTL changes will not be visible until the old TTL has expired.

Make sense?
0
 

Author Comment

by:lionel3030
ID: 36714770
Yep it does but 1 thing i dont have anything to do to set attributes?
0
 

Author Comment

by:lionel3030
ID: 36714777
maybe this might work as well?
aws_creds = Chef::EncryptedDataBagItem.load("aws", "#{node[:mycompany_vars][:customer_name]}_keys")
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714786
Do you mean setting the TTL in these attributes?

default[:route53][:zone_id] = "ZONE_ID"
default[:route53][:aws_access_key_id] = "KEY"
default[:route53][:aws_secret_access_key] = "SECRET"
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714796
So that part is getting into how Chef works, which I'm not familiar with.

However, I did find this:

Here's how you add a CNAME record with a TTL of 60 seconds to an existing zone (assuming the 'zone' variable contains the zone you're looking for). You need to operate on the zone ID, which is the identifier following the text '/hostedzone/' in the 'Id' field of the variable 'zone'.

from boto.route53.record import ResourceRecordSets
zone_id = zone['Id'].replace('/hostedzone/', '')
changes = ResourceRecordSets(conn, zone_id)
change = changes.add_change("CREATE", 'test2.%s' % ROUTE53_ZONE_NAME, "CNAME", 60)
change.add_value("some_other_name")
changes.commit()

Does that help with your attribute question?

http://agiletesting.blogspot.com/2011/06/managing-amazon-route-53-dns-with-boto.html
0
 

Author Comment

by:lionel3030
ID: 36714805
I meant to give attribute to set TTL in dns directly, i need to search a bit on your last message, I will update soon.
thanks for your help
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714842
0
 
LVL 21

Accepted Solution

by:
Papertrip earned 500 total points
ID: 36714843
Attribute Parameters:

    zone - DNS zone
    name - fully qualified domain name of entry in zone
    type - DNS record type (CNAME, A, etc)
    values - Record values.
    default_ttl - default time to live in seconds
    access_key - dyn username
    secret_key - dyn password

None of the parameters have default values.

Example:

route53_rr "webprod" do
  name       "webprod.#{node.route53.zone}"
  type "A"   values([ "10.1.1.10"])
  ttl        node[:route53][:default_ttl]
  access_key node[:route53][:access_key]
  secret_key node[:route53][:secret_key]
  zone       node[:route53][:zone]
end
0
 

Author Comment

by:lionel3030
ID: 36714880
thanks for all your help i will try to set theses lines into one if possible i will let you know the result.
0
 
LVL 21

Expert Comment

by:Papertrip
ID: 36714886
Awesome good luck!  I think that last link might be exactly what you need.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VMware 6.0 3 71
android secure ftp 3 38
SPF record issue 6 34
DNS Server Service Missing on Domain Controller Server 2012 R2 19 32
Resolve DNS query failed errors for Exchange
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question