How dns servers work know the ip address of website? - url

My question is that suppose my website is "xyz.com"
I can access it anywhere in the world, but I'm curious to know how does all the dns servers know the ip address of my website..?
I'm little bit confused..

The main process that resolves an IP Address through DNS is referrals. A DNS Server will go through a process to find the Authorative Nameserver for your domain. The Authorative Nameserver is the server that is configured to answer queries for that domain. i.e. the godaddy DNS Servers, if you have purchased, and configured a domain name through them.
If you go to www.example.com from your PC, it will send a query to your configured DNS server, asking for www.example.com
If your configured DNS Server knows that answer already, i.e. it has been asked the same question recently, it will return the answer from cache (as long as it hasn't expired)
If your configured DNS Server doesn't know, then it will find out. In order to find out what server knows the answer, it needs to look up the name server for example.com first.
So the first query the nameserver makes is to the root domain "." (All DNS Servers should have these configured) to find out the nameservers for the .com domain.
When it has an address for the .com domain's nameservers, it will send a query asking for the nameserver for example.com
when it has the address for example.com's nameservers, it will send the original query, for www.example.com, to that server, and return the answer to you (and put a copy in its cache incase anyone else asks)
Note: If you were looking for www.test.example.com then it would have asked example.com for the nameservers for test.example.com instead.

URL resolution in DNS happens from right to left.
DNS comprises of Root Servers, Top Level Domain(TLD) and Authoritative Servers
For the example www.example.com :
Root Server queries the TLD for '.com' extension
TLD searches the DNS cache for the domain, if not it queries the corresponding authoritative server for the domain 'example.com' to finally get the IP address for the host www.example.com, then return that IP address to your computer.

That's why there are DNS Root Servers.
At the top of the DNS system are DNS root servers. There are
approximately 500 root servers distributed around the planet,
addressed via 13 IP addresses. These root servers are the only ones
that contain the entire list of all domain names and IP addresses. So
eventually, a DNS request might make it all the way to the DNS root
servers if no other DNS server has the answer. If there is still no
answer at the root level, then the DNS request fails, and your browser
returns an error. Source

Related

can't access from outside with nginx reverse proxy in docker

i know there are lots of similar questions about but no one help me.
I have a linux server running nginx reverse proxy in docker, a duckdns domain created,opened my router port 80 and 443. I can't access from outside with my domain name or public ip, it seems like my router refuses external request. I tried with lots of configuration, follow lots of guides on web... I get crazy to solve this problem.
I think problem is before nginx, so i not post my nginx conf. If can help, I will post it.
Hope someone can help me. Thank you so much
There are several things that could be causing the issue with your router refusing external requests. Here are a few things to check:
Make sure that your router's firewall is configured to allow incoming connections on ports 80 and 443. Some routers have a built-in firewall that needs to be configured to allow traffic through specific ports.
Confirm that your router is properly forwarding incoming requests to the correct IP address and port on your network. This is typically done through a feature called port forwarding.
Check your router's security settings to ensure that it is not blocking incoming requests based on the source IP address or domain name. Some routers have the option to block incoming requests from specific IP addresses or domain names.
Confirm that your Linux server is properly configured to handle incoming requests. This includes checking that your Nginx reverse proxy is running and properly configured to forward requests to the correct IP address and port.
Verify that your DNS is pointing to the right IP address, you can use online tools like https://www.whatsmydns.net/ to check this.
Check if your router have any VPN or proxy service enabled, which could be affecting the incoming request.
Check if your ISP is blocking incoming connection to your public IP address.
It's also possible that there might be a problem with your router's firmware or hardware, in that case, you may need to contact the manufacturer for further assistance.

how can i point my bastion host ec2 which don't have any public ip with godaddy domain?

I have a bastion host ec2 ,which don't have any public IP address ,but i have one application load balancer which is integrated with private EC2 ,but when I added CNAME(ALB DNS Record) record with host name WWW in my Godaddy DNS records So my website works only with https://www.example.com ,all other urls like -
https://example.com,
http://example.com do not work.
after that I had use the domain forwarding feature of godaddy but through this feature I can forward only one url like- example.com to www.example.com but I want my all urls should work fine.
Do we resolve this issue by help of A record?
I added CNAME(ALB DNS Record) record with host name WWW in my Godaddy DNS records but my website works only with https://www.example.com .
I had use the domain forwarding feature of godaddy but through this feature I can forward only one url like- example.com to www.example.com .
I would suggest you start using AWS Route53 to manage the DNS records, after that, you can create A record to point to the ALB. You would have to create a hosted zone for example.com, then copy the name servers of it and use update your Godaddy configuration to use AWS name servers. More information can be found here: https://virtualizationreview.com/articles/2020/07/14/migrating-dns-services-aws.aspx

How do I set up bind via webmin to delegate dns lookups for certain subdomains?

I have several docker containers with some web applications running via docker compose. One of the containers is a custom DNS server with Bind and Webmin installed. Webmin gives a nice web UI allowing me to update Bind DNS configuration without directly modifying the files or SSHing into the container. I have docker setup to lookup DNS in this order:
my docker dns server
my companies internal dns server
google dns server
I have one master zone file for top level domain "example.com" defined in dns server 1. I added an address for server1.example.com and dns resolves correctly. I want other subdomains to be resolved from my companies internal dns server.
server1.example.com - resolves correctly
server2.example.com - this host is not referenced in the zone file for docker dns server. I would like to somehow delegate this to my companies dns server (server 2)
The goal is I should be able to do software development for web applications and deploy them on my docker containers. The code makes internal calls to other "example.com" hosts. I want some of those calls to get directed back to other docker containers rather than the real server because I am developing code on both and want to test it end to end.
I don't want to (and can't) modify my companies dns configuration. I am not an expert in bind or dns setup and looking for the simplest solution.
What configuration can achieve this?
I guess the workaround is to use fully qualified name when creating the zone file. Instead of creating a master zone example.com and listing server1 inside that zone I am creating a master zone with server1.example.com. It means I have to create a zone file for every server but I guess its ok to manage with a smaller number of hosts. server2.example.com then doesnt fall inside of a zone and gets resolved using the next dns server in the chain.

URL only resolving with TOR Browser otherwise error ERR_NAME_NOT_RESOLVED

I've the following situation. I made a SPA with React/Redux and deployed it with gh-pages to github. In the package.json the homepage is https://www.url.com. The DNS on the domain provider (Uniregistry) points to my cloudflare instance. On cloudflare I have 4x A-records pointing to the IP for github. And one CNAME with wwwwwhich resolves to iepur1lla.github.io.
When I try to access the URL via Chrome I get ERR_NAME_NOT_RESOLVED, though when I try to access the URL via TOR browser it works perfectly fine, redirect and SSL certificate, everything.
At first I researched on Stackoverflow, what could cause this issue, and I checked the DNS propagation for my country. And it points to Cloudflare, and my github URL points to the IPs which are as A records in cloudflare.
I really could use an advice. Thanks in advance.
The issue is resolved. After investigating with the dig and nslookup commands, I found out that in some cases the default DNS from Uniregistry which has been updated to Cloudflare DNS, was still resolving. I went to uniregistry and purged my DNS servers and put the same cloudflare DNS in and after waiting the TTL time it resolved fine. Yay!

Site being cloned or deploy to domain I don't own

I'm deploying a Rails app to EC2 using Elastic Beanstalk. I just found out, while doing a search in google that whenever I deploy to my domain, my site seems to also get deployed to a domain I don't own. I use Route 53 for my DNS as well.
Has anyone ever run into this situation or have any idea what might be happening here?
It could be a simple DNS issue. Someone's DNS A record is pointing to the ip address of your EC2 instance
Amazon recycles ip addresses. It is possible that your current ip address was allocated to someone else earlier, and they have not deleted their DNS entry when releasing the ip address.
you can run ping command to confirm both domain names resolve to same ip address
ping domain1.com
ping domain2.com

Resources