Configure dns server - apache

I have several questions about dns. I have apache server on my computer and static ip and i bought domain. So when i enter in my browser blablabla.com , it redirects me to my site. Its ok. But i want to setup my own dns server on the same computer where i have my site. I set up bind9. Here are some questions:
Should i buy two domain's, so there will be my dns server and is it necessarily that ns will look like ns1.blablabla.com or its ok if it is blublublu.com ?
When i buy domain for my dns server, should i add record (on the site where i bought it) # A "mi ip where my site is ?
When i do this, i must enter ns(blublublu.com or ns1.blablabla.com) in site where i bought domain blablabla.com (my site) ? It will work because
dns use 53 port, and apache use 80 port ?
Did i correctly write db.blablabla.com int /etc/bind ?
$TTL 604800
# IN SOA blablabla.com. root.blablabla.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
IN A 192.168.100.13
;
# IN NS blublublu.com. (ns.blablabla.com) ??
# IN A 192.168.100.13 ??? or there must be my static ip addresse ??
# IN AAAA ::1
ns IN A 192.168.100.13

You can use any domain. It really does not matter. The point of having a ns1.domain.com and a ns2.domain.com is the intention that ns1.domain.com is on one computer and ns2.domain.com is on another computer. That way if the computer on ns1.domain.com fails for some reason, traffic get redirected to ns2.domain.com and there was no down time for your websites. The actual domain you use can be anything as long as you own it. You also do not need to have two seperate computers, you can just point both ns1.domain.com and ns2.domain.com to the same ip, the ip of your bind server.
Where you buy your domain, you have to tell the person you bought it from that the domain is for a name-server. This is different then entering in an A record. The url, ns1.domain.com has to be entered into the authoritative name servers. Just do a search asking for setting up nameserver on your domain .100.14 //subdomain of ns2.blublublu.com, if is the same computer (not ideal) then it would be the same ip
I hope this helps the next person

Related

Cloudflare - How to hide website's server IP address from the beginning itself?

There's a website example.com served at 1.2.3.4
Currently you need to point your registrar's DNS to 1.2.3.4
Then you need to add your site to cloudflare .
And then you need to change the DNS records at registrar to point to Cloudflare DNS.New cloudflare IP returned during DNS query is 5.6.7.8 But if an attacker(or a user) accessed the website when it didn't have cloudflare protection, they can still have the old ip 1.2.3.4 and attack it.
How to hide the origin server IP from the beginning itself (before the site is launched?) so that 1.2.3.4 is hidden from the moment site comes online?
block the port for non-cloudflare IP ranges
Buy the domain, don't add any record to it yet, set the nameserver to Cloudflare, and only then add the orange record, which point to an actual IP

How to redirect the DNS for your domain's A record to the CNAME record

I understand that an A record should point to an IP address and a CNAME must point to another domain, e.g.
A foo.com 100.0.0.1
CNAME www.foo.com foo.com
That way if a person tries to go to foo.com or www.foo.com both requests will go to the same server. And then our server can redirect foo.com to www.foo.com for standardization (particularly when SSL certificates are involved).
But is it possible for a DNS records to not have an A record, and instead to manage the simple domain with a CNAME record that points to another dynamic domain (instead of a fixed IP)? e.g.
CNAME # foo.gutensite.net
CNAME www.foo.com foo.gutensite.net
Both foo.com and www.foo.com would point to foo.gutensite.net.
The Goal
We run a web hosting company, and we want to tell clients to point their domain DNS to a dynamic location (not a fixed IP address). We don't want to make them point to a specific IP address, because sometimes we need to change the server IP addresses as we adjust the infrastructure, e.g. spin up new servers, change hosting platforms, etc (FYI, We use Load Balancers, but sometimes we need to change the IP addresses as we put the client on a different cluster). However, that means making hundreds of clients update their DNS settings, something that is a nightmare for non-technical clients.
So if instead, we could just have them point their DNS to a dynamic location via a CNAME record to begin with, then we can change the DNS settings for them when we need to, e.g.
CNAME www.foo.com foo.gutensite.net
And we control foo.gutensite.net (our subdomain) to point to whatever server node they are hosted on (if we ever have to change it).
A Hacky Solution
Since DNS doesn't appear to allow DNS records without an A record that is pointed to an IP address, we are considering a hacky solution. We could spin up a simple server that has a static IP address that never changes (it can be hosted anywhere). This servers sole job is to redirect any all traffic to the subdomain www.{DOMAIN}. We then tell clients to point their A record to this IP address, and anytime a visitor requests foo.com it will redirect to www.foo.com and at that point the correct CNAME record will take over.
I don't like this solution, because it's circumventing the purpose of the A record by throwing up a decoy that redirects to the www version. But it would work, and I can't think of any real downsides.
Any thoughts?

DNS entry for third level domain

I am trying to create a third-level domain virtual host on my server. I hope the configs are set up correctly, but I am getting a ERR_NAME_NOT_RESOLVED error.
I have read that I have to "add DNS entry" somewhere so that the name would get resolved, but how do I do that? Where do I do that? The server is running on Ubuntu .
I suppose you get that ERR_NAME_NOT_RESOLVED error from Chrome. This means that Chrome is unable to find the subdomain in DNS.
You are correct, registering your subdomain in DNS will require DNS changes. Specifically, you have to add a DNS A resource record for your subdomain to become "visible" to browsers over IPv4. For IPv6, add an AAAA, too. Both record types point to an IP address and it will be the IP address of your web server. (Technically, you can also use a CNAME type record, but make sure to read up on how that works.)
Subdomain DNS will be served by the authoritative DNS servers for your domain, so you can register the required record(s) through your DNS service provider. If you are not sure who they are, look up the NS records for your domain, this will give you the list of authoritative name servers for your domain and you can work from there.
I understand you have already configured your Apache to work with the subdomain, so setting up DNS completes the setup process.

How to use a domain for two IP's

I have a minecraft server and I want to make it so example.com points to two IP addresses. I want to know how to make it. So, apache, godaddy, or whatever detects a browser and sends it to the website version and when a client is being detected it sends it to the minecraft server.
For example:
I type example.com in my browser and it takes me to the website.
I type example.com in my minecraft server list and hit enter and it shows my minecraft server.
Thank you.
They do this by adding specific entries to your DNS record. By setting an SRV record you can forward all requests on a specified port to a separate target which may be another domain, a sub-domain, separate directory, or another IP address.
Example SRV record:
_http._tcp.example.com. IN SRV 0 5 80 www.example.com.
_minecraft._tcp.example.com IN SRV 0 5 25565 play.example.com.
In the above example you could also replace the domains used at the end of either record with a separate IP address and it would also work.
Of course your exact method of adding these records depends on who is the host that is controlling your DNS records and what method of edit they offer to you.
You can't use a domain for two IP addresses. However, It is possible to have a web server on the same network. That way the domain name should work with the web server and your minecraft server.

DNS and apache relation

when I hit the URL say wget yahoo.com. What all steps take place from the time I hit ENTER till I get the webpage. This is with Solaris machine having Apache webserver and DNS configured . I want to know how does the DNS and apache interact to display the webpage.
Slightly simplified, but the entire dns workings aren't that interesting to you I think ;)
wget requests the ip address for yahoo.com from your local dns server (or isp dns server)
your local dns servers returns the ip address from cache if available and if not it requests the record from the yahoo.com dns servers
wget connects to the ip address and passes yahoo.com as host so the server at yahoo.com knows what domain it needs to return
wget makes an OS call for say news.yahoo.com
the local resolver, based on the config (/etc/nsswitch.conf) looks at /etc/hosts, then makes a request to the DNS server configured in /etc/resolv.conf
that server, if properly configured will talk to the on of the Internet root server to find out who is responsible (in terms of DNS) for yahoo.com
your DNS server will then talk directly to the DNS server responsible for yahoo.com, to get the address for news.yahoo.com, and return the ip address
wget will make an http connection to that ip address
when the yahoo web server running at that ip address (what you call apache) receives the request, it checks what url you asked for, the url is inside the http request.
based on the url you asked for, it will send you a different page (typically, one server running at one ip address, serves more than one url, even more than one domain sometimes).
Note that some browsers will make a search request if the URL you enter isn't a proper URL. So if you type "stackoverflow" in the address bar in firefox, firefox goes to google, make search, and direct you to the first link in that search. I believe the microsoft browser does the same, but does it search on bing.