How To Lookup DNS Records With The dig Command

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone this is tony sutures tech i'm tony and in this video i'm going to show you how to use the dig command to look up dns records and if you never use the dig command that's okay i'm going to show you how to install it on different operating systems and then do some queries some basic queries as far as looking up you know a records mx records even reverse dns records so if that's something you want to learn how to do let's go ahead and get on into the tutorial here i'm going to be using my macbook and by default dig the the dig command dig is installed on uh mac but if you are you know on an ubuntu server or deviant server you can install it with apt-get installed dns utils and um cento wes it's very similar yum install bind utils okay and then i don't i honestly don't know about windows if if there's a dig functionality on there you'll have to do your own research but if you're on macs or a unix type of operating system like that linux something like that then you should be good to go to follow along on this tutorial okay so um basically the syntax for a dig like when you execute the dig command you usually provide dig and then the name of the server and then the type of name that you want to look up and then the type of record that you want to look up so that's basically the basic syntax and you can look at the manual for dig by typing in mandig and you'll see that same type of information here okay but let's go through some basic use cases here so let's see um just if we do dig and then the name of a website we'll use tony teaches.tech as our example and by default without specifying any of those options or any other command line arguments we will look up a records only so here we can see that it's doing its thing here and it's spitting back out the a records for tony teaches dot tech and i spelled it wrong so there is no a records uh tony teach uh yeah i just need to do that again so tony t e t-e-a-c-h-e-s dot tech and then we'll query that and there we go this looks like more legit a record so basically we have two a records here uh one for this ip address and one for this ipa address now if that's equivalent right here as doing dig tony teaches tech uh a we'll get back the same exact thing now instead of doing an a record we can look up an mx record so dig tony teaches.tech and then mx and that'll show all the mx records so you can tell just by looking at this what type or to a certain extent what kind of email hosting i'm using and i'm using the google's email forwarding email alias for my email hosting so that gives you a little bit of insight there because at the end of the day all this information is public information it's just a matter of knowing how to query it um you can also specify which dns server you're looking at because as you know or maybe you don't know there's multiple dns servers scattered throughout the world and not all at all times not all dns servers have the same exact information you know the information is being propagated from one server to the next uh with the latest information so if you want to specify for example to use google's dns servers you can do that with something like this dig and then the at symbol and then the dns server that you want to use so if you're not familiar google owns the dns server with ip address 8.8.8.8 and then the name of the website that you want to query so again we'll use tonyteaches.tech and that'll because it's the same that'll return um the same information because the dns servers are identical now if we scroll back up here i want to point this out so the server at this point we're using is 8.8.8 that's the server that we're querying but um if we go back up to when we did the dig without specifying the dns server this was querying this server with that with the ip version 6 ip address where where did this come from well if on your if you're on mac and maybe it's similar for ubuntu and linux if we look at our etc resolve dot com file you'll see that these are the name servers that uh are preferred for our system so if you wanted to you can come in here and add in you know google's name server if there's another name server that you prefer then you can add that to this this file um although this says this is automatically generated um there's probably a better way to to do that so don't take my word on that but this i just want to show you that that's where these are the name servers that our local computer is using okay um what if we wanted to see all the dns records for a particular domain name well we can do that we'll do that we'll keep the same syntax we'll query google's dns server dig 8.8.8.8 and then we'll say tony teaches.tech and then instead of saying a specific record we'll just say any any dns record for that domain name we'll hit enter and we get a whole heck of a lot more information here so we can see the same a records we can see i'm not even sure what this is rsig an rc record name server records um these are the name servers that i'm using um soa records those mx records again dns keys um they're huge values like this whole thing pretty much is the value um yeah so that's that's a way a quick way to see all the dns records for a particular domain name um and like i promised we can also do reverse dns so how do we do a reverse dns and if you're not familiar reverse dns is a pointer record ptr and um instead of you know an a record mapping uh a domain name to an ip address a pointer record maps an ip address to a domain name so we already know the domain name for uh my website tony florida or yeah tony teaches tech um so let's use this ip address to see if we could do a reverse dns lookup so let's do dig and to do the reverse dns lookup you do dash x and then the ip address hit enter and you'll see in this case because i'm hosted with wpx hosting wpx.net that's what comes back for the value instead of my actual domain name now let me show you a different example where there's actually a one-to-one relationship between the a record and the pointer record and i had set this up before so i have a website called site6.xyz so we'll just look up the a record for that and you'll see that that's at this ip address now if we do dig dash x and then this ip address i have a point to record set up for that and we should come back with the value of site6.xyz and there you can see the point of record having a uh site6.xyz value as the actual value um this is this last part the last thing that i want to talk about here is kind of related um it's still the dig command but i just want to show you uh that this functionality exists so if we do we can do a trace route with dig so if we do dig tony teaches dot tech and then plus trace and this will go through all the servers that it hits on the way to the final destination so what does that look like well the first thing that it's going to hit is uh the root servers okay so these are the root name servers there's i think 13 of them that kind of keep track of all the dns records and then it goes to the name servers that are specific to my domain name extension so the dot tech domain name servers are next in this sequence and then it goes to google's domain name servers which are i bought my tony teaches.tech domain name uh from google domain so that's next and then finally it shows the a records for my domain name okay so that was a lot of information hopefully made sense hopefully you have a better idea about how to use the dig command to look up dns records if you have any questions let me know in the comments below do my best to help you out uh please give this video a thumbs up if you got some value out of it subscribe to this channel for more videos like this from me in the future and if you do i'll see you in the next one [Music] you
Info
Channel: Tony Teaches Tech
Views: 25,623
Rating: undefined out of 5
Keywords: dns lookup, dns record lookup, dns lookup command, dns lookup tool, linux dns lookup, reverse dns lookup command, dig command, dig command linux, install dig command, debian install dig command, dig command centos dig command line tool, dig command output
Id: iESSCDnC74k
Channel Id: undefined
Length: 9min 14sec (554 seconds)
Published: Fri May 07 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.