Template:FAQ:Agent 22

From Net-SNMP Wiki
Revision as of 22:22, 22 October 2006 by Dts12 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Normally, the agent will bind to the specified port on all interfaces on the system, and accept request received from any of them. With version 4.2, the '-p' option can be used to listen on individual interfaces. For example,

                       snmpd -p 161@127.0.0.1

will listen (on the standard port) on the loopback interface only, and

                       snmpd -p 6161@10.0.0.1

will listen on port 6161, on the (internal network) interface with address 10.0.0.1. If you want to listen on multiple interfaces (but not all), then simply repeat this option for each one:

               snmpd -p 161@127.0.0.1 -p 6161@10.0.0.1

The v5 Net-SNMP agent has a similar facility, but does not use the '-p' command line option flag. Instead, the ports and/or interfaces to listen on are simply listed on the command line, following any other options. Also, the syntax of port and interface is slightly different (interface:port). So the three examples above would be

                       snmpd 127.0.0.1:161
                       snmpd 127.0.0.1:6161
                       snmpd 127.0.0.1:161 127.0.0.1:6161
                       

The AgentX port option ('-x') works in much the same way, using the "host:port" syntax (in both 4.2 and 5.0 lines - and yes, this is an inconsistency in 4.2!)