Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Update: it's working by now. Turns out I was missing a valid DNS forwarder inside the named.conf.options file.

I'm trying to get internal DNS up and running on a EC2 instance. The main goal is to be able to define CNAME aliases for other AWS services. For example: Instead of using the RDS endpoint, which might change over time, an alias mysql.company.int can be used instead.

I'm using bind9 and here's my config files:

/etc/bind/named.conf.local

zone "company.int" {
    type master;
    file "/etc/bind/db.company.int";
};

/etc/bind/db.company.int

;
$TTL    3600
@       IN      SOA     company.int. company.localhost. (
                   20120617         ; Serial
                     604800         ; Refresh
                      86400         ; Retry
                    2419200         ; Expire
                     604800 )       ; Negative Cache TTL
;
@ IN  NS  company.int.
@ IN  A 127.0.0.1
@ IN  AAAA  ::1

; CNAME
mysql IN CNAME xxxx.eu-west-1.rds.amazonaws.com.

The dig command ensures me my alias is working as excepted:

$ dig mysql.company.int
...
;; ANSWER SECTION:
mysql.company.int.  3600    IN  CNAME   xxxx.eu-west-1.rds.amazonaws.com.
xxxx.eu-west-1.rds.amazonaws.com. 60 IN CNAME ec2-yyy-yy-yy-yyy.eu-west-1.compute.amazonaws.com.
ec2-yyy-yy-yy-yyy.eu-west-1.compute.amazonaws.com. 589575 IN A zzz.zz.zz.zzz
...

As far as I can understand a reverse zone isn't needed for a simple CNAME alias. However when I try to connect to MySQL using my newly created alias the operation is giving me a timeout.

$ mysql -uuser -ppassword -hmysql.company.int
ERROR 2003 (HY000): Can't connect to MySQL server on 'mysql.company.int' (110)

Any ideas? Thanks in advantage!

share|improve this question
    
What is the output of getent hosts mysql.company.int and telnet mysql.company.int mysql? –  mgorven Jun 18 '12 at 0:50
add comment

1 Answer 1

Is xxxx.eu-west-1.rds.amazonaws.com resolved to the IP address of the RDS endpoint on the computer you run the 'mysql' command on? We have a similar setup, but in our case 'dig' lists the actual IP address of the RDS endpoint in the answer section, i.e.:

$ dig mysql.company.int
...
;; ANSWER SECTION:
mysql.company.int.  3600    IN  CNAME   xxxx.eu-west-1.rds.amazonaws.com.
xxxx.eu-west-1.rds.amazonaws.com. 60 IN A xxx.xxx.xxx.xxx
...
share|improve this answer
    
Yes, sorry I didn't include the whole dig response. See the updated post above. –  mptre Jun 17 '12 at 13:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.