blob: 0918a462f9ba12eb31d6498b8b448a515a42cfff [file] [log] [blame]
paul76b89b42004-11-06 17:13:09 +00001@node SNMP Support
paul718e3742002-12-13 20:15:29 +00002@chapter SNMP Support
3
paula3957e32005-11-04 12:48:25 +00004@acronym{SNMP,Simple Network Managing Protocol} is a widely implemented
5feature for collecting network information from router and/or host.
6Quagga itself does not support SNMP agent (server daemon) functionality
7but is able to connect to a SNMP agent using the SMUX protocol
Vincent Bernat0ff4b9c2012-05-25 12:04:51 +02008(@cite{RFC1227}) or the AgentX protocol (@cite{RFC2741}) and make the
9routing protocol MIBs available through it.
paul718e3742002-12-13 20:15:29 +000010
11@menu
pauld191eba2004-07-31 15:15:39 +000012* Getting and installing an SNMP agent::
Vincent Bernat0ff4b9c2012-05-25 12:04:51 +020013* AgentX configuration::
pauld191eba2004-07-31 15:15:39 +000014* SMUX configuration::
15* MIB and command reference::
paula3957e32005-11-04 12:48:25 +000016* Handling SNMP Traps::
paul718e3742002-12-13 20:15:29 +000017@end menu
18
paul76b89b42004-11-06 17:13:09 +000019@node Getting and installing an SNMP agent
pauld191eba2004-07-31 15:15:39 +000020@section Getting and installing an SNMP agent
paul718e3742002-12-13 20:15:29 +000021
Vincent Bernat0ff4b9c2012-05-25 12:04:51 +020022There are several SNMP agent which support SMUX or AgentX. We recommend to use the latest
pauld191eba2004-07-31 15:15:39 +000023version of @code{net-snmp} which was formerly known as @code{ucd-snmp}.
paul76b89b42004-11-06 17:13:09 +000024It is free and open software and available at @uref{http://www.net-snmp.org/}
pauld191eba2004-07-31 15:15:39 +000025and as binary package for most Linux distributions.
Vincent Bernat0ff4b9c2012-05-25 12:04:51 +020026@code{net-snmp} has to be compiled with @code{--with-mib-modules=agentx} to
27be able to accept connections from Quagga using AgentX protocol or with
28@code{--with-mib-modules=smux} to use SMUX protocol.
29
30Nowadays, SMUX is a legacy protocol. The AgentX protocol should be
31preferred for any new deployment. Both protocols have the same coverage.
32
33@node AgentX configuration
34@section AgentX configuration
35
36To enable AgentX protocol support, Quagga must have been build with the
37@code{--enable-snmp} or @code{--enable-snmp=agentx} option. Both the
38master SNMP agent (snmpd) and each of the Quagga daemons must be
39configured. In @code{/etc/snmp/snmpd.conf}, @code{master agentx}
40directive should be added. In each of the Quagga daemons, @code{agentx}
41command will enable AgentX support.
42
43@example
44/etc/snmp/snmpd.conf:
45 #
46 # example access restrictions setup
47 #
48 com2sec readonly default public
49 group MyROGroup v1 readonly
50 view all included .1 80
51 access MyROGroup "" any noauth exact all none none
52 #
53 # enable master agent for AgentX subagents
54 #
55 master agentx
56
57/etc/quagga/ospfd.conf:
58 ! ... the rest of ospfd.conf has been omitted for clarity ...
59 !
60 agentx
61 !
62@end example
63
64Upon successful connection, you should get something like this in the
65log of each Quagga daemons:
66
67@example
682012/05/25 11:39:08 ZEBRA: snmp[info]: NET-SNMP version 5.4.3 AgentX subagent connected
69@end example
70
71Then, you can use the following command to check everything works as expected:
72
73@example
74# snmpwalk -c public -v1 localhost .1.3.6.1.2.1.14.1.1
75OSPF-MIB::ospfRouterId.0 = IpAddress: 192.168.42.109
76[...]
77@end example
78
79The AgentX protocol can be transported over a Unix socket or using TCP
80or UDP. It usually defaults to a Unix socket and depends on how NetSNMP
81was built. If need to configure Quagga to use another transport, you can
82configure it through @code{/etc/snmp/quagga.conf}:
83
84@example
85/etc/snmp/quagga.conf:
86 [snmpd]
87 # Use a remote master agent
88 agentXSocket tcp:192.168.15.12:705
89@end example
paul718e3742002-12-13 20:15:29 +000090
paul76b89b42004-11-06 17:13:09 +000091@node SMUX configuration
paul718e3742002-12-13 20:15:29 +000092@section SMUX configuration
93
pauld191eba2004-07-31 15:15:39 +000094To enable SMUX protocol support, Quagga must have been build with the
Vincent Bernat0ff4b9c2012-05-25 12:04:51 +020095@code{--enable-snmp=smux} option.
paul718e3742002-12-13 20:15:29 +000096
Vincent Bernat0ff4b9c2012-05-25 12:04:51 +020097A separate connection has then to be established between the
paula3957e32005-11-04 12:48:25 +000098SNMP agent (snmpd) and each of the Quagga daemons. This connections
99each use different OID numbers and passwords. Be aware that this OID
100number is not the one that is used in queries by clients, it is solely
101used for the intercommunication of the daemons.
pauld191eba2004-07-31 15:15:39 +0000102
paula3957e32005-11-04 12:48:25 +0000103In the following example the ospfd daemon will be connected to the
104snmpd daemon using the password "quagga_ospfd". For testing it is
105recommending to take exactly the below snmpd.conf as wrong access
106restrictions can be hard to debug.
pauld191eba2004-07-31 15:15:39 +0000107
108@example
109/etc/snmp/snmpd.conf:
110 #
111 # example access restrictions setup
112 #
113 com2sec readonly default public
114 group MyROGroup v1 readonly
115 view all included .1 80
116 access MyROGroup "" any noauth exact all none none
117 #
118 # the following line is relevant for Quagga
119 #
120 smuxpeer .1.3.6.1.4.1.3317.1.2.5 quagga_ospfd
121
122/etc/quagga/ospf:
123 ! ... the rest of ospfd.conf has been omitted for clarity ...
124 !
125 smux peer .1.3.6.1.4.1.3317.1.2.5 quagga_ospfd
126 !
127@end example
128
129After restarting snmpd and quagga, a successful connection can be verified in
130the syslog and by querying the SNMP daemon:
131
132@example
133snmpd[12300]: [smux_accept] accepted fd 12 from 127.0.0.1:36255
134snmpd[12300]: accepted smux peer: \
135 oid GNOME-PRODUCT-ZEBRA-MIB::ospfd, quagga-0.96.5
136
137# snmpwalk -c public -v1 localhost .1.3.6.1.2.1.14.1.1
138OSPF-MIB::ospfRouterId.0 = IpAddress: 192.168.42.109
139@end example
140
141Be warned that the current version (5.1.1) of the Net-SNMP daemon writes a line
142for every SNMP connect to the syslog which can lead to enormous log file sizes.
143If that is a problem you should consider to patch snmpd and comment out the
144troublesome @code{snmp_log()} line in the function
145@code{netsnmp_agent_check_packet()} in @code{agent/snmp_agent.c}.
146
paul76b89b42004-11-06 17:13:09 +0000147@node MIB and command reference
pauld191eba2004-07-31 15:15:39 +0000148@section MIB and command reference
149
150The following OID numbers are used for the interprocess communication of snmpd and
Vincent Bernat0ff4b9c2012-05-25 12:04:51 +0200151the Quagga daemons with SMUX only.
pauld191eba2004-07-31 15:15:39 +0000152@example
153 (OIDs below .iso.org.dod.internet.private.enterprises)
hasso54aa6b22004-10-12 06:05:34 +0000154zebra .1.3.6.1.4.1.3317.1.2.1 .gnome.gnomeProducts.zebra.zserv
155bgpd .1.3.6.1.4.1.3317.1.2.2 .gnome.gnomeProducts.zebra.bgpd
156ripd .1.3.6.1.4.1.3317.1.2.3 .gnome.gnomeProducts.zebra.ripd
157ospfd .1.3.6.1.4.1.3317.1.2.5 .gnome.gnomeProducts.zebra.ospfd
158ospf6d .1.3.6.1.4.1.3317.1.2.6 .gnome.gnomeProducts.zebra.ospf6d
pauld191eba2004-07-31 15:15:39 +0000159@end example
160
Vincent Bernat0ff4b9c2012-05-25 12:04:51 +0200161Sadly, SNMP has not been implemented in all daemons yet. The following
162OID numbers are used for querying the SNMP daemon by a client:
pauld191eba2004-07-31 15:15:39 +0000163@example
hasso54aa6b22004-10-12 06:05:34 +0000164zebra .1.3.6.1.2.1.4.24 .iso.org.dot.internet.mgmt.mib-2.ip.ipForward
165ospfd .1.3.6.1.2.1.14 .iso.org.dot.internet.mgmt.mib-2.ospf
166bgpd .1.3.6.1.2.1.15 .iso.org.dot.internet.mgmt.mib-2.bgp
167ripd .1.3.6.1.2.1.23 .iso.org.dot.internet.mgmt.mib-2.rip2
168ospf6d .1.3.6.1.3.102 .iso.org.dod.internet.experimental.ospfv3
pauld191eba2004-07-31 15:15:39 +0000169@end example
170
Vincent Bernat0ff4b9c2012-05-25 12:04:51 +0200171The following syntax is understood by the Quagga daemons for configuring SNMP using SMUX:
paul718e3742002-12-13 20:15:29 +0000172@deffn {Command} {smux peer @var{oid}} {}
173@deffnx {Command} {no smux peer @var{oid}} {}
174@end deffn
175
176@deffn {Command} {smux peer @var{oid} @var{password}} {}
177@deffnx {Command} {no smux peer @var{oid} @var{password}} {}
178@end deffn
paula3957e32005-11-04 12:48:25 +0000179
Vincent Bernat0ff4b9c2012-05-25 12:04:51 +0200180Here is the syntax for using AgentX:
181@deffn {Command} {agentx} {}
182@deffnx {Command} {no agentx} {}
183@end deffn
184
paula3957e32005-11-04 12:48:25 +0000185@include snmptrap.texi