0

I am currently working with BIND9 DNS and I am trying to assign webspace to clients on sub-domains without needing to wait for DNS propagation when creating a website on a sub domain.

Example

I have created the A Record *.mydomain.com pointing to IP 192.168.1.1. The server 192.168.1.1 is an NGINX web server.

When adding the sub-domain website site1.mydomain.com the site will be associated with the NGINX server IP 192.168.1.1.

This works fine initially with the site being immediately available; however using the one server will reach capacity within the next few months.

I would like to create additional records (if that the best way to go) for the additional NGINX servers allowing for scalability to add more sites on additional servers:

192.168.1.1 192.168.1.2 192.168.1.3 192.168.1.4

I have tried adding multiple A records as in the following example:

*.mydomain.com 192.168.1.1
*.mydomain.com 192.168.1.2
*.mydomain.com 192.168.1.3
*.mydomain.com 192.168.1.4

The problem with this DNS configuration is that it acts like a round-robin load balancer. For example, the website site2.mydomain.com which is running on 192.168.1.2 will not always resolve to that server. It could resolve to any of the 4 servers.

I am using ISPConfig; however I expect it will be a similar situation with Cpanel and Plesk etc.

When I add the site under the sub-domain I am selecting the respective NGINX server on which the site files are created, but DNS is essentially not playing ball.

Does anyone know how to fix a server IP to a specific site as in the sub-domain situation above?

Thank you

AustJamesL
  • 69
  • 3
  • Maybe I did not understand what are you asking, but why don't you just add the exact A record: `site555.mydomain.com A 192.168.1.155`? – Dusan Bajic May 30 '16 at 14:31
  • The reason is due to the time it will take for the DNS to propagate - up to 48 hours. I would like to have the sites available immediately. The site is created immediately when only having 1 IP address under *.mydomain.com, but its not scalable to other servers/IPs. – AustJamesL May 30 '16 at 14:48
  • Read [this](http://serverfault.com/a/153723/102600) or [this](http://stackoverflow.com/a/33087342/1145196). Then try this experiment: create a new A record, for completely new subomain, that you for sure never before tried to resolve, with an IP address different from your wildcard subdomain. Wait few seconds, try to ping it, and see how does it resolve. – Dusan Bajic May 30 '16 at 20:01
  • If your problem is that it takes 48 hours to propagate your DNS then you are asking the wrong question. Your actual question is 'why does it take 48 hours to propagate my DNS settings) - to which the answer is you need to edit the TTL of your DNS to something more applicable. – Michael B May 31 '16 at 01:26
  • @dusan.bajic - I will give it a go, but quite sure I tried that previously. I will clean outbthe records and give it a proper test. – AustJamesL May 31 '16 at 03:32
  • @Michael B - The objective is to not have to wait for the DNS caching/propogation. The best way to explain this objective would be similar to when someone creates a free WordPress account on *.wordpress.com. The site is immediately abailable for MySite.wordpress.com. In that situation the site is immediately available without having to wait for DNS caching/propogation. I assume they are using some DNS majic to make it happen. – AustJamesL May 31 '16 at 03:35
  • They are using some DNS majic, it is called the TTL. if you set the TTL for 48 hours, you will need to wait for up to 48 hours for propagation. If you set TTL at 5 minutes you will need to wait five minutes,. now that's magic ;) – Michael B May 31 '16 at 15:20

0 Answers0