Re: [tkined] can not bind socket: address already in use

From: Erik Schoenfelder (schoenfr@gaertner.de)
Date: Tue Jun 05 2001 - 13:54:38 MET DST


Hi,

Jurkin> Sometimes, when I try to bind trap:
Jurkin> set sid [Tnm::snmp listener -version SNMPv2c] $sid bind trap {
Jurkin> . . . }
Jurkin> I receive a message:
Jurkin> can not bind socket: address already in use while executing
Jurkin> "$sid bind trap {

Jurkin> My questions are:

Jurkin> 1) Why this address is already in use - what is happend here?
Jurkin> (This also happend when I restart a computer and execute my
Jurkin> script with this lines for a first time after restarting.)

well, maybe another trapsink binds itself to this port. maybe it's a
bug in scotty or the nmtrapd.

Jurkin> 2) Is it possible to prevent this - how?
Jurkin> 3) Which address is already in use?
Jurkin> 4) Is it possible to check is this address already in use, and
Jurkin> if it is - to make it "free"?

netstat should help to check, if this port is allocated. ths port to
receive traps is udp:161

eg:

> root@chappell:lib 9 # netstat -an | grep 161
> udp 0 0 0.0.0.0:161 0.0.0.0:*
shows port 161 is allocated.

lsof is a nice tool (and free) to check which process is involved:

> root@chappell:lib 10 # lsof -i :162
> COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
> snmptrapd 226 root 4u IPv4 746 UDP *:snmp-trap

so here it is snmptrapd, a standalone trapsink (from the ucd snmp
tools to be exact ;-).

you may check also which additional snmp software is installed or look
for hint as simple as a grep through the init.d startup scripts about
`snmp' and `trap' words.

i hope this helps,
                                                        Erik

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.



This archive was generated by hypermail 2b29 : Thu Jan 03 2002 - 14:56:26 MET