IPCONFIG Explained - Flush DNS
Photo credit; IP Location

IPCONFIG Explained - Flush DNS

Hello everyone. The subject of my conversation will border around the IP config utility. This utility is a command-line tool that displays the TCP IP network configuration for the network adapters on a Windows computer. It displays things like your IP address, the subnet mask, and the default gateway. And they can also be used for a lot of other troubleshooting issues. So let's go ahead and show an example of IP config for a computer. At a command prompt, you just type in IPconfig, and then you press enter. So here is the basic network configuration for this computer. 

No alt text provided for this image

So here is the IP address, and this is an IPv4 address. This happens to be a private IP address that's been assigned to us by a DHCP server that's built into our router or modem-router combo that's in our home or office. And then we have the subnet mask, which defines which parts of the IP address refer to the network and which part refers to the host. And then we have our default gateway. Now, the default gateway is the IP address of the router or modem router combo in your home or small office that your computer connects to on your network. Your default gateway device is what gives you access to or directs you to another network such as the internet. Now, if you notice, we also have another IP address assigned to our computer. And this is an IPv6 address. So here we see that our computer has been assigned two IP addresses. It has an IPv4 address and an IPv6 address. And this is what's called a dual-stack. And the reason for a dual-stack is for compatibility purposes. 

No alt text provided for this image

Because right now the internet is in the middle of a migration from IPv4 to IPv6. And this is because there is a limit of public IPv4 addresses, and we are running out. IPv6 was created to remedy this problem. The dual-stack connectivity allows your ISP to process IPv4 and IPv6 data simultaneously. And the reason for this is so you won't have any compatibility issues when accessing websites and servers during the migration.

Now, just to clear things up, this IPv4 address is not a public IP address that we are running low on; this is a private IP address that's used for private networks. It's the external public IP addresses that our ISP has assigned us that we are running low on. In fact, if you go to whatismyipaddress.com, you'll see the IPv6 and the external public IPv4 address that our ISP has assigned to our home or office.

Now if your computer was directly connected to the internet by using a plain modem, which is rare these days, then you would see the external public IPv4 address in the IP config output. But these days, most people will have a router or a modem router combo that will assign your computer a private IP address.

Now IP config can be combined with subcommands called switches and switches will give you more options. So for example, let's do the IP config command again. And this time, we're going to add a forward slash all at the end (ipconfig /all). And then we'll press Enter. 

No alt text provided for this image

And as you can see, this displays more information than just the basics. So doing an ipconfig /all will display the full TCP IP configuration for your network adapters on your computer. So, in addition to showing us our IP address, subnet mask, and default gateway, it also shows us other things such as the hostname, which is the custom name that we gave our computer. It also shows us the physical address or MAC address for our network adapter, which is a unique identifier for every network adapter. It also shows us that DHCP is enabled which means that our IP address is given to us by a DHCP server that is built into our router. It also shows us the IP address of the DHCP server which happens to be the same as our default gateway, which is the router, and here it shows us the date and time of when we obtained the lease for our IP address along with its expiration. And it also shows us the IP address of a DNS server that our computer is using.

No alt text provided for this image

And IP config forward-slash flush DNS is another command. Now, this tool is what flushes or clears the DNS resolver cache on your computer. DNS or Domain Name System is used to resolve domain names to IP addresses. So for example, it's what turns a domain name, such as youtube.com into an IP address. And this has to happen because computers don't understand names, they only understand numbers, which is what an IP address is. So that's why it has to be converted into a number so the computer can understand it and retrieve the web page. 

Now operating systems cache keep a history of resolved domain names and their IP addresses that you visited. And it keeps us record for a period of time. The reason for this cache is to make web browsing faster because when you want to visit a web page, such as youtube.com, your computer doesn't have to constantly go out to an external DNS server to resolve youtube.com to an IP address, it can just look at its internal DNS cache, which is a lot quicker. So instead of taking seconds to retrieve a web page, it would only take milliseconds, and in addition, it frees up the DNS server from constantly getting bombarded with DNS lookups.

Now, even though caching these web addresses is a good thing, there are some instances where you should flush your DNS cache. And one reason is that if you're having a problem accessing certain websites, so for example, if youtube.com has changed their IP address, and if your DNS cache is still storing the old IP address, then you won't be able to access YouTube. Because the DNS cache on your computer is outdated.

And flushing your DNS can also help with security concerns such as DNS spoofing. Now, DNS spoofing is when hackers and malware can alter your DNS cache and redirect you to fraudulent websites. And they can use this tactic to steal sensitive information. So this is why you should flush your DNS if you suspect that your DNS cache has been maliciously altered. And finally, another benefit of flushing your DNS cache is that it will help hide your website search behavior.

No alt text provided for this image

Now, if you wanted to see what is actually stored in your DNS cache, you can use our next command, which is ipconfig/displaydns

And this will display the contents of a DNS resolver cache on your computer. Now normally, this would show a bunch of records. But in this example, I'm only going to show you one DNS record. So this DNS record is from YouTube.com. You can see the time to live or TTL, which is a number that limits the lifespan of this record. So the TTL will count down and when it gets to zero, the record will be erased. And then we see the IP address for YouTube.com.

And as I said before, if you want to empty the cache, just use the flush command again and it will clear it, and then if you display the DNS again, you'll see that the DNS cache is empty. So these are just a few switches that you can use with IP config. But if you wanted to see the full list of available switches, just type ipconfig /?.

I hope you have learnt a little about the ipconfig utility

要查看或添加评论,请登录

社区洞察

其他会员也浏览了