Top Nav

Archive | Networking

Block IP Address With IPTables

Need to block am IP address from your server? Here’s an IPTables command:

/sbin/iptables -I INPUT -s w.x.y.z -j DROP

where w.x.y.z is the IP address to be blocked.

Here’s a way to block and address with just the route command:

/sbin/route add -host w.x.y.z reject


IPTables – Filter ICMP Timestamp Requests & Replies

Here’s how to filter or block ICMP timestamp requests and replies.

On Redhat/CentOS, edit /etc/sysconfig/iptables and add the following lines

and then run:

Or run the following commands:

Recently on an Ubantu server we just added these lines to /etc/rc.local:


OpenNMS Install

OpenNMS is a great network monitoring tool. Here’s the OpenNMS site:

In this case I’m going to do an install on to a RedHat Fedora Core 1 server. Here’s the installation guide:

The first step is to install the various prerequisites:

– Java 2 SDK 1.4.2 or later from

We did a stock install of the 1.4.2_07 tar/gz package to /usr/local/. Don’t forget to export the JAVA_HOME environment variable:

– Tomcat 4 from

We did a standard install of the 4.1.31 tar/gz package following the instructions here:

The install was placed at /usr/local/jakarta-tomcat-4.0.

We added the following lines to /etc/rc.local to start Tomcat on bootup and open the appropriate firewall ports:

At this point Tomcat was accessible at http://{myipaddress}:8080

– RRDTool from

We used the 1.0.49 source tar/gz package and built it using the instructions in the enclosed README file. The package was installed to: /usr/local/rrdtool-1.0.49

Had to add a –enable-shared option to the configure command line to get the shared libraries to build.

Had to symlink rrdtool into /usr/bin so that opennms could find it:

ln -s /usr/local/rrdtool-1.0.49/bin/rrdtool /usr/bin/rrdtool

Also edited /etc/ and add “/usr/local/rrdtool-1.0.49/lib/” – the path to the rddtool shared libraries. Finally ran ldconfig to update the cache.

– PostgreSQL 7.2 or later from

We used the 7.4.7 release and installed the following binary rpms:


After installing we did the following commands to start the database and set it to start on bootup:

And that does it for the prerequisites.

We’ll now install OpenNMS, still following the instructions at:

To keep the install simple we used the FC1 RPM binaries provided by OpenNMS. After downloading we had three files:


Next we tried to install the first rpm with:

rpm -i opennms-1.2.0-1_fc1.i386.rpm

We ran into some problems with missing dependancies at this point. First we had to install:


which was downloaded from RPMFind.

Then we installed with dependancies turned off.

rpm -i –nodeps opennms-1.2.0-1_fc1.i386.rpm
rpm -i opennms-docs-1.2.0-1_fc1.i386.rpm
rpm -i –nodeps opennms-webapp-1.2.0-1_fc1.i386.rpm

Many of the opennms files get installed to:


Next we’ll setup the installer:

export OPENNMS_HOME=/opt/OpenNMS
$OPENNMS_HOME/bin/runjava -s

And run the installer:

$OPENNMS_HOME/bin/install -disU

This failed with jdbc errors about problems connection to postgres.

To fix it we added the following firewall rule:

iptables -A INPUT -s -p tcp –dport 5432 -j ACCEPT

And modified the pg_hba.conf file to this:

local all all ident sameuser
host all all trust

Now the installer ran properly.

Next we ran the installer for the webapps:

export CATALINA_HOME=/usr/local/jakarta-tomcat-4.0
$OPENNMS_HOME/bin/install -y -w $CATALINA_HOME/webapps -W $CATALINA_HOME/server/lib

This worked without any problems.

Next we tried to start opennms with:

$OPENNMS_HOME/bin/ start

This took a really long time to return and then reported that startup had failed. In fact startup worked it just takes several minutes.

We had to restart tomcat before we could get to the webapp at:


The initial login was user “admin” and password “admin”

Finally we set opennms to start on boot with:

chkconfig –add opennms


Fixing ethernet interface speed

On redhat, the ETHTOOL_OPTS can provide some control over interface speed. Here’s the description from documentation:

The ethtool utility provides extensive low level control over ethernet interfaces.


Redhat Network Config Resources

Here are some handy references about network config on redhat:

  • /usr/share/doc/initscripts-<version>/sysconfig.txt — A guide to available options for network configuration files, including IPv6 options not covered in this chapter.
  • /usr/share/doc/iproute-<version>/ — This file contains a wealth of information about the ip command, which can be used to manipulate routing tables, among other things. Use the ggv or kghostview application to view this file.