How to setup “libpcap” environment on Ubuntu

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

  1. Download “libpcap” file from
  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:
    2. Biscon package (url:
    3. Flex package (url:
    4. LibPcap package (url:
  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: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s