Showing posts with label FreeBSD. Show all posts
Showing posts with label FreeBSD. Show all posts

Thursday, July 17, 2008

Understanding routing table flags

Following command produces very handy routing table of your system.

#netstat -r
#route

The output is very handy and helps in troubleshooting your network problem. The flags if you can understand will help you much more. So here is the summary of the flags and their meaning.

Flag

Name

Meaning



1

RTF_PROTO1

Protocol specific routing flag 1

2

RTF_PROTO2

Protocol specific routing flag 2

3

RTF_PROTO3

Protocol specific routing flag 3

B

RTF_BLACKHOLE

Just discard pkts (during updates)

b

RTF_BROADCAST

The route represents a broadcast address

C

RTF_CLONING

Generate new routes on use

c

RTF_PRCLONING

Protocol-specified generate new routes on use

D

RTF_DYNAMIC

Created dynamically (by redirect)

G

RTF_GATEWAY

Destination requires forwarding by intermediary

H

RTF_HOST

Host entry (net otherwise)

L

RTF_LLINFO

Valid protocol to link address translation

M

RTF_MODIFIED

Modified dynamically (by redirect)

R

RTF_REJECT

Host or net unreachable

S

RTF_STATIC

Manually added

U

RTF_UP

Route usable

W

RTF_WASCLONED

Route was generated as a result of cloning

X

RTF_XRESOLVE

External daemon translates proto to link address

Tuesday, July 1, 2008

Cacti on Freebsd

cacti is a very useful tool for monitoring your devices on network.

While there are many tutorials on installation and use of cacti this tutorial aims on providing just enough information to make installation work and graphing possible.

Cacti requires that the following software is installed on your system.

* RRDTool 1.0.49 or 1.2.x or greater
* MySQL 3.23 or greater, 4.1.x or 5.x or greater
* PHP 4.3.6 or greater, 5.x greater highly recommended for
advanced features
* A Web Server e.g. Apache

On you freebsd box
# cd /usr/ports/net/cacti
# make config
enable plugins
# make && make install

This will take care of all the packages it requires like

* apache
* rrdtool
* net-snmp
* php5-extensions
* php5 (With MySQL and SNMP Support)
* mysql server

To start snmp, apache and mysql in every reboot type
# echo 'snmpd_enable="YES"' >>/etc/rc.conf

# echo '/usr/local/libexec/mysqld --user=mysql &' >> /etc/rc.conf
# echo '/usr/local/sbin/apachectl start' >>/etc/rc.conf


To configure your snmp run the following command
# snmpconf

If you are installing mysql for the first time then
# chown -R mysql:mysql /var/db/mysql

For Apache 2.x
You should make sure that the following line is present in your httpd.conf file.

LoadModule php5_module libexec/apache/libphp5.so


In httpd.conf itself

<IfModule mod_dir.c>
<IfModule mod_php3.c>
<IfModule mod_php5.c>
DirectoryIndex index.php index.php3 index.html
</IfModule>
<IfModule !mod_php4.c>
DirectoryIndex index.php3 index.html
</IfModule>
</IfModule>
<IfModule !mod_php3.c>
<IfModule mod_php5.c>
DirectoryIndex index.php index.html index.htm
</IfModule>
<IfModule !mod_php4.c>
DirectoryIndex index.html
</IfModule>
</IfModule>
</IfModule>


Or you can simply have

DirectoryIndex index.php index.html index.htm


Finally add these two lines

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


Add an alias for your cacti.

For eg: if you have your cacti setup on /usr/local/share/cacti then add an alias with

Alias /cacti /usr/local/share/cacti

Alternatively you can configure symbolic link too.

Now configure Mysql
First set root password
# mysqladmin --user=root password newpassword
# mysqladmin --user=root --password reload

Create a database for cacti
# mysqladmin --user=root --password create cacti

Import the default cacti database
# mysql cacti
Create a mysql username and password for cacti
# mysql --user=root --password mysql
mysql> Grant all on cacti.* to 'cactiuser'@'localhost' identified by 'password';

Edit the file include/config.php to reflect the current database changes.

Edit your crontab
# crontab -e
*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&
1

Open your browser and access http://thewebser/cacti

This completes the instllation.

Creating graph, graph template, host template and other useful stuffs will be covered in next part of the tutorial.
I have data template and graph template for
Proxim wireless device like Tsunami showing SNR, signal and noise.
Deliberant wirelss device showing RSSI and channel.