DNS - Associate Multiple Sub Domains on Multiple Dedicated IPs - dns

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

Related

how to have subdomains point to different ports for different services with the same ip

I self-host a lot of my services, I have gitea and a website running on the same IP address.
for the longest time, I've just been adding my port at the end of the URL and it's been pretty decent for the most part, but I want to have git running on its own subdomain.
I've tried using namecheap dns and cloudflare dns and I make the SRV file and the A record but it still points back to the original website

Can home internal DNS domain name same as external domain purchased on Godaddy and Namecheap?

I was wondering if someone can answer this question. I have already searched everywhere and couldn't find the answer anywhere, some of you might have already implemented this solution.
Here is what I have on my home network:
Software used: bind9 on Ubuntu 18.04
Home/Cloud DNS Server: xyz.com ( in a master / slave configuration : 2 servers using internal IP addresses 192.168.1.10 (master) , 192.168.1.11 (slave) )
On my namecheap account: I purchased a domain (xyz.com) , added A+ Dynamic DNS record pointing to my IP address provided by ISP, it is also updated using ddclient. I also have several subdomain under xyz.com such as : a11.xyz.com , a12.xyz.com, a13.xyz.com and so on.
On my primary DNS server at home:
└─<>──» nslookup xyz.com 0 < 10:25:03
Server: 192.168.1.10
Address: 192.168.1.10#53
Name: xyz.com
Address: 192.168.1.10
But, if you look for a11.xyz.com - I want this to search locally first and then look externally for the DNS records on public DNS servers such as Google, Namecheap and others.
Server: 192.168.1.10
Address: 192.168.1.10#53
** server can't find a11.xyz.com: NXDOMAIN
Now, question is:
Q1. ) Is it possible to have such a configuration at home wherein home DNS server domain name is same as the one purchased at registrars like Namecheap and Godaddy ?
Q2. ) If internal domains are same as external domain names, can this mix be handled such that it will search locally first and then look outside for any records in the public dns servers.
Q3. ) if nslookup / dig response depends on the client configuration, Can the home DNS servers serve both bogus domains and real domains purchased ?
I haven't seen such a documentation on digital ocean or any other cloud providers.
Thanks again for the help.
I solved the problem by isolating internal domains from external domains. In the example above, if I have a domain on namecheap/godaddy as : xyz.com then same domain name CANNOT be used internally for home network since there will conflict in resolution so,
I created a domain specifically for internal device lookups : homelan.com and all devices inside the home network will have default domain homelan.com. This way, all subdomains of xyz.com can also resolve using forwarders as well as internal devices using homelan.com.
I was under the impression that if both external and internal domains are same, then bind will automatically resolve to external domains if it cannot find a record internally.

How to map domain to hosting server

My client have a dedicated server on liquedweb cloud service and we my web app is hosted on that server. We want our users to map their domain to our server. So they can enjoy our web app by using their domain name. What information I need to provide to my user so he can map domain and what information I need from them?
I don't know much(in fact anything) about domain mapping
thanks
It depends if the server has a dedicated IP address or is natted.
If the server has a dedicated IP address you can ask your clients to point their entire domain to you server by adding the following A records:
Host TTL Protocol Type IP Address
# 300 IN A 1.1.1.1
www 300 IN A 1.1.1.1
Not all domain hosts ask for TTL,if not dont worry about it.
If you want just their subdomain to point to your server (subdomain.website.com)
subdomain IN A 0.0.0.1
TTL is optional in some systems, in this case the default will be used.
Generally it is recommended that you use an IP for the Apex record and not a domain name. EG: example.com is the apex, www.example.com is the www subdomain.
A typical configuration would be below:
Host TTL Protocol Type Result
# 300 IN A 1.1.1.1
www 300 IN CNAME example.com
This is the same config as the top example but using CNAME example.com. It is the same as using A 1.1.1.1, it just means you only need to change one record.
If your server details are a hostname and not an IP address, most systems will not let you use the hostname for the apex so you will need to find out the IP address. (A simple method is to use the nslookup command or dig command).
TTL is how long in seconds a record last before it expires. If you are unsure what you are doing I recommend lowering this so you can correct mistakes more quickly.
Different methods for the different servers. For most of the servers, you have to change the nameservers of your domain.
This mostly needs when your domain registrar and hosting provider both are different.
First Login into your hosting account, navigate to the account details,
then copy the nameservers from there...which would be like :- dns1.hostingprovider.com
dns2.hostingprovider.com
After that, Go to control panel of your domain. Navigate to the nameservers
You will see the link:- dns1.domainregistrar.com
dns2.domainregistrar.com
Paste the above links at the place of below links.
They need the IP address (and possibly instructions on how to configure their DNS servers (which means a variety of different sets of instructions for different servers and control panels)).
You need the domain name.

Is DNS server And Host file Are different?

I am unsure Whether both DNS server and Host file are the same or different.
I Hosted an application in IIS and created A host name as website1.domain.com and tried to browse it and it didn't work.
When searching on net i found that we need to make entry in DNS server or Host file.
As in most of the sites that I saw mentioned DNS server or host file. I am unsure Whether the both are same or they both are different.
A hosts file is used by Operating Systems to manually specify the IP addresses for specific domains/subdomains - think of it as an override.
DNS however is a server - think of it as a registry - that keeps track of records pertaining to domains, such as A records, MX records etc.
For the purposes of a local test site, an entry in your hosts file would be sufficient, however for a live site, a DNS entry relating to the domain you wish to have your site hosted on would be required.
Choosing which to use comes down to a few things. Does the server upon which your hosting the site use its own DNS server, i.e. a DNS server on the same network, which the connections to the server will be using as well? Does the domain name the site uses have its nameserver set to one that is externally available (i.e. 123-reg.co.uk). If either of these cases are true, you could probably use a DNS server.
If not, is the server hosting the site running on the same machine as the client that will be viewing the site? If so, you can probably use a hosts file, pointing your domains to the localhost IP of 127.0.0.1, ensuring the domains match the bindings in IIS.
Dns server is a server that will help to resolve dns names. ie when you type google.com in your browser , the name will be passed to the dns server provided by your isp. then it will be resolved to ip address by the dns server and your request will be routed to the google ip address by isp network. host file is different one. if you add www.mydomian.com entry in your host file and map it to an ip address 192.168.0.1 then your computer will check ion your host file when you type www.mydomain.com, whether there is any entry for mydomain.com in your host file, and if exists it will be routed to that ip address. in case if there is dns server and you set that server ip in your hnetwork configuration in your pc, then all the domain name request will be sent to that dns server(if there is no host entry exists)

Sub-domain hosting on a different server

I have a domain with wildcard - *.mysite.com hosted on Server1
I am planning to host a sub-domain - sales.mysite.com on Server2.
Is this achievable? If yes I have a couple of questions on this.
How does DNS know to which server to point when sales.mysite.com is requested?
Does all traffic come to the Server1 and then redirected to Server2 if the destination calls for sales.mysite.com?
this is very easy to achieve. you need to configure your dns server that subdomain.mydomain.com points to server 1 and subdomain2.mydomain.com points to server 2. the traffic won't be routed via server 1. it will directly go to server 2. thats how DNS works. In the DNS server for each domain an ip address is stored. you just need to specify your 2 ip addresses the correct way for the subdomains and it should work. more infos you can get from wikipedia http://en.wikipedia.org/wiki/Domain_Name_System

Resources