[SNMP4J] Send Response PDU fails

siva kumar sivi299 at gmail.com
Fri Jan 10 06:30:29 CET 2014


Hi,
I am trying to simulate an SNMPv3 agent on Centos using snmp4j
version 1.11.2  (java 1.6). The code mailed in the previous conversation
listens for snmprequests. In that code i generate engineID using (MPv3)snmp.
getMessageProcessingModel(MessageProcessingModel.MPv3)).getLocalEngineID().

Snmprequest is issued using net-snmp command

snmpget -v 3 -n "" -u "MD5DES" -a MD5 -A "MD5DESUserAuthPassword" -x DES -X
"MD5DESUserPrivPassword" -l authPriv udp6:[2607:f0d0:1002:11::6]:161
1.3.6.1.2.1.1.1.0


Thanks
Siva


On Fri, Jan 10, 2014 at 3:53 AM, Frank Fock <fock at agentpp.com> wrote:

> Hi,
>
> Could you please explain what you are trying to accomplish?
> What process sends which message to what entity?
> Which software products and versions are involved?
> What are the engine IDs of command generator and responder?
>
> Best regards,
> Frank
>
> Am 09.01.2014 10:19, schrieb siva kumar:
>
>  Hi,
>>
>> I tried creating an SNMP agent
>>
>> The following is the listener code
>>
>>              Snmp snmp = new Snmp( new MessageDispatcherImpl() );
>>              // Add message processing models to be supported
>>              snmp.getMessageDispatcher().addMessageProcessingModel( new
>> MPv1() );
>>              snmp.getMessageDispatcher().addMessageProcessingModel( new
>> MPv2c() );
>>              snmp.getMessageDispatcher().addMessageProcessingModel( new
>> MPv3() );
>>              engineId = new
>> OctetString(((MPv3)snmp.getMessageProcessingModel(
>> MessageProcessingModel.MPv3)
>> ).getLocalEngineID());
>>              USM usm = new USM(SecurityProtocols.getInstance(), engineId
>> ,
>> 0);
>>              SecurityModels.getInstance().addSecurityModel(usm);
>>              SecurityProtocols.getInstance().addDefaultProtocols();
>>              snmp.addTransportMapping( transport );
>>              snmp.addCommandResponder( subAgent );
>>              UsmUser user = new UsmUser(new OctetString("MD5DES"),AuthMD5.
>> ID,
>>                                       new
>> OctetString("MD5DESUserAuthPassword"),
>>                                       PrivDES.ID,
>>                                       new
>> OctetString("MD5DESUserPrivPassword"));
>>              snmp.getUSM().addUser(new OctetString("MD5DES"), user);
>>              subAgent.setSnmp( snmp );
>>
>>              if( ! transport.isListening() )
>>                  transport.listen();
>>
>> Send code
>>
>>            ScopedPDU pdu3 = new ScopedPDU();
>>          pdu3.setType(PDU.GET);
>>          pdu3.setMaxRepetitions(50);
>>          // Get ifNumber only once
>>          pdu3.setNonRepeaters(1);
>>          // set context non-default context (default context does not need
>> to be set)
>>          pdu3.setContextName(new OctetString("contextA"));
>>          pdu3.setContextEngineID(new
>> OctetString(((MPv3)snmp.getMessageProcessingModel(
>> MessageProcessingModel.MPv3)).getLocalEngineID()));
>>          // Added a few varbinds
>>
>>           UserTarget target = new UserTarget();
>>           target.setAddress(targetq.getAddress());
>>           target.setRetries(1);
>>           target.setTimeout(5000);
>>           target.setVersion(SnmpConstants.version3);
>>           target.setSecurityLevel(SecurityLevel.AUTH_PRIV);
>>           target.setSecurityName(new OctetString("MD5DES"));
>>
>>           snmp.send(pdu3, target );
>>
>>
>> When i enabled trace on snmp4j i got the following information
>>
>> [org.snmp4j.mp.MPv3] (pool-8-thread-1) SNMPv3 header decoded:
>> msgId=121143980, msgMaxSize=65487, msgFlags=04, secModel=3
>> [org.snmp4j.security.USM] (pool-8-thread-1) RFC3414 §3.2.3 Unknown engine
>> ID:
>> [org.snmp4j.mp.MPv3] (pool-8-thread-1) Adding cache entry:
>> StateReference[msgID=121143980,pduHandle=PduHandle[
>> 507258884],securityEngineID=,securityModel=org.snmp4j.
>> security.USM at 3fe2670b
>> ,securityName=,securityLevel=1,contextEngineID=,contextName=]
>> [org.snmp4j.mp.MPv3] (pool-8-thread-1) Removed cache entry:
>> StateReference[msgID=121143980,pduHandle=PduHandle[
>> 507258884],securityEngineID=,securityModel=org.snmp4j.
>> security.USM at 3fe2670b
>> ,securityName=,securityLevel=1,contextEngineID=,contextName=]
>> [org.snmp4j.security.USM] (pool-8-thread-1) RFC3414 §3.1.4.b Outgoing
>> message is not encrypted
>> [org.snmp4j.MessageDispatcherImpl] (pool-8-thread-1)
>> 1.3.6.1.6.3.15.1.1.4.0
>> = 0
>> [org.snmp4j.mp.MPv3] (pool-8-thread-1) SNMPv3 header decoded:
>> msgId=121143979, msgMaxSize=65487, msgFlags=07, secModel=3
>> [org.snmp4j.security.USM] (pool-8-thread-1)
>> getUser(engineID=80:00:13:70:01:ac:1f:00:6f, securityName=MD5DES)
>> [org.snmp4j.security.UsmTimeTable] (pool-8-thread-1) CheckTime: time ok
>> (authorative)
>> [org.snmp4j.mp.MPv3] (pool-8-thread-1) RFC3412 §7.2.10 - Received PDU is
>> NOT a response or internal class message -> unchanged PduHandle =
>> PduHandle[756210224]
>> [org.snmp4j.mp.MPv3] (pool-8-thread-1) Adding cache entry:
>> StateReference[msgID=121143979,pduHandle=PduHandle[
>> 756210224],securityEngineID=80:00:13:70:01:ac:1f:00:6f,
>> securityModel=org.snmp4j.security.USM at 3fe2670b
>> ,securityName=MD5DES,securityLevel=3,contextEngineID=80:00:13:70:
>> 01:ac:1f:00:6f,contextName=]
>> [org.snmp4j.Snmp] (pool-8-thread-1) Fire process PDU event:
>> CommandResponderEvent[transportMapping=ExtendedUdpTransportMapping[
>> 2607:f0d0:1002:11:0:0:0:6/161]peerAddress=2607:f0d0:1002:11:
>> 0:0:0:6/51547,
>> processed=false, pdu=[GET[reqestID=756210224, errorStatus=0, errorIndex=0,
>> VBS[1.3.6.1.2.1.1.1.0 = Null]]], securityName=MD5DES, securityModel=3,
>> securityLevel=3]
>> [centina.tools.simulation.snmp.agent.SnmpSubAgent] (pool-8-thread-1)
>> SUB-AGENT: 2607:f0d0:1002:11:0:0:0:6/161:: Received event
>> L:2607:f0d0:1002:11:0:0:0:6/161; P:2607:f0d0:1002:11:0:0:0:6/51547;
>> PDU:GET[reqestID=756210224, errorStatus=0, errorIndex=0,
>> VBS[1.3.6.1.2.1.1.1.0 = Null]];A:2607:f0d0:1002:11:0:0:0:6/51547;
>> [centina.tools.simulation.snmp.agent.SnmpSubAgent] (pool-4-thread-7)
>> Response  RESPONSE[reqestID=756210224, errorStatus=0, errorIndex=0,
>> VBS[1.3.6.1.2.1.1.1.0 = ExtremeXOS version 12.3.1.2 v1231b2 by
>> release-manager on Thu Jun 18 21:56:40 PDT 2009]]
>> [centina.tools.simulation.snmp.agent.SnmpMasterAgent] (pool-4-thread-7)
>> SUB-AGENT: Executed Request in 2 ms
>> [centina.tools.simulation.snmp.agent.SnmpMasterAgent] (pool-5-thread-7)
>> EngineId  80:00:13:70:01:ac:1f:00:6f
>> [centina.tools.simulation.snmp.agent.SnmpMasterAgent] (pool-5-thread-7)
>> @@Resp   80:00:13:70:01:ac:1f:00:6f  -    GETBULK[reqestID=0,
>> errorStatus=1, errorIndex=50, VBS[1.3.6.1.2.1.1.1.0 = ExtremeXOS version
>> 12.3.1.2 v1231b2 by release-manager on Thu Jun 18 21:56:40 PDT 2009]]
>> [org.snmp4j.security.USM] (pool-5-thread-7) RFC3414 §3.1.4.b Outgoing
>> message is not encrypted
>> [org.snmp4j.mp.MPv3] (pool-5-thread-7) Adding cache entry:
>> StateReference[msgID=1588426278,pduHandle=PduHandle[507258886],
>> securityEngineID=,securityModel=org.snmp4j.security.USM at 3fe2670b
>> ,securityName=MD5DES,securityLevel=1,contextEngineID=80:00:13:70:
>> 01:ac:1f:00:6f,contextName=contextA]
>> [org.snmp4j.Snmp] (pool-5-thread-7) Running pending sync request with
>> handle PduHandle[507258886] and retry count left 1
>> [org.snmp4j.security.USM] (Timer-0) RFC3414 §3.1.4.b Outgoing message is
>> not encrypted
>> [org.snmp4j.mp.MPv3] (Timer-0) Adding cache entry:
>> StateReference[msgID=1588426279,pduHandle=PduHandle[507258886],
>> securityEngineID=,securityModel=org.snmp4j.security.USM at 3fe2670b
>> ,securityName=MD5DES,securityLevel=1,contextEngineID=80:00:13:70:
>> 01:ac:1f:00:6f,contextName=contextA]
>> [org.snmp4j.Snmp] (Timer-0) Running pending sync request with handle
>> PduHandle[507258886] and retry count left 0
>> [org.snmp4j.Snmp] (Timer-0) Request timed out: 507258886
>> [org.snmp4j.Snmp] (pool-5-thread-7) Removed pending request with handle:
>> PduHandle[507258886]
>> [centina.tools.simulation.snmp.agent.SnmpMasterAgent] (pool-5-thread-7)
>> SUB-AGENT: TIMEOUT: Time taken 10003 ms greater than 2000 ms
>> [centina.tools.simulation.snmp.ProfileManager] (Profile Timer) Scanning
>> for
>> and deploying any profile changes
>> [centina.tools.simulation.snmp.ProfileManager] (Profile Timer)
>> Descriptors:
>> [extreme-summit-x450]
>>
>>
>> I get a
>> Timeout: No Response from udp6:[2607:f0d0:1002:11::6]:161
>>
>> when i perform a snmpget. Could someone please help me with this?
>>
>>
> --
> ---
> AGENT++
> Maximilian-Kolbe-Str. 10
> 73257 Koengen, Germany
> https://agentpp.com
> Phone: +49 7024 8688230
> Fax:   +49 7024 8688231
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j
>



-- 
Regards
Siva



More information about the SNMP4J mailing list