Menu

#39 SNMP.pm: specifiy source host IP address

open
nobody
None
2
2018-06-05
2002-09-02
No

When PC has multi NIC or multi Virtual IP,
I want to specify
source host IP address for the sake of routing based on source IP
address.

Example:
$sess = new SNMP::Session(

SrcHost => $srcip, <==== specific Source IP
address
DestHost => $destip,
Version =>
'2c',
StateCheck => true,
StateOID =>
'sysObjectID'
);

Could you tell me how to modify the
source.
Best Regards,
Masa

Discussion

  • Simon Leinen

    Simon Leinen - 2005-04-12

    Logged In: YES
    user_id=9208

    Any progress on this one? :-)

    We are now in a situation where we have to use a "logical"
    address as the source address in SNMP requests. Since our
    management machines have multiple physical addresses, this
    simplifies access lists and make life easier for some (brain
    damaged) devices where every IP address that is configured
    as a manager automatically receives all SNMP traps.

    MRTG and Cricket already support setting the source IP
    address (using ugly syntax, as always), but I cannot use
    Net-SNMP anymore on certain of our devices, which makes me
    sort of sad.
    --
    Simon.

     
  • Thomas Anders

    Thomas Anders - 2005-08-16

    Logged In: YES
    user_id=848638

    FYI: this is possible with the command-line apps through the
    "clientAddr" config token. Are you looking for a SNMP.pm
    solution only?

     
  • Simon Leinen

    Simon Leinen - 2005-08-18

    Logged In: YES
    user_id=9208

    For my own needs, the clientAddr option is sufficient.
    Thanks for pointing me to it! Unfortunately it isn't
    documented in the man page for snmp.conf(5) or any other man
    page.

    In general, I think there should be a way to specify the
    client address from the command line, and also on a
    target-by-target (or session-by-session) bases for APIs such
    as SNMP.pm.

     
  • Thomas Anders

    Thomas Anders - 2005-08-18

    Logged In: YES
    user_id=848638

    "clientAddr" has been added to the documentation recently
    and will appear in future releases. The wish to specify it
    through other means has been noted. I'm lowering priority,
    though.

     
  • Cory Steele

    Cory Steele - 2018-06-05

    Hi posting here to ask if it's possible / or if there can be a feature added to allow different snmp communities or destination snmp servers to source trap from different interface ip addresses?
    Let's say I have 1 network that's internal that has to hit SNMP servers out eth0 - i want it to source it from eth0 for those servers. Let's say I have eth1 and loopback1. I have an external SNMP server that I want to source the packet from loopback1, but go out eth1 with a route. Currently it will source it with eth1's ip address.

    Any advice?

     

Log in to post a comment.