Chapter 19. Troubleshooting Networks

Linux provides a host of software utilities for troubleshooting network problems. This chapter covers a number of excellent Linux utilities for pinpointing problems and seeing what's happening on your network. These are all intended to be quick and easy to use, rather than for ongoing monitoring. Check out Chapter 13 and Chapter 14 on Nagios and MRTG to learn how to set up monitoring and alerting.

Your workhorses are going to be ping, tcpdump, Wireshark, and ngrep. While ping is still the number one tool for checking connectivity, tcpdump, Wireshark, and ngrep all provide different and excellent ways to capture and read what's going over your wires. You can't count on applications to generate useful error messages when commands fail (or sometimes to generate any messages at all), but nothing is hidden from a packet sniffer. When you don't know if it's a hardware or software problem, run these first to narrow down the possibilities. Software problems are more common than hardware problems, so don't break out the hardware testers until you have eliminated software glitches. Of course, it never hurts to rule out the immediately obvious, such as a disconnected cable or a powered-down machine.

Practice running the various utilities in this chapter as often as you can on healthy systems. Then, you'll know what a healthy network looks like, and you'll develop elite skills that will come in handy when there are troubles.

Don't forget your logfiles. Most applications come with an option to crank up the logging levels to debug. Do this to collect as much data as possible, and then don't forget to turn the level back down to something sane so you don't fill your logfiles in record time.

If you're into testing your own cabling, there are all kinds of interesting tools to help you. A basic multimeter should be your first purchase, along with an electrical outlet tester. These are inexpensive little yellow three-pronged gadgets with colored LEDs. Just plug one into an electrical outlet, and the LEDs will tell you if it is healthy or not.

Multimeters are useful for a lot of jobs, such as finding shorts and opens, testing for continuity and attenuation, and determining whether a wire is terminated correctly. They're also great for other jobs, such as testing power supplies and motherboards.

For installed cable, you'll need a special continuity tester that comes in two pieces—one for each end of the cable. Some of these also come with tone generators for tracing cables. If you crimp your own cables, you ought to invest in a good cable tester.

Tracking down cable problems inside walls—and tracing and identifying them— calls for a "fox and hound pair," which is a delightful name for a tone generator and amplifier pair. The fox connects to a cable and generates a tone, and then the hound sniffs out the tone to identify and trace the cable. The fox reads the tone through the wire's insulation, and even through drywall.

If you're not interested in being your own cable guru, find yourself a professional who understands analog wiring, digital wiring, and computer cabling, because these days, you're going to find all three jumbled together. Even when you are your own cabling guru, you'll still need an electrician and a telecom technician from time to time. Never try to be your own homegrown electrician—any wire that carries current should be touched only by a professional.