Enable SNMP and configure the community string/firewall on ESXi 6.0 or 6.5

1. SSH to host


  • SSH should be enabled. If not, enable it.

2. Set SNMP community string 

  • Enter the following command to set your string, replacing YOUR_COMM_STRING with your own.

1
esxcli system snmp set --communities RSAG

3. Enable SNMP service

  • Enter the following command to enable the SNMP service
1
esxcli system snmp set --enable true

4. Adjust firewall



A more secure approach would be to restrict access to a range of IPs or a particular host. In this case, we are only allowing 192.168.2.0/24 to poll SNMP.



1
2
3
esxcli network firewall ruleset set --ruleset-id snmp --allowed-all false
esxcli network firewall ruleset allowedip add --ruleset-id snmp --ip-address 192.168.2.0/24
esxcli network firewall ruleset set --ruleset-id snmp --enabled true


5. Restart SNMP service                                                                                                                                        


1
/etc/init.d/snmpd restart