Tools for configuring and troubleshooting network connectivity

Combining Ping and Traceroute with mtr

A newer utility is mtr, which also has a Gtk+ front end called xmtr. Depending on the distribution you're running, mtr might or might not be installed. mtr is essentially a cross between ping and traceroute. It combines ping and traceroute functions by sending a number of packets between your host and the destination and providing an interactive display similar to Figure 5.

Figure 5: Running an mtr query on www.linuxpromagazine.com.

Here you see that mtr reports the packet loss (again, nothing to worry about as long as you reach the destination host) and the number of packets sent. Also note that mtr tracks the average, best, worst, and last times for each hop. If you want to have a slightly prettier interface, you can use the xmtr interface, which looks like Figure 6.

Figure 6: The Gtk+ interface for mtr.

Like traceroute and ping, you can set the interface to use with the -i option. Another useful option is the report (-r) option, which tells mtr to run a report and then exit. Note that the report option is only available with the mtr utility.

Troubleshooting DNS

The Domain Name System (DNS) translates the familiar alphanumeric domain names used in email addresses and web URLs (such as linuxpromagazine.com or whitehouse.gov) to and from the numeric IP addresses necessary for TCP/IP networking. As long as your system knows the location of a DNS server, this name resolution process happens invisibly; however, sometimes a bit of troubleshooting is necessary. Also, sometimes for informational purposes, it is important to know the IP address associated with a domain name or the domain name associated with an IP address.

A pair of classic Linux utilities that allow you to query the DNS system are nslookup and host, both of which are part of the bind-utils package. nslookup provides more functionality and more extensive output than host; however, nslookup is considered outdated and less capable than some more modern equivalents.

A powerful and popular DNS tool in use today is dig, which is short for "domain information groper." Basically, dig performs a DNS lookup and then shows the results. The most basic use is

dig <hostname>

which should return quite a bit of output, including an answer section with the hostname and (by default) the IP address associated with the hostname.

However, the dig command can tell you much more. For example, if you want to see what DNS servers the domain uses, run dig NS hostname – this command will return a list of DNS servers responsible for translating the domain name to an IP address.

In the output, you also see what DNS server(s) dig has used to perform its lookups. Here, I'm using Google's DNS:

;; Query time: 40 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Fri Feb  4 17:01:16 2011
;; MSG SIZE  rcvd: 138

The SERVER is 8.8.8.8 – one of Google's public DNS servers. If you can't look up a hostname with your default DNS servers, you can try using a different server by specifying it like this:

dig @8.8.4.4 www.linuxpromagazine.com

which tells dig to use the second Google DNS server.

When is this useful? For one thing, you can query a DNS server to see if it has information that has not propagated to your ISP's DNS servers. This information can be handy so you can check whether you've changed DNS correctly before it propagates by querying the servers directly. Finally, you can use dig to find any kind of DNS record. If you want to see the MX (mail) hosts for a given domain, for example, use the MX directive:

dig MX linuxpromagazine.com

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content