IP Addresses for Domains and their Subdomains the same? - ip

I would like to know. When a domain example.com has an IP address: 41.72.111.222, would any of its subdomains (sub.example.com, mail.example.com etc) have the same IP address listed in the DNS records? Or does it work like this: A request is sent from the browser to the DNS server for sub.example.com. The DNS server returns the IP address for example.com, and the split/differentiation is made when the request for sub.example.com hits the example.com host server? So the host server basically know what to do with sub.example.com and not the DNS server?

It can kind of be a combination of both. Ultimately, though, the decisions are made based on what you set your DNS settings to be. Your host (or hosts) will then get whatever traffic you determined they should get in your DNS settings.
So for example...
You can set your DNS settings to take [anything].example.com and always direct that to your server. You would do this by adding a wildcard entry to your DNS subdomains. Wildcard entries use a * symbol to mean "anything". You would then need to configure your server to know what to do with all these different potential subdomains it could be receiving.
At the same time, you can set specific subdomains to go to other hosts. For example, if you wanted mail.example.com to go to some other webmail host, you would set up in your DNS the subdomain "mail" and have that traffic redirected to wherever you were hosting your webmail.

Related

How to manage default subdomain for a given IP address. WHM CP

My client's security team noticed that their website's IP address resolves to the DEV domain and not the LIVE domain.
I other words -
https://99.999.999.999 (if you put it in the browser) resolves to https://dev.example.com instead of https://example.com
Is there a way to specify the default domain/subdomain that the IP address resolves to using WHM CP? They'd like it to resolve to https://example.com
Both websites would still use the same IP.

DNS Server IP Address

I have a basic question about DNS infrastructure.
I'm wondering how the IP addresses of upstream DNS servers are configured within DNS servers. For example, when my router needs to satisfy a DNS query on behalf of a machine on my LAN, it asks its upstream DNS server that it was given through DHCP. However, how does the upstream DNS server know how to reach the root DNS server or some authoritative DNS server if it doesn't have that information cached? Is the root DNS server's IP address hardcoded anywhere to achieve this? Are backbone DNS servers always configured with some DNS server upstream from it?
I recall setting up a Microsoft DNS server in which any requests that couldn't be satisfied by it would be forwarded. However, since an upstream DNS server wasn't configured, it forwarded those requests right to the root. This behavior makes sense, however, how did it know where to contact the root?
Your reasoning is correct.
Q: How does the upstream DNS server know how to reach the root DNS server or some authoritative DNS server if it doesn't have that information cached? Is the root DNS server's IP address hardcoded anywhere to achieve this?
A: Small scale DNS server (for example DNS server serving clients in one organization) will sometimes have (manually) configured forwarders (usually ISP nameservers) in order to benefit from big cache of ISPs nameservers and faster queries. From my experience, with faster internet links (and with less latency) in recent years, this setup is used less often. Instead, root hints are used.
Q: Is the root DNS server's IP address hardcoded anywhere to achieve this?
A: Yes. For Microsoft DNS server it is located in systemroot\System32\dns\cache.dns, for BIND it is usually in /etc/bind/db.root or /var/named/named.root. An updated copy (if needed) can be retrieved from https://www.internic.net/domain/db.cache
Q: Are backbone DNS servers always configured with some DNS server upstream from it?
A: As far as I know, never.
A recursive server has the (or at least a) list of root servers provided out-of-band. This is often called "root hints" or something similar. Once it knows how to talk to the root servers, everything else follows from that. In practice, a recursor will quite quickly come to cache the name server addresses for the more common TLDs (like .COM and .ORG), so it doesn't always have to start at the root. But the root server addresses are manually provided to start things off.

Which name is passed to Nginx when using CNAME

I have a Nginx server on my own server. I have a DDNS from asuscomm.com e.g. mydomain.asuscomm.com. Now I want to be able to handle to different sites using CNAME and Nginx.
www.domain1.com and www.domain2.com. In my DNS I want both to point to mydomain.asuscomm.com, and then depending on if it is www.domain1.com or www.domain2.com I want to show different sites.
Is it possible to do with CNAME and Nginx, or do I have to have an A pointer for this?
Thanks in advance.
CNAME is pointer to domain, and A is pointer to IP, you need to define A for IP (Nginx port 80).
You can try subdomain for nginx

Is it ok to host multiple sites on a server with one IP address?

I wonder if is it ok to host multiple sites on a server with one IP address?
I bought server on hetzner and I want to host 10 different websites of my clients. Eg. client1.com, client2.net, client3.org etc. I changed "A record" in all domains on IP address of my server. Is there any reasons to not do that? Or maybe I should buy additional IP address for each site?
Thank You.
Sure it is, your webserver will be able to filter requests to the correct site based on the incoming request's URL.
In Apache this is done by adding a new virtual host to your configuration.

How are nameserver addresses resolved?

So if I try to navigate to google.com and I don't have the ip address cached, my browser will attempt to contact google's nameservers. If the nameserver is ns1.google.com, how exactly is the nameserver's ip address resolved?
Your browser doesn't contact Google's nameservers directly (unless you work there), instead it attempts to contact your organization's DNS servers (as defined by your ISP or network admins) to resolve google.com, and those DNS servers work from there, working their way up the DNS hierarchy to the DNS root servers if necessary.
How do the DNS root servers know the IP addresses for Google's servers? They don't. They look at the ".com" in the domain name, and forward the request to the ".com" TLD servers, currently managed by Verisign. Verisign notes the ".google" part of the domain name, and forwards the request to Google's DNS servers.
How does Verisign know the IP address of Google's DNS servers? Google tells them by registering resource DNS records with them when the IP address changes.
Of course, caching is used up and down all levels of this tree.
See http://www.howstuffworks.com/dns.htm for more info.

Resources