logo

Home page
Articles for Windows, Linux, OS X
Mac tips and articles
Mac tips
Windows 8 tips and articles
Windows 7 tips and articles
Vista Tips
XP Tips
Linux tips and articles
Read the blog
Online store
Windows, Linux, OS X programs
Links
About

Linux tips and tweaks

Test your internet connection using ping and host

If you are having problems with your internet connection and you want to run a few tests to make sure that it is working OK, there are a couple of commands that you can type in at the Terminal that will help. The first is ping and the second is host. They aren't just for testing your internet connection though and it may be fine. The problem could lie at the other end with the website or server you are trying to access. These commands can help you to tell where the fault lies. They can also be used to measure the speed of your internet conection and also speed it up.

The ping command should be typed in at the Terminal window in Linux (it will also work in a command prompt window in Windows too). You follow it either with the URL of a web server or the IP address. For example, enter ping www.google.com and a small packet of information is sent to the Google website. The website receives it and sends it back. If the packet is received OK then it shows that your internet connection is working and that the website is working too. (It is possible for a web server to be configured to ignore ping requests though.)

The ping command keeps repeating itself until you tell it to stop by pressing Ctrl+C. When you stop it, you'll see the packet loss, which should be 0% because packets of data shouldn't go missing on the internet unless there's a problem. Interestingly, you can also see the time taken and it shows the minimum, maximum and average. These figures show how responsive the web server and your internet connection is. It's important for speedy communications, such as with online games.

The other command, host, is also followed by a URL and you can enter something like host www.google.com. The result is the IP address of the web server (some websites have aliases or alternative URLs and these are displayed too). The host command therefore tests that your DNS server is working OK.

You can access a website faster by typing in an IP address because when you enter a URL into a web browser it sends a query to a DNS server to discover the IP address and then it uses the IP address to access the site. By entering the IP address directly, it cuts out a step and is therefore faster. However, IP addresses are impossible to remember, which is why we use URLs instead. But you could find out the IP address of a website and then bookmark it. The bookmark can have a friendly name, but instead of the URL it has the IP address. It'll shave a few millseconds off the time it takes to go there.

Go to Linux tips index...

copyright