How to setup “libpcap” environment on Ubuntu

Following steps will be required to prepare libpcap environment on Ubuntu.

  1. Download “libpcap” file from http://www.tcpdump.org/release/libpcap-1.3.0.tar.gz
  2. Use following commands sequentially to install “libpcap” package,
    1. $ sudo ./configure – prefix=/usr && make
    2. $ sudo make install

In case, you faced problem while compiling “libpcap” package than, follow these steps.

  1. Download following packages to install “libpcap”.
    1. M4 package (url: ftp://ftp.gnu.org/gnu/m4/)
    2. Biscon package (url: ftp://ftp.gnu.org/gnu/bison/)
    3. Flex package (url: http://flex.sourceforge.net/)
    4. LibPcap package (url: http://www.tcpdump.org/)
  2. Enter into directories M4 package, Biscon package, Flex package and Libpcap package in order and execute the following commands,
    1. $ sudo ./configure
    2. $ sudo make
    3. $ sudo make install

[NOTE: execute above commands to install libpcap package.]

Now, you can write code using libpcap package. Commands to compile and execute your program.

  1. $ gcc -lpcap <file_name>.c -o <file_name>.o
  2. $ sudo ./<file_name>.o

Last word: AHO!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s