[SNMP4J] Multiple UDP transport mappings

Ellis Corey Corey.Ellis at comverse.com
Tue Jul 21 14:24:32 CEST 2009


Hi Frank,

Attached is the relevant code, a subclass of SNMP class.  What we
originally did is add our transports to the MessageDispatcher -- in
declareSnmpTarget()

What see saw was on our multi-interface machine, was that the traps were
leaving the correct interface, but the from address of one of the traps
was not the ip address of the interface it left out of.

LINE 109:  localHsbnHostName =
System.getProperty("my.local.hsbn.hostname",
System.getProperty("my.hostname"));  
This property right here represents an hostname of HSBN interface

LINE 142:  localAdminHostName =
System.getProperty("my.local.admin.hostname", "upm_admin");
Represents the ADMIN interface

When traps go out on the admin interface it doesn't have the from
address correctly showing the admin interface.  The trap receiver on the
other side is looking for traps coming from a particular source ip, so
it's dropping the traps due to this.

What I am trying to figure out is how to ensure the correct source IP on
the trap.  I also thought the machine would select the right IP
depending on what interface the trap left out of, but I am running with
Linux OS, and this doesn't seem to be happening.

This is why I posted to the list to see if there was something wrong
with my logic.

Corey


-----Original Message-----
From: Frank Fock [mailto:fock at agentpp.com] 
Sent: Tuesday, July 21, 2009 3:42 AM
To: Ellis Corey
Cc: snmp4j at agentpp.org
Subject: Re: [SNMP4J] Multiple UDP transport mappings

Hi Corey,

If you use the same target for each send(..)
then you will receive the trap twice at that
target, of course.

I am now a bit confused about what you are trying
to accomplish. What is your goal?

If you send a trap via a TransportMapping it always
gets the from address from that interface (depending
on the OS in some cases). If you have used 0.0.0.0,
then the OS chooses the address. Otherwise, it will
be the address of the physical interface (not an alias).

Does if you want to control the from address, you
have a hard job. I would recommend, not using the
from address on the SNMP (application) level.

Best regards,
Frank

Ellis Corey wrote:
> Hi Frank,
> 
> So if I understand correctly and from looking at the code.  What I
have
> done is
> 
> 1. I have added just one transport mapping to the MessageDispatcher (I
> think this is required or can I not add a transport and always supply
> one)
> 2. In my logic where I actually call send() method from SNMP class, I
am
> passing using send(PDU, Target, Transport) call.
> 
> My question is (I hope I am right), when I use this send() method, the
> transport that was added in the MessageDispatcher will not be used.  
> So if I call send(PDU, Target, Transport) twice (once for each
> transport), then it will work.  What I am afraid of is duplicate traps
> being sent.
> This won't occur right?
> 
> Thanks again for the quick response.
> 
> Corey
> 
> -----Original Message-----
> From: Frank Fock [mailto:fock at agentpp.com] 
> Sent: Monday, July 20, 2009 7:36 PM
> To: Ellis Corey
> Cc: snmp4j at agentpp.org
> Subject: Re: [SNMP4J] Multiple UDP transport mappings
> 
> Hi Ellis,
> 
> When using several UDP (or TCP) transport mappings
> you should make sure, that you use only the Snmp
> methods that take the transport mapping as parameter.
> Then you can choose the mapping you want to use.
> 
> The default NotificationOriginator however, will not
> distinguish between those mappings. You will have
> to write your own NotificationOriginator to choose
> the transport mapping according to some self defined
> rules.
> 
> Best regards,
> Frank
> 
> 
> Ellis Corey wrote:
>> Hi,
>>
>>  
>>
>> I have setup multiple transport mappings for the purpose of sending
> out
>> traps over multiple interfaces.  Everything is working fine, accept
> that
>> the source ip of my trap that is going out of one interface is using
> the
>> ip address of another interface.
>>
>>  
>>
>> Example of what is occurring.  My machine has two interfaces (admin
> and
>> hsbn)
>>
>>  
>>
>> Admin = 10.1.1.1
>>
>> HSBN = 10.2.2.2
>>
>>  
>>
>> When I send out a trap it goes out on both interfaces, but the trap
>> going out of the admin network has source ip of 10.2.2.2 instead of
>> 10.1.1.1
>>
>>  
>>
>> I am building my UdpAddress(adminIP, port), I was expecting that the
> IP
>> I define in the UdpAddress will be the one that is used as the source
> ip
>> when the trap is sent, but it seems like this is not the case.
>>
>>  
>>
>> Any ideas, how I can control the source IP when sending out the trap
>> over multiple interfaces.
>>
>>  
>>
>> Corey Ellis
>> Engineering Development Manager
>>
>> OA&M and Security, Billing
>> Comverse
>> Office: 856-608-2580
>>
>> Mobile: 609-319-6513
>>
>>  
>>
>> _______________________________________________
>> SNMP4J mailing list
>> SNMP4J at agentpp.org
>> http://lists.agentpp.org/mailman/listinfo/snmp4j
> 

-- 
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com



More information about the SNMP4J mailing list