1. fernandocerutti@darwin:~$ sudo apt-get install libnet-snmp-perl

[sudo] password for fernandocerutti:

no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages were automatically installed and are no longer required:

libdbus-1-3:i386 libpng12-0:i386

Use 'apt-get autoremove' to remove them.

Suggested packages:

libcrypt-des-perl

The following NEW packages will be installed:

libnet-snmp-perl

0 upgraded, 1 newly installed, 0 to remove and 1310 not upgraded.

Need to get 107 kB of archives.

After this operation, 464 kB of additional disk space will be used.

Get:1 saucy/main libnet-snmp-perl all 6.0.1-2 [107 kB]

Fetched 107 kB in 1s (71.2 kB/s)

Selecting previously unselected package libnet-snmp-perl.

(Reading database ... 193524 files and directories currently installed.)

Unpacking libnet-snmp-perl (from .../libnet-snmp-perl_6.0.1-2_all.deb) ...

Processing triggers for man-db ...

Setting up libnet-snmp-perl (6.0.1-2) ...

  1. fernandocerutti@darwin:~$ perl -e 'use Net::SNMP;'

Testar se a porta UDP 161 abriu

  1. fernandocerutti@darwin:~$ netstat -nau | more

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address Foreign Address State

udp 0 0 0.0.0.0:54202 0.0.0.0:*

udp 0 0 0.0.0.0:19555 0.0.0.0:*

udp 0 0 0.0.0.0:5353 0.0.0.0:*

udp 0 0 0.0.0.0:10000 0.0.0.0:*

udp 0 0 127.0.1.1:53 0.0.0.0:*

udp 0 0 0.0.0.0:68 0.0.0.0:*

udp 0 0 172.16.193.255:137 0.0.0.0:*

udp 0 0 172.16.193.186:137 0.0.0.0:*

udp 0 0 0.0.0.0:137 0.0.0.0:*

udp 0 0 172.16.193.255:138 0.0.0.0:*

udp 0 0 172.16.193.186:138 0.0.0.0:*

udp 0 0 0.0.0.0:138 0.0.0.0:*

udp 0 0 0.0.0.0:631 0.0.0.0:*

udp6 0 0 :::5353 :::*

udp6 0 0 :::40595 :::*

udp6 0 0 :::59757 :::*

não abriu!

  1. fernandocerutti@darwin:~$ sudo apt-get install snmp

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages were automatically installed and are no longer required:

libdbus-1-3:i386 libpng12-0:i386

Use 'apt-get autoremove' to remove them.

The following NEW packages will be installed:

snmp

0 upgraded, 1 newly installed, 0 to remove and 1310 not upgraded.

Need to get 146 kB of archives.

After this operation, 554 kB of additional disk space will be used.

Get:1 trusty/main snmp amd64 5.7.2~dfsg-8.1ubuntu3 [146 kB]

Fetched 146 kB in 4s (36.4 kB/s)

Selecting previously unselected package snmp.

(Reading database ... 193563 files and directories currently installed.)

Unpacking snmp (from .../snmp_5.7.2~dfsg-8.1ubuntu3_amd64.deb) ...

Processing triggers for man-db ...

Setting up snmp (5.7.2~dfsg-8.1ubuntu3) ...

-D[TOKEN[,...]]turn on debugging output for the specified TOKENs

(ALL gives extremely verbose debugging output)

General options

-m MIB[:...]load given list of MIBs (ALL loads everything)

-M DIR[:...]look in given list of directories for MIBs

(default: /home/fernandocerutti/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp)

-P MIBOPTSToggle various defaults controlling MIB parsing:

u: allow the use of underlines in MIB symbols

c: disallow the use of "--" to terminate comments

d: save the DESCRIPTIONs of the MIB objects

e: disable errors when MIB symbols conflict

w: enable warnings when MIB symbols conflict

W: enable detailed warnings when MIB symbols conflict

R: replace MIB symbols from latest module

-O OUTOPTSToggle various defaults controlling output display:

0: print leading 0 for single-digit hex characters

a: print all strings in ascii format

b: do not break OID indexes down

e: print enums numerically

E: escape quotes in string indices

f: print full OIDs on output

n: print OIDs numerically

q: quick print for easier parsing

Q: quick print with equal-signs

s: print only last symbolic element of OID

S: print MIB module-id plus last element

t: print timeticks unparsed as numeric integers

T: print human-readable text along with hex strings

u: print OIDs using UCD-style prefix suppression

U: don't print units

v: print values only (not OID = value)

x: print all strings in hex format

X: extended index format

-I INOPTSToggle various defaults controlling input parsing:

b: do best/regex matching to find a MIB node

h: don't apply DISPLAY-HINTs

r: do not check values for range/type legality

R: do random access to OID labels

u: top-level OIDs must have '.' prefix (UCD-style)

s SUFFIX: Append all textual OIDs with SUFFIX before parsing

S PREFIX: Prepend all textual OIDs with PREFIX before parsing

-L LOGOPTSToggle various defaults controlling logging:

e: log to standard error

o: log to standard output

n: don't log at all

f file: log to the specified file

s facility: log to syslog (via the specified facility)

(variants)

[EON] pri: log to standard error, output or /dev/null for level 'pri' and above

[EON] p1-p2: log to standard error, output or /dev/null for levels 'p1' to 'p2'

[FS] pri token: log to file/syslog for level 'pri' and above

[FS] p1-p2 token: log to file/syslog for levels 'p1' to 'p2'

-C APPOPTSSet various application specific behaviours:

f: do not fix errors and retry the request

  1. fernandocerutti@darwin:~$ su -
  2. root@darwin:/etc/snmp# snmpconf

The following installed configuration files were found:

1: ./snmp.conf

2: /etc/snmp/snmp.conf

Would you like me to read them in? Their content will be merged with the

output files created by this session.

Valid answer examples: "all", "none","3","1,2,5"

Read in which (default = all): 1

I can create the following types of configuration files for you.

Select the file type you wish to create:

(you can create more than one as you run this program)

1: snmp.conf

Other options: quit

  1. root@darwin:/usr/sbin# apt-get install snmpd

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following NEW packages will be installed:

snmpd

0 upgraded, 1 newly installed, 0 to remove and 1311 not upgraded.

Need to get 73.3 kB of archives.

After this operation, 232 kB of additional disk space will be used.

Get:1 trusty/main snmpd amd64 5.7.2~dfsg-8.1ubuntu3 [73.3 kB]

Fetched 73.3 kB in 1s (39.2 kB/s)

Preconfiguring packages ...

Selecting previously unselected package snmpd.

(Reading database ... 193620 files and directories currently installed.)

Unpacking snmpd (from .../snmpd_5.7.2~dfsg-8.1ubuntu3_amd64.deb) ...

Processing triggers for ureadahead ...

ureadahead will be reprofiled on next reboot

Processing triggers for man-db ...

Setting up snmpd (5.7.2~dfsg-8.1ubuntu3) ...

Configuration file `/etc/snmp/snmpd.conf'

==> File on system created by you or by a script.

==> File also in package provided by package maintainer.

What would you like to do about it ? Your options are:

Y or I : install the package maintainer's version

N or O : keep your currently-installed version

D : show the differences between the versions

Z : start a shell to examine the situation

The default action is to keep your current version.

*** snmpd.conf (Y/I/N/O/D/Z) [default=N] ?

update-rc.d: warning: stop runlevel arguments (1) do not match snmpd Default-Stop values (0 1 6)

* Starting network management services: Processing triggers for ureadahead ...

root@darwin:/usr/sbin#

verificar abertura da porta UDP 161:

  1. root@darwin:/usr/sbin# netstat -nau

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address Foreign Address State

udp 0 0 0.0.0.0:54202 0.0.0.0:*

udp 0 0 0.0.0.0:5353 0.0.0.0:*

udp 0 0 0.0.0.0:10000 0.0.0.0:*

udp 0 0 0.0.0.0:57390 0.0.0.0:*

udp 0 0 127.0.1.1:53 0.0.0.0:*

udp 0 0 0.0.0.0:68 0.0.0.0:*

udp 0 0 172.16.193.255:137 0.0.0.0:*

udp 0 0 172.16.193.186:137 0.0.0.0:*

udp 0 0 0.0.0.0:137 0.0.0.0:*

udp 0 0 172.16.193.255:138 0.0.0.0:*

udp 0 0 172.16.193.186:138 0.0.0.0:*

udp 0 0 0.0.0.0:138 0.0.0.0:*

udp 0 0 0.0.0.0:161 0.0.0.0:*

udp 0 0 0.0.0.0:631 0.0.0.0:*

udp6 0 0 :::5353 :::*

udp6 0 0 :::28085 :::*

udp6 0 0 :::59757 :::*

  1. sudo apt-get install snmp-mibs-downloader

At that point you must edit /etc/snmp/snmp.conf and comment out the one uncommented line.

# # As the snmp packages come without MIB files due to license reasons, loading # of MIBs is disabled by default. If you added the MIBs you can reenable # loaging them by commenting out the following line. mibs :

Lastly, you will need to edit the /etc/snmp/snmpd.conf file that restricts you to only the system mib.

rocommunity public default -V systemonly

becomes

rocommunity public 172.16.0.0/20

Or whatever is appropriate for your environment.

MIB HANDLING

mibdirs DIRLIST specifies a list of directories to search for MIB files. This operates in the same way as the -M option - see snmpcmd(1) for details. Note that this value can be overridden by the MIBDIRS environment variable, and the -M option. mibs MIBLIST specifies a list of MIB modules (not files) that should be loaded. This operates in the same way as the -m option - see snmpcmd(1) for details. Note that this list can be overridden by the MIBS environment variable, and the -m option. mibfile FILE specifies a (single) MIB file to load, in addition to the list read from the mibs token (or equivalent configuration). Note that this value can be overridden by the MIBFILES environment variable. showMibErrors (1|yes|true|0|no|false) whether to display MIB parsing errors. strictCommentTerm (1|yes|true|0|no|false) whether MIB parsing should be strict about comment termination. Many MIB writers assume that ASN.1 comments extend to the end of the text line, rather than being terminated by the next "--" token. This token can be used to accept such (strictly incorrect) MIBs. Note that this directive is poorly named, since a value of "true" will turn off the strict interpretation of MIB comments. mibAllowUnderline (1|yes|true|0|no|false) whether to allow underline characters in MIB object names and enumeration values. This token can be used to accept such (strictly incorrect) MIBs. mibWarningLevel INTEGER the minimum warning level of the warnings printed by the MIB parser.

OUTPUT CONFIGURATION

logTimestamp (1|yes|true|0|no|false) Whether the commands should log timestamps with their error/message logging or not. Note that output will not look as pretty with timestamps if the source code that is doing the logging does incremental logging of messages that are not line buffered before being passed to the logging routines. This option is only used when file logging is active. printNumericEnums (1|yes|true|0|no|false) Equivalent to -Oe. printNumericOids (1|yes|true|0|no|false) Equivalent to -On. dontBreakdownOids (1|yes|true|0|no|false) Equivalent to -Ob. escapeQuotes (1|yes|true|0|no|false) Equivalent to -OE. quickPrinting (1|yes|true|0|no|false) Equivalent to -Oq. printValueOnly (1|yes|true|0|no|false) Equivalent to -Ov. dontPrintUnits (1|yes|true|0|no|false) Equivalent to -OU. numericTimeticks (1|yes|true|0|no|false) Equivalent to -Ot. printHexText (1|yes|true|0|no|false) Equivalent to -OT. hexOutputLength integer Specifies where to break up the output of hexadecimal strings. Set to 0 to disable line breaks. Defaults to 16. suffixPrinting (0|1|2) The value 1 is equivalent to -Os and the value 2 is equivalent to -OS. oidOutputFormat (1|2|3|4|5|6) Maps -O options as follow: -Os=1, -OS=2, -Of=3, -On=4, -Ou=5. The value 6 has no matching -O option. It suppresses output. extendedIndex (1|yes|true|0|no|false) Equivalent to -OX. noDisplayHint (1|yes|true|0|no|false) Disables the use of DISPLAY-HINT information when parsing indices and values to set. Equivalent to -Ih.

FILES

/etc/snmp/snmp.conf, /etc/snmp/snmp.local.conf - common configuration settings Error! Hyperlink reference not valid. - user-specific configuration settings

SEE ALSO

MIB HANDLING

mibdirs DIRLIST specifies a list of directories to search for MIB files. This operates in the same way as the -M option - see snmpcmd(1) for details. Note that this value can be overridden by the MIBDIRS environment variable, and the -M option. mibs MIBLIST specifies a list of MIB modules (not files) that should be loaded. This operates in the same way as the -m option - see snmpcmd(1) for details. Note that this list can be overridden by the MIBS environment variable, and the -m option. mibfile FILE specifies a (single) MIB file to load, in addition to the list read from the mibs token (or equivalent configuration). Note that this value can be overridden by the MIBFILES environment variable. showMibErrors (1|yes|true|0|no|false) whether to display MIB parsing errors. strictCommentTerm (1|yes|true|0|no|false) whether MIB parsing should be strict about comment termination. Many MIB writers assume that ASN.1 comments extend to the end of the text line, rather than being terminated by the next "--" token. This token can be used to accept such (strictly incorrect) MIBs. Note that this directive is poorly named, since a value of "true" will turn off the strict interpretation of MIB comments. mibAllowUnderline (1|yes|true|0|no|false) whether to allow underline characters in MIB object names and enumeration values. This token can be used to accept such (strictly incorrect) MIBs. mibWarningLevel INTEGER the minimum warning level of the warnings printed by the MIB parser.

OUTPUT CONFIGURATION

logTimestamp (1|yes|true|0|no|false) Whether the commands should log timestamps with their error/message logging or not. Note that output will not look as pretty with timestamps if the source code that is doing the logging does incremental logging of messages that are not line buffered before being passed to the logging routines. This option is only used when file logging is active. printNumericEnums (1|yes|true|0|no|false) Equivalent to -Oe. printNumericOids (1|yes|true|0|no|false) Equivalent to -On. dontBreakdownOids (1|yes|true|0|no|false) Equivalent to -Ob. escapeQuotes (1|yes|true|0|no|false) Equivalent to -OE. quickPrinting (1|yes|true|0|no|false) Equivalent to -Oq. printValueOnly (1|yes|true|0|no|false) Equivalent to -Ov. dontPrintUnits (1|yes|true|0|no|false) Equivalent to -OU. numericTimeticks (1|yes|true|0|no|false) Equivalent to -Ot. printHexText (1|yes|true|0|no|false) Equivalent to -OT. hexOutputLength integer Specifies where to break up the output of hexadecimal strings. Set to 0 to disable line breaks. Defaults to 16. suffixPrinting (0|1|2) The value 1 is equivalent to -Os and the value 2 is equivalent to -OS. oidOutputFormat (1|2|3|4|5|6) Maps -O options as follow: -Os=1, -OS=2, -Of=3, -On=4, -Ou=5. The value 6 has no matching -O option. It suppresses output. extendedIndex (1|yes|true|0|no|false) Equivalent to -OX. noDisplayHint (1|yes|true|0|no|false) Disables the use of DISPLAY-HINT information when parsing indices and values to set. Equivalent to -Ih.

FILES

/etc/snmp/snmp.conf, /etc/snmp/snmp.local.conf - common configuration settings Error! Hyperlink reference not valid. - user-specific configuration settings

SEE ALSO
NAME

snmpcmd - options and behaviour common to most of the Net-SNMP command- line tools

SYNOPSIS

snmpcmd [OPTIONS] AGENT [PARAMETERS]

DESCRIPTION

This manual page describes the common options for the SNMP commands: snmpbulkget, snmpbulkwalk, snmpdelta, snmpget, snmpgetnext, snmpnetstat, snmpset, snmpstatus, snmptable, snmptest, snmptrap, snmpdf, snmpusm , snmpwalk . The command line applications use the SNMP protocol to communicate with an SNMP capable network entity, an agent. Individual applications typically (but not necessarily) take additional parameters that are given after the agent specification. These parameters are documented in the manual pages for each application.

OPTIONS

-3[MmKk] 0xHEXKEY Sets the keys to be used for SNMPv3 transactions. These options allow you to set the master authentication and encryption keys (-3m and -3M respectively) or set the localized authentication and encryption keys (-3k and -3K respectively). SNMPv3 keys can be either passed in by hand using these flags, or by the use of keys generated from passwords using the -A and -X flags discussed below. For further details on SNMPv3 and its usage of keying information, see the Net-SNMP tutorial web site ( ). Overrides the defAuthMasterKey (-3m), defPrivMasterKey (-3M), defAuthLocalizedKey (-3k) or defPrivLocalizedKey (-3K) tokens, respectively, in the snmp.conf file, see snmp.conf(5). -aauthProtocol Set the authentication protocol (MD5 or SHA) used for authenticated SNMPv3 messages. Overrides the defAuthType token in the snmp.conf file. -AauthPassword Set the authentication pass phrase used for authenticated SNMPv3 messages. Overrides the defAuthPassphrase token in the snmp.conf file. It is insecure to specify pass phrases on the command line, see snmp.conf(5). -ccommunity Set the community string for SNMPv1/v2c transactions. Overrides the defCommunity token in the snmp.conf file. -d Dump (in hexadecimal) the raw SNMP packets sent and received. -DTOKEN[,...] Turn on debugging output for the given TOKEN(s). Try ALL for extremely verbose output. -eengineID Set the authoritative (security) engineID used for SNMPv3 REQUEST messages. It is typically not necessary to specify this, as it will usually be discovered automatically. -EengineID Set the context engineID used for SNMPv3 REQUEST messages scopedPdu. If not specified, this will default to the authoritative engineID. -h,--help Display a brief usage message and then exit. -H Display a list of configuration file directives understood by the command and then exit. -I[brRhu] Specifies input parsing options. See INPUTOPTIONS below. -lsecLevel Set the securityLevel used for SNMPv3 messages (noAuthNoPriv|authNoPriv|authPriv). Appropriate pass phrase(s) must provided when using any level higher than noAuthNoPriv. Overrides the defSecurityLevel token in the snmp.conf file. -L[eEfFoOsS] Specifies output logging options. See LOGGINGOPTIONS below. -mMIBLIST Specifies a colon separated list of MIB modules (not files) to load for this application. This overrides (or augments) the environment variable MIBS, the snmp.conf directive mibs, and the list of MIBs hardcoded into the Net-SNMP library. If MIBLIST has a leading ’-’ or ’+’ character, then the MIB modules listed are loaded in addition to the default list, coming before or after this list respectively. Otherwise, the specified MIBs are loaded instead of this default list. The special keyword ALL is used to load all MIB modules in the MIB directory search list. Every file whose name does not begin with "." will be parsed as if it were a MIB file. -MDIRLIST Specifies a colon separated list of directories to search for MIBs. This overrides (or augments) the environment variable MIBDIRS, the snmp.conf directive mibdirs, and the default directory hardcoded into the Net-SNMP library (/usr/share/snmp/mibs). If DIRLIST has a leading ’-’ or ’+’ character, then the given directories are added to the default list, being searched before or after the directories on this list respectively. Otherwise, the specified directories are searched instead of this default list. Note that the directories appearing later in the list have have precedence over earlier ones. To avoid searching any MIB directories, set the MIBDIRS environment variable to the empty string (""). Note that MIBs specified using the -m option or the mibs configuration directive will be loaded from one of the directories listed by the -M option (or equivalents). The mibfile directive takes a full path to the specified MIB file, so this does not need to be in the MIB directory search list. -ncontextName Set the contextName used for SNMPv3 messages. The default contextName is the empty string "". Overrides the defContext token in the snmp.conf file. -O[abeEfnqQsStTuUvxX] Specifies output printing options. See OUTPUTOPTIONS below. -P[cdeRuwW] Specifies MIB parsing options. See MIBPARSINGOPTIONS below. -rretries Specifies the number of retries to be used in the requests. The default is 5. -ttimeout Specifies the timeout in seconds between retries. The default is 1. -usecName Set the securityName used for authenticated SNMPv3 messages. Overrides the defSecurityName token in the snmp.conf file. -v1 | 2c | 3 Specifies the protocol version to use: 1 (RFCs 1155-1157), 2c (RFCs 1901-1908), or 3 (RFCs 2571-2574). The default is typically version 3. Overrides the defVersion token in the snmp.conf file. -V,--version Display version information for the application and then exit. -xprivProtocol Set the privacy protocol (DES or AES) used for encrypted SNMPv3 messages. Overrides the defPrivType token in the snmp.conf file. This option is only valid if the Net-SNMP software was build to use OpenSSL. -XprivPassword Set the privacy pass phrase used for encrypted SNMPv3 messages. Overrides the defPrivPassphrase token in the snmp.conf file. It is insecure to specify pass phrases on the command line, see snmp.conf(5). -Zboots,time Set the engineBoots and engineTime used for authenticated SNMPv3 messages. This will initialize the local notion of the agents boots/time with an authenticated value stored in the LCD. It is typically not necessary to specify this option, as these values will usually be discovered automatically. -Yname="value" --name="value" Allows to specify any token ("name") supported in the snmp.conf file and sets its value to "value". Overrides the corresponding token in the snmp.conf file. See snmp.conf(5) for the full list of tokens.