I thought I'd write down the recipe for enabling snmp on Ubuntu. Much the same instructions also work for RedHat.
First ensure that the packages snmp and snmpd are both installed. Login as root via ssh to the machine you need to configure, and then:
apt-get install snmp and
apt-get install snmpd
Follow the usual prompts to get it installed then
- From the text-menus choose to load "none" of the existing snmpd.conf files.
- Choose option 1: snmpd.conf as the file to create
- Select the option "Access Control Setup" (the number varies)
- Choose option 3: "a SNMPv1/SNMPv2c read-only access community name"
- In answer to the first prompt type "public".
- In response to the request to specify a host address to accept this community name just hit return
- In response to the OID request just hit return.
- Then type "finished", "finished" and "quit"
- Copy the resulting snmpd.conf in the current directory to /etc/snmp/, overwriting what is there.
- Edit the file /etc/default/snmpd. At the end of the line saying SNMPDOPTS remove the " 127.0.0.1". This step is not required on RedHat.
- Save the file and restart the snmp daemon:
service snmpd restart. If you haven't got the service command install the sysvconfig package or just type:
/etc/init.d/snmpd restart(same thing)
- Test the snmp service:
snmpwalk -c public -v2c localhost. You should get a sizeable chunk of responses, several pages worth. If only one page then your snmpd.conf file is not installed or mucked up or overridden by something else.
- Also test from another machine that can access the snmp server you just set up.
snmpwalk -c public -v2c <snmp-host-ip-address>. You should get the same output. If it hangs, then you failed to remove the "127.0.0.1" from the snmpd file above.