Installing ngrep
The information on this page does not map to a specific certification objective.The book covers the ngrep program on page 539 but doesn't go into detail about how to install it. This page does. The official Web site for ngrep is http://ngrep.sourceforge.net. At the time this page was created, a RPM package was not available so you must choose to install from either source code or a binary.
Ngrep requires the packet capture (pcap) library. This is probably already installed on your Linux system. You can see if it is by running this whereis command:
whereis libpcap libpcap: /usr/lib/libpcap.a /usr/lib/libpcap.soIn this example, the library was found in the /usr/lib directory. If it was not found, you'll have to install it. If your Linux distribution doesn't provide it, you can download Linux/UNIX source code. If you want to run pcap on Windows, you can download a Windowsbinary.
Installing from Source
You can perform these steps logged in as root. If you're security conscious, you can perform most of these steps as an ordinary user but one step requires that you be logged in as root.
- Go to http://ngrep.sourceforge.net and locate the download page. Download the ngrep source code file, which was called ngrep-1.44-1.tar.bz2 at the time this page was created. You can save the file to your home directory.
- Go to a command prompt and make sure that the downloaded file is in the current directory.
- Uncompress and untar the file with this command: tar xzf ngrep-1.44-1.tar.bz2. This will create a subdirectory called ngrep-1.44-1.
- Enter ./configure.
- Enter make.
- You must be logged in as root for this next step. If you are not, enter su and respond to the password prompt with root's password.
- Enter make install. The ngrep program will now be installed in the /usr/local/bin directory and the ngrep man page will be installed to the /usr/local/man directory.
- You no longer need to be logged in as root. Enter exit to return to your ordinary user login if you used the su command earlier.
- You're ready to run the ngrep program.
Installing the UNIX Binary
- Go to http://ngrep.sourceforge.net and locate the download page. Download the ngrep UNIX binary file, which was called ngrep-1.44-linux-elf-static.bz2 at the time this page was created. You can save the file to your home directory.
- Go to a command prompt and make sure that the downloaded file is in the current directory.
- Enter bunzip2 ngrep-1.44-linux-elf-static.bz2 to uncompress the file. Enter ls and see that the file has been renamed to ngrep-1.44-linux-elf-static.
- You must be logged in as root for this next step. If you are not, enter su and respond to the password prompt with root's password.
- Move the file to the /usr/local/bin directory by entering mv ngrep-1.44-linux-elf-static /usr/local/bin/
- You no longer need to be logged in as root. Enter exit to return to your ordinary user login if you used the su command earlier.
- You're ready to run the ngrep program.
Installing on Windows
You can install ngrep on Windows by downloading a Windows binary.