domain nameserver bind ec2 vps geekact

Setting domain in webmin on AWS EC2 is as nearly same as for regular VPS. You have to set Name Server in BIND and then create a Virtual Server using Apache. There is a little difference for Amazon instances which will be detailed. So, this guide can also be used for other VPS and servers, minus the steps specific to Amazon Ec2 and VPC. I will not be using Route 53 service in this tutorial. It is traditional Name Server setup guide.

Before starting, I am assuming that you aready have following requirements in place;

* Elastic IP (EIP) assigned to your EC2/VPC instance. If not you can do it as shown in this article.
* Registered Name Server for your domain (e.g. ns1.yourdomain.com, etc) at your registrar and pointed domain to it. If not, please refer help files / knowledgebase at your registrar site to know how can you do it from your account. Use above created EIP for IP. Don’t just create NS but also point them.
* Webmin installed on your AWS EC2/VPC instance or VPS. If not please refer this guide to do so.
* Apache, MySQL and PHP installed. Only Apache is mandatory but this is the basic setup for PHP and WordPress sites. Read this to get it done.

Let’s start!

Setting Name Servers:

1. Login to your Webmin panel with root and your password. If you don’t know your Webmin root password, you can reset it as shown here (very small guide). Use EIP with port number for Webmin login screen like this;

http://ElasticIP:10000

NOTE: If you installed Amazon Generic Linux image instead of CentOS or other OS then you may need to use ‘https’ and then proceed to get to the login.

2. After login, on ‘Sidebar’ under ‘Server’ you will find BIND DNS Server. Click it.
3. On Next screen at top, it must say ‘Apply Config’ and ‘Stop BIND’. This means BIND is running.
4. There is an option called ‘Create Master Server’ at bottom in ‘Existing DNS Zones’ panel. Click ‘Create Master Server’.
5. Next screen helps you create Master DNS Zone/Server for your domain. Fill in the information as told below and refer the screenshot if you want;

* Domain Name/Network: yourdomain.com (No www or http)
* Master Server: Here use your first Name Server. It can be dns1.yourdomain.com or ns1.yourdomain.com; depending on what you registered at your registrar.
* Uncheck the option next to ‘Master Server’. I prefer to create all NS manually and it works.
* Put your email address in next one.
* Next one is important. Put your IP address that is Elastic IP if you are using AWS EC2 or VPC.
* Hit Create.

domain nameserver bind ec2 vps geekact

6. You will be brought to a new screen which will have number of options.
7. Click on ‘Address’ option which will take you to next screen.
8. In the first box ‘Name’, put your domain name but with a DOT at end. This is done for Absolute names to avoid errors. Refer the screenshot.

dns bind ec2 vps geekact

9. Hit Create.
10. Do this for 3 more records using same IP or EIP viz;
– www.yourdomain.com.
– ns1.yourdomain.com.
– ns2.yourdomain.com.

Here last two records are for domain’s NS. Use your registered Name Servers in last two. Don’t forget DOT at end in any of it.
10.  Click ‘Return to Records Types’ present as last option after four records.
11. Now, select ‘Name Server’. Here you have to create two records.
12. In first box ‘Zone Name’, enter your domain name with a DOT at end in this format – ‘yourdomain.com.’ and in next enter your first Name Server registered at domain registrar like this ‘ns1.yourdomain.com.’. Don’t forget the DOT at end.
13. Hit create. Create one more record for ns2  / dns2 or whatever your NS is.
14. Click ‘Return to Zones List’ this time.
15. You will need to change some settings to avoid any errors or security issues. Click on ‘Edit Config File’. Don’t get scared.
16. Find this line “listen-on port 53” and delete it. Put following line there;

listen-on port 53 { any; };

The localhost is replaced by ‘any’.

17. There is one more line called “allow query”. Change the bracket setting to ‘any’;

allow-query     { any; };

18. Change ‘Recursion’ to ‘No’; if Yes is currently present.

19. Hit Save.
20. Now you are done. Hit Apply Configuration present in top-corner of screen and there shall be no warnings.

If you are using regular VPS then you are done with Webmin and Name Server and you can move to Apache Virtual webserver setup.

If you are working on Amazon EC2 or VPC, then there is little more work for you. You need to open DNS port in your Instance.

Opening DNS port on AWS EC2 and other instances:

1. Login to your Amazon Ec2 or VPC panel. There is an option called ‘Security Groups’. You need to select the one which you are using for your running instance.
2. Click on ‘Inbound’ tab. Under create new rule, select ‘Custom UDP Rule’ and enter Port range as ’53’ and hit ‘Add Rule’.
3. Port 53 (DNS) will be added to your Security Group. Scroll down and ‘Apply Changes’. It will be applied instantly.

Your DNS will now be able to resolve as inbound traffic will not be blocked by your security firewall. Now, you can move to next step to setup a virtual webserver for your domain.

Comments welcome!

By Mrinal Buddekar

Data Manager and a technology enthusiast! Mrinal Buddekar is Pune based blogger who loves building server, websites, technology, and affiliate blogging.

Hey there!

Help us reach out to awesome people lie you out there. We publish Tech and WordPress, Deals, and Reviews. WE DON'T SPAM!

Your Information will never be shared with any third party