Different name servers for different subdomains - dns

Let's say I have a website example.com which I bought via a common domain registry nomcheap.com.
I want all traffic to a specific subdomain app.example.com to go to name server ns1.appserver.com so I can serve a specific user app.
I also want all other traffic (www.example.com, hello.example.com, *.example.com, etc.) to go to a different name server from a different provider ns1.squaresites.com so I can serve a general website (think something like a commerce Wordpress site).
None of the name servers are provided by the original domain registry nomcheap.com.
Is this possible? If so, any suggestions on how?

To point a subdomain to a name servers you need to create an NS record for the subdomain:
app.example.com NS ns1.appserver.com
This will make all queries go to ns1.appserver.com
*.example.com NS ns1.squaresites.com
The second record should catch all subdomains that don't have their own records (of any kind).

Delegating name server DNS responses can be done was the answer by #Lanexbg describes.
Realize that chaining your DNS lookups this way adds more time to DNS resolution and adds another potential point of failure in the resolution process. If the parent's name servers are down, they won't able to deliver the NS records to tell the client's resolver to continue the lookup process through a delegated name server.
Consider if using DNS "A" or "CNAME" records at the parent's DNS server would be acceptable alternative.
For more detail on how DNS resolution is delegated see this answer on serverfault.com:
How exactly should I set up DNS to delegate authority for subdomains?

Related

How to setup a subdomain DNS proxy?

Hello I will get a access to a subdomain division.company.com and I will have to name where to point it in contract. I don't want request for contract update because where subdomain has point to every time I need to switch a server.
I am looking to have a top level DNS like control for a subdomain.
a) Do I use some kind of routing/proxy server?
b) Is there a way to have a dynamic DNS assignation (single time minimal configuration on the top level domain side)?
c) Is what I am looking for possible with DDNS providers like https://www.dynu.com/ ?
I tried using dynamic with a test domain but it did not seam to function properly.
On test domain I added CNAME DNS record b.a.com pointing to b.dynamicdns.com and then on dynamic DNS'es DNS records I pointed a CNAME record of www.b.dynamicdns.com to a website's server then on website server side I tried www.b.a.com but it did not seam to work.
Top level domains has to add NS (name server) records for the subdomain pointing to a DNS management provider
https://www.dynu.com/ has and add own domain where subdomain can be entered and configured but other providers should work too.
NS b.a.com NS1.provider.com
NS b.a.com NS2.provider.com
That will delegate subdomains DNS record management to it and will allow for full control of it. Including adding CNAME records pointing to any server.

Locally working with CNAMEs in multi-tenant apps

I have a multi-tenant app where the user gets a subdomain youraccount.myapp.com that works fine. I have some customers who want to be able to have their own domain that redirects to the subdomain. So something like foobar.com --> youraccount.myapp.com. I'm pretty sure I've got the logic down in my app, but I have no idea how to test this on the DNS CNAME side of things. I don't want to launch this feature without seeing it work locally.
I feel like adding a host entry isn't going to test the logic, but maybe I'm wrong? Anyone know how to test this?
You cannot have any other records together with a CNAME.
Since a "domain name", i.e. a "zone cut" where the parent zone contains NS records pointing to the delegated domain, must have an SOA record (and probably its own copies of the NS records, plus any other relevant and necessary records), it cannot also have a CNAME.
So the only way for the customer's own domain to point to the app subdomain would be for their domain name to also have an A record that points to the same address as the youraccount.myapp.com record points to.
The best they can do is to have their own subdomain that points to your subdomain, e.g. (using your example names):
app.foobar.com. IN CNAME youraccount.myapp.com.

Connect Domain to Host

I think I have just successfully connected my domain to my web host and have done so by following an article. There seems to be 2 different ways of doing so and I wonder if there is a difference between the two.
method 1
Go to your domain provider. Create an A record that points to your web host's ip address.
method 2
Go to your domain provider and edit the nameservers according to what your web host indicated. Go back to your web host and add a DNS record indicating the domain.
I have followed method 1 and it works. Is it any different from the second method? In addition, when typing out a record at the domain provider, what does #, www, and * mean?
The A record maps a name to one or more IP addresses, when the IP are known and stable.
# * are same as known as domain name (e.g. yourdomain.com) some domain registrar using # instead of entire domain and some uses *. In hosting control panel under DNS records there domainname is mentioned instead of # OR *
If you work with method 1 and changing A record then you will have to change A record to WWW as well to work your domain with www else your domain with www will ended up with no result. You will also have to change all required records such as CNAME (if you have any subdomain), mail (if it is working through hosting provider).
So best practice is to use namererver so you don't need to change every record under Domain Control Panel.

How to configure DNS for a delegated domain?

I am working with a company, developing and managing a web site for them.
I have control over the web servers, but the company is managing DNS for the domain.
Due to their security policy, the web servers are prohibited from issuing outbound email - they won't add the appropriate SPF/DKIM records to DNS to permit this. Instead, I've been told that they will "delegate" the authority of the domain to me by forwarding traffic to nameservers (of my choice), where I am responsible for creating new DNS records to handle that traffic. In these new DNS records, I would add in the appropriate SPF/DKIM records.
It is like I am managing the DNS, but the company still owns it.
The problem is very strange to me, and I am not familiar with the inner workings of nameservers. Is the relationship of a zone file to a domain name one-to-one? Would I need a second zone file registered somewhere to hold these new DNS records? Do I need direct control over the nameservers, or can I work with nameservers provided by a third-party hosting company?
Sorry for the lack of direction - this is new territory for me in a world that I'm already not that well-versed in.
Thanks in advance
The delegation is a DNS server owning a zone (ie. example.com) and announcing to everyone that a part of this zone (say deleg.example.com) is delegated to another DNS server which can define its own records as long as they are in the deleg.example.com zone.
In your case, it means that you will maintain a subdomain that will hold your NS and SPF/DKIM records. This subdomain behaves in a similar way as the main domain thus you will need a second DNS zone file (and another DNS server).
This is similar to what root servers do with top level domains (they own the com / net / whatever zones) and subdomains sold to companies / people (ie. google.com handles whatever lies in the google.com zone but does not affect the "com" zone).

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.

Resources