Uploaded by Jack Than

ipconfig

advertisement
1
ipconfig
Now 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 it can also be used for a lot of other troubleshooting issues.
So let’s go ahead and show an example of ipconfig for a computer. So at a command prompt
you just type in ipconfig and then you press 'enter'. So here is the basic network configuration
for this computer.
So here is the IP address. And this is an IPv4 address. And this happens to be a private IP address that’s
been assigned to us by the DHCP server, that’s built into our router or a 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
refers 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. So your default gateway device is what gives you
access to or directs you to another network, such as the internet.
Dual Stack
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 2 IP addresses. It has an IPv4 address and
and IPv6 address. And this is what's called a dual stack. And the reason for a dual stack is for
compatibility purposes. 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
2
and we are running out. And IPv6 was created to remedy this problem. And having 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 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 ipconfig output.
But these days most people will have a router or a modem/router combo that will assign your
computer a private IP address.
IPconfig/all
Now, ipconfig utility can be combined with subcommands, called switches. And switches
will give you more options.
So for example, let’s do the ipconfig command again. And this time we’re going to add a '/all' at the end,
and then we’ll press 'enter'.
And as you can see, this displays more information than just the basics. So doing an ipconfig /all
command
it'll 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 host name, which is the custom name that we gave our computer.
It also shows us the physical address or MAC address of 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, which is built into our router. It also shows 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 of our IP address along
3
with its expiration. And it also shows us the IP address of the DNS server that our computer is using.
Flushing DNS
And ipconfig /flushdns 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 or keep a history of resolved domain names and their IP addresses that
you visited. And it keeps this record for a period of time. And 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 getting
constantly bombarded with DNS lookups.
Now even though caching these web addresses are a good thing, there are some instances where you
should flush your DNS cache. And one reason is, 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 storing
the old IP address, then you won’t be able to access youtube, because the DNS cache on your computer
is outdated.
DNS Spoofing
And flushing your DNS can also help with security concerns, such as DNS spoofing. DNS spoofing is when
hackers and malware can alter your DNS cache and redirect you to fraudulent websites
4
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 can help hide your website search behavior.
Displaydns
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 the 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 And over here 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 here we see the IP address for
youtube.com
And as I said before, if you wanted to empty the cache, just use the flush command again and it will
clear it.
5
And 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 ipconfig. But if you wanted to
see the full list of switches that are available, just type ipconfig /?
Download