0
votes

I have an EC2 instance (Amazon AMI) on AWS and I have a purchased a domaine name on Gandi.net. Let's imagine my domain name is "teaorcoffee.com".

On Gandi, I have set up a sub-domain name "dev" to delegate DNS to my EC2 instance. Here is the configuration in the zone file on Gandi :

dev 10800 IN NS ec2-22-222-222-22.eu-west-1.compute.amazonaws.com.

I would like to configure sub-domain of "dev.teaorcoffee.com" on my EC2 instance, like "sql.dev.teaorcoffee.com".

I am trying to do that with :

  • the "bind" util
  • the file "named.conf.local" wich is included in the file "named.conf"
  • and a "dev.teaorcoffee.com" zone file

but without success.

Here is the "named.conf.local" file :

zone "dev.teaorcoffee.com" IN { type master; file "/var/named/dev.teaorcoffee.com"; allow-update { none; }; };

Here is the "dev.teaorcoffee.com" zone file :

$TTL 60 @ IN SOA master.dev.teaorcoffee.com. support.teaorcoffee.com. ( 2013030300 60 60 60 38400 ) dev.teaorcoffee.com. IN NS master master.dev.teaorcoffee.com. IN A 127.0.0.1 sql IN CNAME master

I can restart the dns without any error with the command :

sudo /etc/init.d/named restart

But when I am trying to do a nslookup on "dev.teaorcoffee.com" and its sub-domain, I get the following error :

nslookup dev.teaorcoffee.com Server: 127.0.0.1 Address: 127.0.0.1#53

* Can't find dev.teaorcoffee.com: No answer

What can I change to make it work ?

Thanks in advance for any help.

1
What do you expect "nslookup dev.teaorcoffee.com" to find, considering that you haven't declared any "A" records for "dev.teaorcoffee.com"? What if you try "sql.dev.teaorcoffee.com" ... also, use dig instead of nslookup for more informative messages.Michael - sqlbot
Thank you for your remark. I have made so many changes to make it work, that I have forgotten this instruction. So, I have added this line to my zone file : @ IN A 127.0.0.1. Then, I have executed the dig command instead of nslookup. It seems to work without any problem. But, I still can't ping dev.teaorcoffee.com or any sub-domain outside of my EC2 instance.lightmania

1 Answers

1
votes

Once you have created an A record for your subdomain poiting to your EC2 server you are good to go.

If you're going to use Apache just configure the virtual host in your apache httpd.conf http://httpd.apache.org/docs/2.2/vhosts/examples.html

If you are going to use like a mysql server, there is nothing to do.

Just make sure the port of the services you are going to use are opened in your EC2's security group.

And an advice, migrate your domain zone to route 53 - is much easier to admin.

HTH