Ear to the Net
Many programs communicate over the network, and when a bottleneck occurs, these tools can help you determine the cause.
|
Many programs communicate over the network, and when a bottleneck occurs, these tools can help you determine the cause.
No one is happy when the local network goes down. With a few helpful tools, however, you can start searching immediately for the nasty LAN-breaking culprit and fix the situation in an instant with a bit of skill and some know-how. Using a combination of iptraf, ifstat, tcpstat, bmon, and pktstat, you can quickly find what's impeding your data traffic through NetHogs [1] and Atop [2].
Although real-time analysis tools are good for answering questions about the current state of things on the Linux system, they are less suitable for longer-term evaluation. Answers to questions like "How much traffic did clients and network services produce in the last week" or "Who clogged things up last night at 2 o'clock?" require that you keep the data throughput and statistics constantly in sight.
Programs such as vnStat [3], ntop [4], darkstat [5], and BandwidthD [6] can help you in this endeavor as well as in drilling down into the protocols and processes. Some of the tools also provide a web-based interface and are thus ideally suited for installation on routers or servers, allowing for reliable reporting over time intervals.
If you just want to take a quick glance at the console to see which interfaces are experiencing unusually high traffic, then netstat [7], nload [8] and nicstat [9] are viable options. The first two have been standard tools for Linux for years, whereas the third is a newcomer that comes from (Open)Solaris administrators. Ubuntu packages the first two by default, and the third is available from James Troup's PPA [10].
Nicstat shows the values for each interface (Listing 1, second column), along with received and transmitted data volume per second (third and fourth column), average packets per second (fifth and sixth column) and packet size (the last two columns). The last two columns show the degree of use and saturation. Listing 1 clearly shows that most of the data flows over eth0 , with the largest packets coming over the loopback device lo , while the wireless interface wlan0 seems inactive.
Listing 1
Nicstat Displays Data Volume, Packet Size, etc.
merkaba:~> nicstat Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat 19:53:07 eth0 2.39 0.11 11.64 0.88 210.4 127.4 0.02 0.00 19:53:07 lo 0.34 0.34 0.20 0.20 1719.8 1719.8 0.00 0.00 19:53:07 wlan0 0.01 0.00 0.05 0.00 169.7 155.4 0.00 0.00
Running the NetHogs program requires root privileges. At first, it collects only the information for the eth0 interface, but you can add further options as parameters.
The tool then displays a list of processes based on the network bandwidth (Figure 1). In doing so, it sorts the output in descending order based on usage or load and updates the display every second. With the -d <seconds> option you can set another interval, such as -d 5 for updates every five seconds.
The NetHogs output consists of six columns – process ID (PID), process user, program call, network interface used, and data sent and received over it [11]. Pressing M lets you change the output in the last column from KB/sec to the total amount in bytes, KB, or MB.
Pressing R and S lets you sort the output by received or transmitted data, respectively. You can identify the process running amok by the PID and then end or pause the process if needed.
Currently NetHogs analyzes TCP connections only, not UDP services such as BitTorrent. If the text version doesn't suit you, a BusyTasks [12] plugin is ready to integrate with KDE-Plasmoid that uses NetHogs as a back end.
Pages: 6
Sluggish network connections can be nerve-wracking. Checking live statistics about network traffic can help pinpoint the problem. Iftop is a command-line system monitoring tool that can help you identify bandwidth hogs and keep traffic moving.
Given the extent to which intelligence agencies have been tapping data off the Internet, those wanting to protect their privacy need to take action. Tor can help you.
JonDonym lets you surf the Internet anonymously without complicated configurations, even from a live stream.
The Obnam command-line tool allows backups and restores, even when the X server is on strike. Its many options will easily meet the needs of a SOHO environment.
A wireless LAN is easier to set up than a cable LAN but is significantly less secure. A RADIUS server can change that.
© 2024 Linux New Media USA, LLC – Legal Notice