DNS: How to Dig thru the right domain name from the TLD? - dns

I'd like to query the DNS records until get the right domain name.
For instance, given www.subdomain.site.com.br, be able to dig from .br until site.com.br.
Which is the most (protocol-speaking) way to achieve that? An recipe using dig/nslookup would be best.
Thanks.

dig +trace www.subdomain.site.com.br
will show you exactly what happens.

dig www.mysite.domain.com #a.root-servers.net
you'll get the next level from there. Just replace the portion after the '#' and keep recursing until you query a server that gives an answer rather than additional information

Related

Setup MX records from command line

There should be an easy way to find answer to that question but I actually have struggled a lot and didn't find one.
My domain DNS are pointing to my server where I have Apache Vhost configured but I want my MX record point to other domain. All of the answer I found was to use some sort of GUI manager like Cpanel or DirectAdmin but I have none of them nor I feel like I need one.
But how the heck can I change my MX records. Which files should I modify. Something in my VirtualHost settings? I'm at the complete loss with this one.
Assuming that you run Linux/Unix OS and bind9 nameserver and your nameserver is primary for your domain.
For Linux.
Check files /etc/named.conf /etc/named.conf.local looking for the paragraph like:
zremove one "yourdomain" {
type master;
file "/path/to/some/file";
For BSD OS check file /usr/local/etc/named.conf
Edit the file that contains the description of your zone (/usr/local/etc/named.conf)
You will see the lines that look like
nnnn IN MX mm mail.server.hostname. where n and m are digits.
Replace mail.server.hostname. with name of your mail host(s). Note the trailing. Add/remove records if you have more/less mail servers than currently.
You have also to modify SOA record increasing value of serial field
Restart named.
BTW. You can info about DNS server configuration from man pages: named (8) and named.conf (5)

How to validate top level domain for validity and existence?

There are so many top level domains these days, like .xxx, .club and so on.
How do I check if some domain's top-level domain is correct and exists?
For example, mydomain.xyz. I can cut off mydomain. and check the rule against xyz. Should I get a full list somewhere? I suppose it's not 100% guaranteed as the list can grow over time?
Or may be I should use some remote API for this?
I found this one http://data.iana.org/TLD/tlds-alpha-by-domain.txt and it seems to be the one that I hope is updated regularly. Is it a good enough source?
Please advise.
If you want to check a given string to see if there is a currently existing TLD with that name, you can send an NS query for the name to the root servers and see if they give you a sensible answer. If they do, the TLD exists. If they do not, it does not exist.
If you want a list of all currently existing TLDs, the URL you give in your question is indeed the correct place to get one. As the first line in the file indicates, it does get updated regularly.

The domain and search options in resolv.conf

Let's say you have a resolv.conf file that's something like this.
nameserver 192.168.0.7
nameserver 192.168.0.8
domain somedomain.local
Then let's say you just changed it to this.
nameserver 192.168.0.7
nameserver 192.168.0.8
search somedomain.local
Would these both do the same thing? Is one slightly better than the other?
Why would declaring both a domain and search not be recommended?
The existence of both keywords are probably historically. Only one of them can be specified in the resolv.conf (the parser built into glibc is supposed to use the last one it encounters). The search keyword is slighty more powerful, since it allows multiple entries, and has the ndots option.
man 5 resolv.conf currently reads:
The domain directive is an obsolete name for the search directive that handles one search list entry only.
Stian Skjelstad summarized the benefits of using search over domain nicely.

mailgun configuration slight issue with TXT record

I am attempting to set up mailgun on my server.
i am editing the DNS records through whm.
One record is causing me issues
"v=spf1 include:mailgun.org ~all"
I have set this to a TXT record - but if I don't add quotes around the record it gets changed to v=spf1.
However mailgun is not recognising this record. (it recognises another TXT record in double quotes though - however that one is not set as my domain name but rather k1._domainkey
Is there a way to enter this in WHM without the double quotes - or is it likely to be a problem elsewhere (and how do I check that it is correctly set?)
I am quite new to anything other than setting MX records so if more info is needed just let me know.
Thanks for the help in advance!
Well wouldn't you know I just managed to sort it.
If anyone is having the same issue simply append a full stop (period for our american friends :-D) to the end of your domain name.
so mydomain.com becomes mydomain.com.
I had done this for other records by default as I just copied other entries but had missed it off this record.
Perhaps someone clever can tell me why the full-stop is required?

Can I use another name instead ns1 in ns1.domain.com

Can I use another name instead of ns1 in ns1.webdevelopernepal.net
I mean to say I want dipendra.webdevelopernepal.net instead of ns1.webdevelopernepal.net
and pradhan.webdevelopernepal.net instead of ns2.webdevelopernepal.net
Please help me out I am a newbie..
Short answer, Yes!
Assuming you have access to the DNS settings and can add the appropriate A record or CNAME to point to dipendra.webdevelopernepal.net

Resources