Monday, January 16, 2006

Step 8 - Configure Nagios on remote hosts - Windows

There are two ways of doing this :

1) nrpe_nt is a windows version of the nrpe (Nagios Remote Plugin Executor) daemon for unix-like operation systems. It provides methods to execute Nagios service checks on a windows host and report the results back to your Nagios host.

http://sourceforge.net/projects/nrpent/


2) Installing NSClient

To monitor win2k/nt machines you need to install the NSClient addon from
http://nsclient.ready2run.nl/ .

1) Follow the below steps to install NSClient on win2k/nt machines.

i. copy pNSClient.exe in any directory on the machine you want to
monitor. ie. (c:\nsclient).
ii. Open a dos prompt in the installation directory
iii. Run the following command : >pNSClient /install
iv. Start the service 'Netsaint NT Agent' in the services applet
of the control panel.

2) ftp/sftp the check_nt file from LinuxBin directory to the nagios
server's plugin directory i,e /usr/local/nagios/libexec in this case.

You can also set a password to NSclient , so that the nagios server can
authenticte first before running a check. Configurig this is suggestable 'cos
no one else can run a check on our server except our nagios server.

To configure this you need to add a registry key and reboot the server. Follow
the below process.

i) Edit the HKEY_LOCAL_MACHINE\SOFTWARE\NSClient\Parms\password key
and set the password as its value.

ii) Reboot the server.


Extras:

Nagios Web Interface,Frontend or GUI Tools

Nagios PHP

Nagios PHP is an alternative PHP Web interface for Nagios, written using SMARTY as its template engine.

Downloads and Documentation
http://nagios-php.sourceforge.net/

NaWui

NaWui stands for Nagios Administration Web User Interface.It is a Web frontend written in PHP to manage Nagios configurations and Database records. Database connectivity is supported using plugins, which simplifies the way records are stored.

Downloads and Documentation
http://www.stigma.dyndns.org/NaWui

Nagmin

NagMIN is a enterprise class Network Monitoring System, Powered by Nagios, WebMIN, RRDtool, Nmap, Fping, Net::SNMP, Syslog-NG and other open source software providing web-based administration, and enhanced web portal to help you manage your network.

Downloads and Documentation
http://nagmin.sourceforge.net/

Nagat

Nagat, or Nagios Administration Tool, is a webbased solution written in PHP for configuring Nagios, a host and service monitor.

Downloads and Documentation
http://nagat.sourceforge.net/

Nagios Web Config

A PHP/MySQL based front-end for Nagios 2.x setup. Complete with the ability to add/remove hosts, hostgroups, contacts, contactgroups, services, timeperiods and commands

Downloads and Documentation
http://sourceforge.net/projects/nagiosweb/

NagEdit

PHP & mySQL based tool to creat config Files for Nagios. No further need to create config files by hand, just use this Web Front End.

Downloads and Documentation
http://sourceforge.net/projects/nagedit

NagiosQL

NagiosQL is a web based administration tool for Nagios 2.x. It helps you to easily build a complex configuration with all options, manage and use them. NagiosQL is based on a webserver with PHP, MySQL and file access to the Nagios configuration files.

Downloads and Documentation
http://www.nagiosql.org/

nag2web

A PHP/MySQL web front-end for Nagios 2.x setup. With the ability to add/remove/edit the config items. The web front-end for NAGIOS has the ability to test the config. We want to build a simple possibility to find and show all the features in NAGIOS.

Downloads and Documentation
http://nag2web.de/

gng

Gng (Gnome Nagios Gui) can display host, parent link, icon, hostgroup map, user map, rectangle, line and text info.

Downloads and Documentation
http://gng.sourceforge.net/

Step 7 - Configure NRPE daemon on the remote hosts

For Monitoring Remote Hosts

NRPE - Nagios Remote Plugin Executor
Daemon and plugin for executing plugins on remote hosts

Nrpe is needed only to execute internal commands in remote host
like check_disk,
check_procs etc ..., and not for any external commands
like check_smtp,
check_pop which is used to see if a smtp, pop or a imap service is running.

This allows commands to be executed on remote hosts

check_nrpe - Runs on Nagios hosts this Plugin is used to send execution requests to the nrpe agent on the remote host.

nrpe - Agent that runs on the remote host and processes plugin execution requests

nrpe.cfg - Configuration file for the remote host agent

The check_nrpe plugin runs on the Nagios host and is used to send plugin execution requests to the nrpe agent on the remote host.

The nrpe agent will then run an appropriate plugins on the remote host and return the plugin output and return code to the check_nrpe plugin on the Nagios host.

The check_nrpe plugin then passes the remote plugin's output and return code back to Nagios as if it were its own. This allows for a rather transparent method of executing plugins on remote hosts. The nrpe agent can either be run as a standalone daemon or as a service under inetd.

Two Things you need to do for Configuring NRPE :

** The System where you Installed Nagios **

- Copy the check_nrpe client to the directory that
contains your Nagios plugins.
- Create a command definition in your Nagios config
file for the NRPE client. See the README file for
more info on doing this.

** The remote Sytem where you want to check for Services running **

- Copy the nrpe daemon to /usr/sbin, /usr/local/nagios
or wherever you feel it fits best.
- Copy the sample nrpe.cfg config file to /etc,
/usr/local/nagios or wherever you feel it fits best.
- Modify the /etc/services file and configure NRPE to
run under inetd, xinetd, or as a standalone daemon.
See the README file for more info on doing this.


Notes :

When running in daemon mode, the nrpe agent authenticates plugin execution requests by doing a rudimentary comparison of the IP address of the calling host against a list of allowed IP addresses in the configuration file.

When running under inetd, TCP wrappers can be employed to restrict access to the nrpe agent


There are a variety of ways you can monitor "local" or "private" services which are not normally exposed publicly. Some addons and tools you can use to accomplish this are listed below. Note that these generally apply only to services running on *NIX boxes

Use the check_by_ssh "plugin" to execute a plugin on a remote host. The check_by_ssh plugin is basically a wrapper for executing a plugin on a remote host using SSH. You must have SSH installed and configured properly in order to use this. In addition, any plugin you want to execute on the remote host must be installed on the remote host beforehand.

Use the nrpep or nagios_statd addons. These addons work in a similiar manner to the nrpe daemon. They are available for download from http://www.nagios.org/download.

If you are running SNMP services on the remote host, you could use the check_snmp plugin to check the value of various OIDs that you're interested in.

Step 6 - Part 3 - Editing Object Configuration files

In these Examples I will just Explain how I Configured some services running in my localhost for nagios.

My Hostname was - mybox.sriram.com

1) A host definition is used to define a physical server, workstation, device, etc. that resides on your network.

/usr/local/nagios/etc/hosts.cfg


define host{
use generic-host ; Name of host template to use

host_name mybox.sriram.com
alias Linux-Sriram #1
address 10.10.93.220
check_command check-host-alive
max_check_attempts 10
notification_interval 120
notification_period 24x7
notification_options d,u,r
}

2) A service definition is used to identify a "service" that runs on a host. The term "service" is used very loosely. It can mean an actual service that runs on the host (POP, SMTP, HTTP, etc.) or some other type of metric associated with the host (response to a ping, number of logged in users, free disk space, etc.). The different arguments to a service
definition are outlined below.

/usr/local/nagios/etc/services.cfg

# Service definition
define service{
use generic-service ; Name of service template to use
host_name mybox.sriram.com
service_description POP3
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups linux_contact_groups
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
check_command check_pop
}

# Service definition
define service{
use generic-service ; Name of service template to use

host_name mybox.sriram.com
service_description PING
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups linux_contact_groups
notification_interval 120
notification_period 24x7
notification_options c,r
check_command check_ping!100.0,20%!500.0,60%
}


3) A contact definition is used to identify someone who should be contacted in the event of a problem on your network. The different arguments to a contact definition are described below.

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

# 'nagios' contact definition

define contact{
contact_name sriram
alias Nagios Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email sriram003@gmail.com
}

4) A time period is a list of times during various days that are considered to be "valid" times for notifications and service checks. It consists one or more time periods for each day of the week that "rotate" once the week has come to an end. Exceptions to the normal weekly time range rotations are not suported.

/usr/local/nagios/etc/timeperiods.cfg

# '24x7' timeperiod definition
define timeperiod{
timeperiod_name 24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}

5)
A command definition is just that. It defines a command.
When you install Nagios-plugin it installs all the commands in
/usr/local/nagios/libexec directory

/usr/local/nagios/etc/checkcommands.cfg

For any additional commands you will need to download from net or create your own Macros.

define command{
command_name check_tcp
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
}

Note: you don't need to edit this file unless its not mentioned in checkcommands.cfg make sure that command is available in /usr/local/nagios/libexec directory.

If you want to see if there are no errors in the configuraion file then run

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

Please make sure you set the proper permission as listed

chown nagios.nagios /usr/local/nagios/var/rw
chmod u+rwx /usr/local/nagios/var/rw
chmod g+rwx /usr/local/nagios/var/rw
In order to force newly created files in the directory to inherit the group permissions from the directory, we need to enable the group sticky bit on the directory...

chmod g+s /usr/local/nagios/var/rw

Restart Web Server

Step 6 - Part 2 - Editing cgi.cfg

Now lets see the CGI Configuration file :

/usr/local/nagios/etc/cgi.cfg

I have UnHashed the below lines in the file cgi.cfg

main_config_file=/usr/local/nagios/etc/nagios.cfg

physical_html_path=/usr/local/nagios/share

url_html_path=/nagios/

show_context_help=1

nagios_check_command=/usr/local/nagios/libexec/check_nagios /usr/local/nagios/var/status.log 5 '/usr/local/nagios/bin/nagios'

use_authentication=1

authorized_for_system_information=nagiosadmin,theboss,jdoe

authorized_for_configuration_information=nagiosadmin,jdoe

authorized_for_system_commands=nagiosadmin

authorized_for_all_services=nagiosadmin,guest
authorized_for_all_hosts=nagiosadmin,guest

authorized_for_all_service_commands=nagiosadmin
authorized_for_all_host_commands=nagiosadmin

statusmap_background_image=smbackground.gd2

default_statusmap_layout=4

default_statuswrl_layout=4

ping_syntax=/bin/ping -n -U -c 5 $HOSTADDRESS$

refresh_rate=90

Step 6 - Part 1- Editing the Necessary .CFG Configuration files

First we will the main configuration file

#cd /usr/local/nagios/etc

Below I am mentioning the lines that I have unhashed

#cat nagios.cfg

log_file=/usr/local/nagios/var/nagios.log

cfg_file=/usr/local/nagios/etc/checkcommands.cfg

cfg_file=/usr/local/nagios/etc/misccommands.cfg

cfg_file=/usr/local/nagios/etc/contactgroups.cfg
cfg_file=/usr/local/nagios/etc/contacts.cfg
cfg_file=/usr/local/nagios/etc/dependencies.cfg
cfg_file=/usr/local/nagios/etc/escalations.cfg
cfg_file=/usr/local/nagios/etc/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg
cfg_file=/usr/local/nagios/etc/timeperiods.cfg

resource_file=/usr/local/nagios/etc/resource.cfg

status_file=/usr/local/nagios/var/status.log

nagios_user=nagios

nagios_group=nagios

check_external_commands=1

command_check_interval=-1

command_file=/usr/local/nagios/var/rw/nagios.cmd

comment_file=/usr/local/nagios/var/comment.log

downtime_file=/usr/local/nagios/var/downtime.log

lock_file=/usr/local/nagios/var/nagios.lock

temp_file=/usr/local/nagios/var/nagios.tmp

log_rotation_method=d

log_archive_path=/usr/local/nagios/var/archives

use_syslog=1

log_notifications=1

log_service_retries=1

log_host_retries=1

log_event_handlers=1

log_initial_states=0

log_external_commands=1

log_passive_service_checks=1

inter_check_delay_method=s

service_interleave_factor=s

max_concurrent_checks=0

service_reaper_frequency=10

sleep_time=1

service_check_timeout=60
host_check_timeout=30
event_handler_timeout=30
notification_timeout=30
ocsp_timeout=5
perfdata_timeout=5

retain_state_information=1

state_retention_file=/usr/local/nagios/var/status.sav

retention_update_interval=60

use_retained_program_state=0

interval_length=60

use_agressive_host_checking=0

execute_service_checks=1

accept_passive_service_checks=1

enable_notifications=1

enable_event_handlers=1

process_performance_data=0

obsess_over_services=0

check_for_orphaned_services=0

check_service_freshness=1

freshness_check_interval=60

aggregate_status_updates=1

status_update_interval=15

enable_flap_detection=0

low_service_flap_threshold=5.0
high_service_flap_threshold=20.0
low_host_flap_threshold=5.0
high_host_flap_threshold=20.0

date_format=us

illegal_object_name_chars=`~!$%^&*|'"<>?,()=

illegal_macro_output_chars=`~$&|'"<>

admin_email=nagios

admin_pager=pagenagios

Step 5 - Understanding the Configuration files of Nagios

Lets Understand the Configuration overview of Nagios.

As per my installation all the configuration files are stored in

--- /usr/local/nagios/etc/ ---- Directory

The main configuration file

/usr/local/nagios/etc/nagios.cfg

The above file contains a number of directives that affect how Nagios operates.

Object Configuration Files

Object configuration files (historically called "host" configuration files) are used to define hosts, services, hostgroups, contacts, contactgroups, commands, etc. This is where you define what things you want monitor and how you want to monitor them.

CGI Configuration File

/usr/local/nagios/etc/cgi.cfg

This contains a number of directives that affect the operation of the CGIs

When you look at the directory /usr/local/nagios/etc

You will find the following files :

cgi.cfg-sample
checkcommands.cfg-sample
contactgroups.cfg-sample
contacts.cfg-sample
dependencies.cfg-sample
escalations.cfg-sample
hostgroups.cfg-sample
hosts.cfg-sample
misccommands.cfg-sample
nagios.cfg-sample
resource.cfg-sample
services.cfg-sample
timeperiods.cfg-sample

You will need to take a backup of the above files and rename the *.cfg-sample to *.cfg


Step 4 - Configure .htaccess for Password Authentication

Password Authentication for Below Directories

/usr/local/nagios/sbin
/usr/local/nagios/share

The next step is to create a file named .htaccess in the root your CGI directory (and optionally also you HTML directory) for Nagios (usually /usr/local/nagios/sbin and /usr/local/nagios/share, respectively). The file(s) should have contents similiar to the following...

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
require valid-user


Now to create the Users
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

Password I added as admin

Okay, so you're done with this part of what needs to be done. If you point your web browser to your Nagios CGIs you should be asked for a username and password. If you have problems getting user authentication to work at this point, read your webserver documentation for more info.

Once you've finished editing the Apache configuration file, you'll need to restart the web server with a command like this...

/etc/rc.d/init.d/httpd restart

Verify Your Changes

Don't forget to check and see if the changes you made to Apache work. You should be able to point your web browser at http://yourmachine/nagios and get the web interface for Nagios.

To Troubleshoot any errors on Apache Server Check the logs

#tail -f /var/log/httpd/error_log

Step 3 - Configure Web Interface for Nagios

To Set up The Web Interface for Nagios

In these instructions I will assume that you are running the Apache web server on your machine. If you are using some other web server, you'll have to make changes where appropriate. I am also assuming that you used the /usr/local/nagios as the installation prefix.

Configure Script Alias For The CGIs

You'll need to create an alias for the CGIs as well. The default installation expects to find them accessible at http://yourmachine/nagios/cgi-bin/, although this can be changed using the --with-cgiurl option in the configure script. Anyway, add something like the following to your web server configuration file (i.e. httpd.conf) (changing it to match any directory differences on your system)...

ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/

AllowOverride AuthConfig
Options ExecCGI
Order allow,deny
Allow from all



Important! The Script-Alias line above must come before the Alias line below. Otherwise Apache will parse the lines differently.

Important! If you are installing Nagios on a multi-user system, you may want use CGIWrap to provide additional security between the CGIs and the external command file. If you decide to use CGIWrap, the ScriptAlias you'll end up using will most likely be different from that mentioned above. More information on doing this can be found here.

Configure Alias For The HTML Files

In order to make the HTML files accessible via the web server, you'll have to edit your Apache configuration file as follows...

Add the following to your web server configuration file (i.e. httpd.conf) as follows:

Alias /nagios/ /usr/local/nagios/share/

Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all


This will allow you to use an URL like http://yourmachine/nagios/ to view the HTML web interface and documentation. The alias should be the same value that you entered for the --with-htmurl argument to the configure script (default is /nagios/).

Important! The Alias directive you just added for the HTML files must come after the ScriptAlias directive for the CGIs. If it doesn't, you'll get a 404 error when attempting to access the CGIs.

Restart The Web Server

Once you've finished editing the Apache configuration file, you'll need to restart the web server with a command like this...

/etc/rc.d/init.d/httpd restart

Step 2 - Installing Nagios Plugins

Installing The Plugins

In order for Nagios to be of any use to you, you're going to have to download and install some plugins.

Plugins are usually installed in the libexec/ directory of your Nagios installation (i.e. /usr/local/nagios/libexec).

Plugins are scripts or binaries which perform all the service and host checks that constitute monitoring. You can grab the latest release of the plugins from- http://www.nagios.org/download or http://sourceforge.net/projects/nagiosplug/

I downloaded the Plugin from here


For Installing Plugin
cd /usr/local/nagios/

#gunzip nagios-plugins-1.4.2.tar.gz
# tar xf nagios-plugins-1.4.2.tar

#cd /usr/local/nagios/nagios-plugins-1.4.2

#./configure' to configure the package for your system.

Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.

#make
`make' to compile the package.

Optionally, type `make check' to run any self-tests that come with
the package.

#make install

`make install' to install the programs and any data files and
documentation.

You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.

Now the Installation of Plugin is completed !!!

After the Installation of Nagios-Plugin you will see a libexec directory created in /usr/local/nagios/

This will have all the necessary commands to check services.

check_

For more options on those commands you can execute :

[root@mybox libexec]# ./check_http
check_http: Could not parse arguments
Usage: check_http -H | -I [-u ] [-p ]
[-w ] [-c ] [-t ] [-L]
[-a auth] [-f ] [-e ]
[-s string] [-l] [-r | -R ]
[-P string] [-m :] [-4|-6] [-N]
[-M ] [-A string] [-k string]






Step 1 - Installing Nagios

I downloaded nagios-1.3.tar.gz from http://www.nagios.org/download/

After Downloading,
Copy the nagios-1.3.tar.gz in /usr/local/src

#gunzip nagios-1.3.tar.gz
#tar xf nagios-1.3.tar

Before Installing Create a Installation Directory and a User for Nagios

Create the base directory where you would like to install Nagios as follows...
#mkdir /usr/local/nagios

Create User/Group
You're probably going to want to run Nagios under a normal user account, so add a new user (and group) to your system with the following commands (these will vary depending on what OS you're running):

#adduser nagios


I used the following Option

[root@mybox nagios-1.3]# ./configure --prefix=/usr/local/nagios --with-cgiurl=/nagios/cgi-bin --with-htmurl=/nagios/ --with-nagios-user=nagios --with-nagios-grp=nagios

You Will get this after you run the above

*** Configuration summary for nagios 1.3 11-17-2005 ***:

General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagios
Embedded Perl: no
Install ${prefix}: /usr/local/nagios
Lock file: ${prefix}/var/nagios.lock
Init directory: /etc/rc.d/init.d

Web Interface Options:
------------------------
HTML URL: http://localhost/nagios//
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP): /usr/sbin/traceroute

External Data Routines:
------------------------
Status data: Default (text file)
Object data: Template-based (text file)
Comment data: Default (text file)
Downtime data: Default (text file)
Retention data: Default (text file)
Peformance data: Default (external commands)
Extended info data: Template-based (text file)

Compile Nagios and the CGIs with the following command:

#make all

Installing The Binaries And HTML Files

Install the binaries and HTML files (documentation and main web page) with the following command:

#make install

Installing An Init Script

If you wish, you can also install the sample init script to /etc/rc.d/init.d/nagios with the following command:

#make install-init

#make install-commandmode
- This installs and configures permissions on the
directory for holding the external command file

#make install-config
- This installs *SAMPLE* config files in /usr/local/nagios/etc
You'll have to modify these sample files before you can
use Nagios. Read the HTML documentation for more info
on doing this. Pay particular attention to the docs on
object configuration files, as they determine what/how
things get monitored!

Now the Installation of Nagios is complete !!!

cd /usr/local/nagios

You should see five different subdirectories. A brief description of what each directory contains is given in the table below.

Sub-Directory Contents
bin/ Nagios core program
etc/ Main, resource, object, and CGI configuration files should be put here
sbin/ CGIs
share/ HTML files (for web interface and online documentation)
var/ Empty directory for the log file

Nagios

Nagios is a system and network monitoring application. It watches hosts and services that you specify, alerting you when things go bad and when they get better, through Web Based Interface.

Nagios Plugins helps you monitor Sevices for Windows and Linux Systems on your network.

What do you need to run Nagios ?

A Linux System.
Web Server - Preferably Apache
Thomas Boutell's GD Library 1.6.3 or Higher (http://www.boutell.com/gd)

What do you need to download ?

Download Nagios Stable version from www.nagios.org
At the time of writing this doc I had downloaded nagios-1.3.tar.gz

Then you need to Download additional plugins.

Let me explain these plugins in detail :

You will need to download 3 Types of plugins

1) nagios-plugins-1.4.2.tar

This will have all the necessary commands to excecute and check status of services under the libexec directory.

2) NRPE - nagios-nrpe_2.0.orig.tar.gz

Daemon and plugin for executing plugins on remote hosts

3) Nsclient - nsclient_201.zip

To Monitor Win2k/NT Systems on your network you need to install nsclient addon from :

http://nsclient.ready2run.nl/


Step by Step Look at Configuring Nagios

1) Install Nagios
2) Install Plugins
3) Configure Web Interface.
4) Configure .htaccess for Password Authentication
5) Understanding the Configuration Files
6) Editing the Necessary .CFG Configuration files

7) Configure NRPE daemon on the remote hosts - Linux
8) Configure NSclient on remote hosts - Windows

Note : There are other Web Based tools available to configure Nagios such as

Nagat -
is a PHP interface for managing Nagios

Nagmin - is a plugin for Webmin that can be used to manage Nagios

Nagiosweb - is a PHP/MySQL frontend for Nagios configuration.

Although I have used the backend to configure Nagios, you may try using anyone of the above.

Redirecting TCP Connections - Rinetd


RINETD : - Internet Redirection Server

Redirects TCP connections from one IP address and port to another. rinetd is a single-process server which handles any number of connections to the address/port pairs specified in the file /etc/rinetd.conf

Rinetd is typically launched at boot time using /usr/sbin/rinetd

The configuration is found in the file /etc/rinetd.conf unless another file is specified using -c command line option

Most of the entries in the file are Forwarding rules

The Format of the forwarding rules is as follows

bindaddress bindport connectedaddress connectedport

For example

10.10.93.220 80 10.10.93.30 80

Would redirect all connections on port 80 on 220 to 80 on 30

Check more about this here