SNMP AGENT SETUP

UNIX AGENT

1. Boot your PC in Linux. Login as a root (password is rootpass).

2. Check that the SNMP agent (snmpd daemon) is running on your Linux PC.

ps aux | grep snmpd

If SNMP demon is not running start it with command:

/usr/sbin/snmpd -c /etc/snmpd.conf

3. Change sysContact and sysLocation data:

Edit file /etc/snmpd.local.conf with text editor vi and add lines:

syslocation STRING

syscontact STRING

Restart SNMP agent. Command is:

killall -HUP snmpd

CISCO ROUTER AGENT

1. Check that you have IP connectivity with your router (try to ping router from

your PC). If it is necessary connect with Ethernet your PC and router and setup

IP address on router Ethernet interface.

2. Log into your router and enter privilege mode.

3. Enable the SNMP agent (in configure mode):

snmp-server community public ro

snmp-server community secret rw

4. Enable SNMP traps (in configure mode)

snmp-server host your_PC_IP_address public

snmp-server enable traps

5. Change sysContact and sysLocation data (in configure mode):

snmp-server location Budapest

snmp-server contact CEENet student

 

 

 

 

Cisco router PC


Console COM 1


ETH0 Ethernet port

 

 

 

 

COMMAND LINE SNMP COMMANDS

1. Examine some SNMP object with snmpget command

Syntax for snmpget command:

snmpget hostname community objectID [objectID] ...

Example:

snmpget localhost public system.sysContact.0

snmpget localhost public .1.3.6.2.1.1.4.0

snmpget localhost public .iso.org.dod.internet.mgmt. -> cont.

mib-2.system.sysContact.0

Examine some other objects:

system.sysName.0

system.sysLocation.0

interfaces.ifTable.ifEntry.ifInOctets.1

2. Set some SNMP object with snmpset command

Syntax for snmpset command:

snmpset hostname community objectID type value [objectID type value] ...

Example:

snmpset localhost public system.sysContact.0 s "CEENet student"

Set some other objects:

system.sysLocation.0

NOTE: some objects are by definition READ ONLY (example ip.inReceives.0)

 

3. Walk MIB tree with snmwalk command

Syntax for snmpwalk command:

snmpwalk hostname community [objectID]

Example:

snmpwalk localhost public system

Try snmwalk on some other part of SNMP tree:

ip

interfaces

host

SNMP TRAPS

1. Open separate terminal window and start daemon for receiving SNMP traps.

Command is:

/usr/sbin/snmptrapd -p

2. Send some test traps:

snmptrap localhost public "" "" 3 0 ""

Try to change value for trap type (numbers 3 and 0) in snmptrap command and

look for results.

Shut down some interface on your router or change router configuration and

look into traps data.

For description of MIB variable look into directory /usr/share/snmp/mibs .

For detail description of snmp commands look at man pages for: snmpwalk, snmpset, snmpget, snmptrap, snmptrapd, and snmpd .

Commands are: man snmpwalk

man snmpset

GRAPHICAL TOOL TKINED

1. Start tkined tool.

Command is:

tkined &

2. Add hosts.

a). Select adding of hosts (click on icon number 1).

b). Add hosts (your PC and router). For adding click inside working area(2).

c). Change host parameters. Click with right mouse key(3). Change name of host

and host address. Address should be 127.0.0.1 For router put address of

router Ethernet 0 interface.

2. Start network managing tools (click on option 4)

From menu select SNMP tools and try to get the same SNMP variables as in

lab with command line tools.

3. Try to browse SNMP variables with "SNMP tree" tool.

4. Try all other available tools.

 

MRTG TOOL

  1. Create directory for MRTG results, for example: /home/http/html/mrtg/results
  2. Prepare configuration program for MRTG.
  3. To make configuration easier, use tool cfgmaker. Syntax for command is:

    cfgmaker community@address_of_your_router_or_host

    Example:

    cfgmaker community@address_of_your_router_or_host > new.cfg

    Add information where will be MRTG results:

    echo "WorkDir: /home/http/html/mrtg/results" >> new.cfg

    Add information where are MRTG icons:

    echo "IconDir: /home/http/html/mrtg" >> new.cfg

    For more information about configuring MRTG look into config.html file in documentation directory (/usr/doc/mrtg-2.8.12/doc).

  4. Run MRTG.
  5. mrtg new.cfg

  6. The results can be find in HTML file in directory “WorkDir”.