Category: Linux

ICMP v/s arping

It’s been a while since my last post, was busy with work.

I have been asked many times, how will I check whether remote server is up or down?

Most common & logical answer is by pinging!

But what if the ping request is disabled? How would you find out?

Imagining the lack of basic knowledge from people I came across who are CCNA, CCNP, RHCE certified + years of experience in networking. Majority of them bluffed or well, lets just put it; Did NOT have any answer!!

Let’s go through this and find the valid answer and a basics behind it.

As we say, “Common sense is not common” just like “Basics is not a basic thing, it’s a foundation of what you think and how you implement”.

In the span of my 5 years of experience, I’ve come across many projects and majority of them were stuck because of half knowledge and missing basics in the implementation.

Scenario 1: Where ping request is enabled.

root@bt:~# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=1.02 ms
64 bytes from icmp_seq=2 ttl=64 time=0.462 ms
— ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.462/0.745/1.029/0.284 ms
root@bt:~# arping
60 bytes from 26:fc:99:e8:47:42 ( index=0 time=338.000 usec
60 bytes from 26:fc:99:e8:47:42 ( index=1 time=212.000 usec
60 bytes from 26:fc:99:e8:47:42 ( index=2 time=220.000 usec
60 bytes from 26:fc:99:e8:47:42 ( index=3 time=257.000 usec
— statistics —
4 packets transmitted, 4 packets received,   0% unanswered (0 extra)

Let’s check arp cache,

root@bt:~# ip neigh show | grep dev eth0 lladdr 26:fc:99:e8:47:42 REACHABLE

As you can see from apr cache, destination server is REACHABLE.

Scenario 2: Ping is disabled.

First, disable ping request on a destination server.

  • [root@ ~]# echo “1” > /proc/sys/net/ipv4/icmp_echo_ignore_all
  • root@bt:~# ping
    PING ( 56(84) bytes of data.
    From icmp_seq=1 Destination Host Unreachable
    From icmp_seq=2 Destination Host Unreachable
    — ping statistics —
    7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 6018ms
  • Now let’s see what arping has to say,

root@bt:~# arping
60 bytes from 26:fc:99:e8:47:42 ( index=0 time=407.000 usec
60 bytes from 26:fc:99:e8:47:42 ( index=1 time=217.000 usec
60 bytes from 26:fc:99:e8:47:42 ( index=2 time=209.000 usec

  • root@bt:~# ip neigh show | grep dev eth0 lladdr 26:fc:99:e8:47:42 REACHABLE

Even ping request is disabled, we can check whether server is UP or Down without any monitoring tools.

what if the server is shutdown.

  • root@bt:~# ip neigh show | grep dev eth0 lladdr 26:fc:99:e8:47:42 STALE

As you can see, STALE is the status of the server.


arping sends TCP request to the server, we can disable ping request but we can’t disable TCP request as it will bring down majority services running on the server.

Let’s take an example of a server pinging but arp cache shows STALE, always a good idea to update cache entries.

  • root@bt:~# ip neigh show dev eth0 lladdr 00:1c:c0:7c:0f:f4 REACHABLE dev eth0 lladdr a2:81:17:5c:3c:35 STALE dev eth0 lladdr 00:1e:2a:49:93:cd STALE
  • is STALE.


  • root@bt:~# arping -u -I eth0 (updating arp cache)
    60 bytes from 00:1e:2a:49:93:cd ( index=0/0 time=12.000 usec
    60 bytes from 00:1e:2a:49:93:cd ( index=1/1 time=5.000 usec
  • root@bt:~# ip neigh show | grep dev eth0 lladdr 00:1e:2a:49:93:cd REACHABLE

It’s always a good habit to clear arp cache,

can be done using,

  • root@bt:~# arp -d ip-address
  • arp cache get’s information from the file, cat /proc/net/arp

In case, arp cache still shows deleted entries and throws error like “SIOCDARP(priv): Network is unreachable”  then theirs a work around

Example: IP is


root@bt [~]# ip addr add dev eth0

root@bt [~]# ip addr del dev eth0

then check arp -n and it won’t show deleted entries any more.



Rename network interface from em1 to eth0

Network interface names have been changed on few versions of RHEL6/ CentOS6  (em1, em2)

To have network interface name renamed to eth0, eth1 follow below procedure:

1. Take a backup of /etc/grub.conf

2. Add biosdevname=0 to the kernel boot arguments in /etc/grub.conf.

3. Rename /etc/sysconfig/network-scripts/ifcfg-em1 to /etc/sysconfig/network-scripts/ifcfg-eth0, change the device name from DEVICE="em1"to DEVICE=”eth0″

4. Delete /etc/udev/rules.d/70-persistent-net.rules

5. Reboot.

How to Install Nagios

Installing Nagios on CentOS

With Below steps you will achieve:

Nagios and the plugins will be installed underneath /usr/local/nagios

Nagios will be configured to monitor a few aspects of your local system (CPU load, disk usage, etc.)

The Nagios web interface will be accessible at http://localhost/nagios/


Make sure you’ve installed the following packages on your Box  before continuing.



GCC compiler

GD development libraries

  1. These packages can be installed with yum using below commands:

yum install httpd php

yum install gcc glibc glibc-common

yum install gd gd-devel

  • Create a new nagios user account and give it a password

useradd nagios

passwd nagios

  • Create a new nagcmd group for allowing external commands to be submitted through the web interface.

Add both the nagios user and the apache user to the group.

groupadd nagcmd

usermod -a -G nagcmd nagios

usermod -a -G nagcmd apache

  • Create a directory for storing the downloads.

mkdir ~/downloads

cd ~/downloads

Download the source code tarballs of both Nagios and the Nagios plugins (visit for links to the latest versions). These directions were tested with

Nagios 3.1.1 and Nagios Plugins 1.4.11.



Compile and Install Nagios


  • Extract the Nagios source code tarball.

cd ~/downloads

tar xzf nagios-3.2.0.tar.gz

cd nagios-3.2.0

  • Run the Nagios configure script, passing the name of the group you created earlier like so:

./configure –with-command-group=nagcmd

  • Compile the Nagios source code.

make all

  • Install binaries, init script, sample config files and set permissions on the external command directory.

make install

make install-init

make install-config

make install-commandmode

Don’t start Nagios yet – there’s still more that needs to be done…

  • Customize Configuration

Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample

files should work fine for getting started with Nagios. You’ll need to make just one change before you


Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts.

vi /usr/local/nagios/etc/objects/contacts.cfg

Configure the Web Interface


  • Install the Nagios web config file in the Apache conf.d directory.

make install-webconf

  • Create a nagiosadmin account for logging into the Nagios web interface.

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

  • Restart Apache to make the new settings take effect.

service httpd restart

Compile and Install the Nagios Plugins


  • Extract the Nagios plugins source code tarball.

cd ~/downloads

tar xzf nagios-plugins-1.4.11.tar.gz

cd nagios-plugins-1.4.11

  • Compile and install the plugins.

./configure –with-nagios-user=nagios –with-nagios-group=nagios


make install

Start Nagios


  • Add Nagios to the list of system services and have it automatically start when the system boots.

chkconfig –add nagios

chkconfig nagios on

Verify the sample Nagios configuration files.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, start Nagios.

service nagios start

Login to the Web Interface

You should now be able to access the Nagios web interface at the URL below. You’ll be prompted for the

username (nagiosadmin) and password you specified earlier.



ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 100) including DPXEXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.

**Tested on CentOS and Redhat distributions.

Chances are, ImageMagick is already installed on your computer if you are using some flavor of Unix, but that it is not installed if you are using some form of Windows. In either case, you can type the following to find out.

[~]# identify –version

Version: ImageMagick 6.4.8 2010-03-08 Q16 OpenMP
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

If the identify program executes and identifies itself as ImageMagick, you may not need to install ImageMagick from source unless you want to add support for additional image formats or upgrade to a newer version.

For Redhat / CentOS 5.8 i386 RPM

For Redhat / CentOS 5.8 x86_64 RPM

  1. rpm -Uvh ImageMagick-6.7.9-6.i386.rpm
  • If Cpanel/WHM then /scripts/installimagemagick

Installation from unix/linux source

ImageMagick builds on a variety of unix and unix-like operating systems including Linux, Solaris etc.

Download Link: wget

$ tar xvfz ImageMagick.tar.gz

$ cd ImageMagick-6.7.9

$ ./configure

$ make && make install

$ ldconfig /usr/local/lib

Check Your Installation

$ /usr/local/bin/convert logo: logo.gif

[~]# identify logo.gif

logo.gif GIF 640×480 640×480+0+0 8-bit PseudoClass 256c 31.7KB 0.000u 0:00.000

[~]# mogrify -resize 640×1200! logo.gif

[~]# identify logo.gif

logo.gif GIF 640×1200 640×1200+0+0 8-bit PseudoClass 256c 94.3KB 0.000u 0:00.000

In above example you can see that we have changed resolution to 640×1200


wkhtmltopdf = Simple shell utility to convert html to pdf using the webkit rendering engine, and qt.

wkhtmltoimage = Converts html to image, uses same webkit rendering engine , and qt.

Below steps has been tested on Cent OS 5.x and 6.x series.

  • Make sure you have GIT installed, if not then refer

Installation path = /root/wkhtmltopdf/bin

  • cp /root/wkhtmltopdf/bin/ /usr/local/lib
  • echo “/usr/local/lib” >> /etc/
  • /sbin/ldconfig

Checking the Installation

[root@bt]#  /root/wkhtmltopdf/bin/./wkhtmltopdf google.pdf

Loading pages (1/6)
Counting pages (2/6)
Loading TOC (3/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)

[root@bt]# /root/wkhtmltopdf/bin/./wkhtmltoimage google.jpg

Loading page (1/2)
Rendering (2/2)

Try to open the above created Image and pdf file and you will see the google page.

PS: Kindly let us know any issue with above article and we will update it.