Solved

how to set dns to allow the settings of TTL

Posted on 2011-09-27
19
500 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DNS times out 2 25
plsql job on oracle 18 79
Question about DNS 2 32
NFS v4 7 26
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

696 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