1. Install package download
http://net-snmp.sourceforge.com
Version 5.1.1
Install the host
FreeBSD4.5
IP: 192.168.0.70
Domain name: freebsd.nanjing-fnst.com
Other: OpenSSL needs
2. Install NET-SNMP
#TAR -ZXVF NET-SNMP-5.1.1.tar.gz
3. Patches patch
[1] agent / mibgroup / mibii / TCPTable.c
720 lines
#if 0 / * Replaced by Zhangfl 2004.02.26 - Start - * /
NNEW-> State = StateMap [(Struct XINPCB *) XIG) -> XT_TP.T_STATE];
IF (nnew-> state == 5 / * established * / ||
NNEW-> State == 8 / * closewait * /)
TCP_ESTAB ;
Memcpy (& (NNEW-> PCB), & ((struct xinpcb *) XIG) -> XT_INP),
SIZEOF (STRUCT INPCB));
#ELSE
#if Defined (__ freebsd__)
Memcpy (& (NNEW-> PCB), & ((struct xinpcb *) XIG) -> xi_inp),
SIZEOF (STRUCT INPCB));
#ELSE
NNEW-> State = StateMap [(Struct XINPCB *) XIG) -> XT_TP.T_STATE];
IF (nnew-> state == 5 / * established * / ||
NNEW-> State == 8 / * closewait * /)
TCP_ESTAB ;
Memcpy (& (NNEW-> PCB), & ((struct xinpcb *) XIG) -> XT_INP),
SIZEOF (STRUCT INPCB));
#ENDIF
#ENDIF / * REPLAced by Zhangfl 2004.02.26 - end - * /
[2] Agent / Mibgroup / MIBII / UDPTABLE.C
#if 1 / * Added by Zhangfl 2004.02.26 -Start- * /
#if Defined (__ freebsd__)
#undef INP_NEXT_SYMBOL
#define INP_NEXT_SYMBOL INP_NEXT
#ENDIF
#ENDIF / * Added by Zhangfl 2004.02.26 - End - * /
UDPTABLE_NEXT_ENTRY ()
{
...
#if 0 / * Replaced by Zhangfl 2004.02.26 - Start - * /
* loop_context = (void *) Entry-> INP_NEXT_SYMBOL;
#ELSE
* loop_context = list_next (entry, INP_LIST);
#ENDIF / * REPLAced by Zhangfl 2004.02.26 - end - * /
...
}
UDPTable_Free ()
{
...
#if 0 / * Replaced by Zhangfl 2004.02.26 - Start - * /
UDP_HEAD = UDP_HEAD-> INP_NEXT_SYMBOL;
#ELSE
UDP_HEAD = List_next (udp_head, input);
#ENDIF / * REPLAced by Zhangfl 2004.02.26 - end - * /
...
}
UDPTABLE_LOAD ()
{
...
#if 0 / * Replaced by Zhangfl 2004.02.26 - Start - * /
Memcpy (nnew, (struct xinpcb *) XIG) -> xi_inp, sizeof (struct inpcb));
nnew-> next = udp_head; / * xxx - ?? check 'next' Pointer * /
#ELSE
Memcpy (NNEW, & ((Struct XInpcb *) XIG) -> xi_inp),
SIZEOF (STRUCT INPCB));
List_next (nnew, inv_list) = udp_head;
# Endif / * Replaced by Zhangfl 2004.02.26 - End - * /
...
}
#CD NET-SNMP-5.1.1
#. / configure --enable-ipv6 --with-perl-modules --with-mib-modules = "suizu"
*** Default SNMP Version:
Starting with Net-SNMP 5.0, You Can Choose The Default Version of
THE SNMP Protocol To Usehen no version is given evlicitly on the
Command line, or via an 'snmp.conf' file. in The Past this Was Set To
SNMPv1, but you can use this to switch to snmpv3 if desired. SNMPv3
Will Provide a More Secure Management Environment (and thus you're)
Encouraged to Switch To SNMPv3), But May Break EXISTING SCRIPTS THAT
Rely on the old behaviour. (THOUGH SUCH SCRIPTS WILL PROBABLY NEED TO
Be changed to use the '-c' community flag anyway, as the snmpv1
Command Line Usage Has Changed AS Well.).
At this prompt you can select "1", "2" (for snmpv2c), or "3" AS
The Default Version for the Command Tools (SNMPGET, ...) To Use. this
Can Always Be Overridden At Runtime Using The -v Flag To The Tools, OR
By Using the "defversion" token in your snmp.conf file.
Providing the --with-default-snmp-version = "x" parameter to ./configure
Will Avoid this prompt.
Default Version of SNMP To Use (3): Enter
*** SYSTEM Contact Information:
Describes who shouth be contacted about the host the agent is
Running on. This Information is available in the mib-ii tree. this
Can Also Be over-ridden using the "syscontact" Syntax in the agent's
Configuration FILES.
Providing the --with-sys-contact = "contact" parameter to ./configure
Will Avoid this prompt.
System contact information (root@nanjing-fnst.com): Root@freebsd.nanjing-fnst.com Enter
*** SYSTEM LOCATION:
Describes the location of the system. This information is
Available in the mib-ii tree. this can also be over-ridden using the
"syslocation" syntax in the agent's configuration files.
Providing the --with-sys-location = "location" parameter to ./configure
Will Avoid this prompt.
System Location (Unknown): Enter
*** logfile location:
ENTER THE Default Location for the SNMPD Agent to Dump
Information & Errors to. if not defined (Enter the keyword "none"
At the prompt bellow) The agent will use stdout and stderr instead.
(NOTE: THIS value can be over-ridden using command line options.)
Providing the --with-logfile = "path" parameter to ./configure
Will Avoid this prompt.
Location to write logfile (/VAR/LOG/SNMPD.LOG): Enter
*** SNMPD PERSISITENT Storage Location:
ENTER A Directory for the SNMP Library to Store Persistent
Data in the form of a configuration file. this default location is
Different Than The Old Default Location (Which Was for UCD-SNMP). IF
You Stay with the new path, I'll ask you in a second if you wish To
Copy your file over to the new location (onCen ". if you pick
.
.............. ..
Providing the --with-persistent-directory = "path" parameter to
./configure will avoid this prompt.
Location to write penustent information: Enter
#make
#make install
4. If you need to install the snmp.pm perl module
#CD NET-SNMP / Perl
#Perl makefile.pl -net-snmp-config = "sh ../../net-snmp-config" -Net-snmp-in-source = true
#make
#make test
#make install