Using perl to create SNMP session towards local machine always use localport=161
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm using Net-SNMP 5.2.1.2 which have been built using ./configure
--prefix=<my path> --with-defaults --enable-shared --with-zlib
--with-openssl=<my path>
After installation I have built the perl SNMP modules which I'm then
trying to use to create a SNMP session towards my local machine on a
specified port.
I'm using the following code to test:
#!/usr/bin/perl -w
use SNMP;
$trapsink = new SNMP::Session(Version => '2c', DestHost => '0.0.0.0',
LocalPort => '1620');
if(defined $trapsink) {
print "Session created\n";
} else {
print "Could not create session\n";
}
It seem like my LocalPort parameter is ignored and instead it will try
to use 161 which will fail if Solaris snmpd is running (normally on 161)
or if I don't run my test as root. I need it to use the supplied
LocalPort and not default to 161.
Have anyone seen the same behaviour?
Have I missed some configuration?
This works in the old UCD-SNMP 4.2.5.
All tips would be useful.
/BR,
J