Diagnosing Your Network

April 10, 2011 by . 4 comments

Many of you will have had cause to ask (shortly after screaming and swearing)

My network isn’t working – what can I do to find out why?

Well, at Super User we receive many questions each day very much like that. They are all different, and they are all hard to diagnose when you’re a third party just going by what the user is telling you. So what can you do to make your life easier and get as much information about your network issue as possible to help get it all sorted as quickly as possible?

I am going to introduce you to some of the tools that are at your finger tips for finding out where the fault lies in the network and how to fix it when you find it.

Note: The examples I am giving are all in the Windows operating system. If you are using a different system (say OS X or Linux) there will be equivalent commands and where possible I will give pointers to using these commands as well.

First off let’s design a simple network very much like the one you may have at home. A simple router with WiFi, a couple of laptops, and maybe a desktop thrown into the mix as well.

Now let’s look at a couple of scenarios.

Firstly the ‘I can’t get to the Internet’ problem.

You’re sat there with your laptop and suddenly you find you can’t get on to the Internet. How annoying. But is the problem with your network or with your ISP? Here’s how to check.

First off, you need to check that you are actually connected to the router through the wireless, and that you have an IP address. Most routers will hand out IP addresses to the network devices through a system called DHCP (Dynamic Host Configuration Protocol) so let’s check to see if this has happened.

Most of the commands we are going to use are typed into a Command Prompt window, so go ahead and open one of those now. You can find “Command Prompt” in the start menu, or you can type cmd.exe into the “Run…” or “Search” boxes depending on the version of Windows you are running.

Now the command we are going to use is the ipconfig command. This is similar to the ifconfig command in Linux and OS X.

Go ahead and type ipconfig into the command prompt window and press return. You should get a page or so of text looking something like this:

You may need to scroll back up to find the bits we’re interested in, but the section we are looking for is the section for your network connection. If you’re using an ethernet cable then it will be the “Ethernet adapter Local Area Connection:” section like above. If you’re on WiFi it may be labeled “Wireless Network Connection” or something similar.

What we’re looking at here is the network configuration of your computer. The two bits of information that we are most interested in are:

IPv4 Address

This is the IP address that the router has allocated to your computer. Most routers operate by default in the 192.168.0.1-255 or 192.168.1.1-255 ranges, so expect to see a number starting with 192.168 here.

If this is blank then you know that you don’t have an IP address at the moment, so we need to dig further into why (more in a moment).

There is a special IP address range starting with 169.254 which the computer will sometimes set your IP address to if it fails to get one from the router. This is a reserved range of IP addresses and is supposed to be used as a secondary means of communication with the router if the normal method fails. If you see an IP address beginning with 169.254 here you know you have a problem getting an IP address from the router. It’s just the same as if the IP address was blank.

Default Gateway

This should be set to the IP address of your router. Any network traffic destined for the Internet will be sent to this IP address to get it sent out to the Internet. If this is blank then you have no hope of getting out on to the Internet. This should be set by DHCP along with your IP address.

If either of these are blank or showing as incorrect then the things you need to check are:

  1. The physical connection between you and the router – Has a cable come out somewhere? Are your Wireless settings correct? Are you connected to the correct Wireless Access Point?
  2. The router itself – has it got power? Are all the lights that are expected to be on lit properly? Has it locked up? A quick reboot of the router often solves this problem.

So you have a proper IP address on your network – but can you actually communicate with anything?

Let’s take a look at the ping command.

The ping command sends tiny packets of information to a computer on the network and waits for a response back (kind of like the ‘ping’ you get with SONAR – hence the name).

We know of one host that we should (and need to) be able to communicate with on your network already – the router. You should have the router’s IP address from the Default Gateway in the last section. So let’s go ahead and ping that IP address. In the Command Prompt Window type: ping replacing with the IP address of the router (ping 192.168.0.1 in my case). If all goes well you should see this:

Router ping OKFour nice healthy replies from the router. However, if you see this:

you know you have a serious problem communicating on the network. Try the same checks as in the previous section – check you cables and WiFi connection and settings. Check the router hasn’t crashed and needs rebooting.

So everything checks out OK so far does it? Then let’s look a little further afield.

There are two important parts to getting to anything on the Internet. Not only is there the physical connections between you and where you want to get to, there is also the fact that you have to look up where to go in the first place. This latter is called DNS, or the Domain Name Service. It’s kind of like the phone book for the Internet. If you want to go to www.google.com for example you first have to look up where www.google.com is so you know where to go. This usually happens automatically behind the scenes in your computer, but there is a useful tool to check that it is working as you expect: nslookup

nslookup will take the name of a website, for example, and return the IP address that your computer will have to connect to in order to get to that website. For example, looking up www.google.com should yield the following results:

If that fails, you know you are unable to look up Internet addresses. Again this may be because your router has partially locked up and needs a ‘kick’ in order to get it going again, but more likely it is either your Internet connection or your ISP is having some technical issues.

So let’s check out the Internet connection, shall we? This is where the tool tracert comes in (tracert is the windows equivalent to the Linux and OS X ‘traceroute‘ command).

Tracert will follow the route packets take between your computer and a destination address and report back to you where it all goes wrong. One common address to use for testing is 8.8.8.8 which is the Google DNS servers. It’s pretty much guaranteed to be working, so is a good choice for testing against.

So let’s try a tracert to Google, shall we? Type in tracert -d 8.8.8.8 into the Command Prompt Window. The -d tells tracert not to convert the IP addresses it gets into names – most are meaningless at this stage and it would only slow tracert down. We would expect something like this to appear:

What we are seeing here is each ‘hop’ of the connection between you and the Google name servers. You notice that the first hop is your router? Well, the second hop is the far end of your Internet connection (your ISP). The numbers in columns 2 3 and 4 represent how fast the connection to that host is. If you start seeing larger numbers in those columns then you can instantly see where there is a bottle neck. Any numbers which are replaced with * are hops where a response wasn’t received, and it’s fairly safe to say that this is where the network fault lies. For example – my internet connection is working fine but I can’t get to any sites:

You see how it’s OK for the first few hops – it gets to my router (1), then down my internet connection (2), then it heads off into my ISP somewhere (3), but gets no further. A quick call to my ISP should get some answers.

Or there is the more drastic:

As you can see there is nothing after my router. This must mean that the Internet connection itself isn’t working. Rebooting the router might make it come back to life, but if not then a call to the ISP might sort things out.

So there you have it – all the tools you could ever need to diagnose your network. Of course, if you have an intermittent fault you may find that testing your network with these tools isn’t enough to get to the bottom of it. That’s why in my next installment I am going to show you how to Stress Test your Network – push the limits of your network to try and make it break so we can find that elusive fault.

Filed under Networking

4 Comments

Subscribe to comments with RSS.

  • Chris Leong says:

    Very nice. Fiddler2 (http://www.fiddler2.com/fiddler2/) is also very useful when only some of your packets aren’t reaching their destinations

  • Doug T says:

    Wow great guide. Next time a relative calls and needs help with Internet connectivity, I’ll be sending them this blog post!

  • ivoflipse says:

    @Doug, next time sent them to Super User and we’ll do our best to help them 😉

    Besides if you have any suggestions for other blog posts, leave a comment!

  • Comments have been closed for this post