The following code is an example configuration for a cisco device using SNMP (v2c) showing how to configure and access list, a an SNMP view, SNMP read-only access and read-write access. If you would prefer to use SNMP V3 see our guide here.
The first command in the code below allows creates an access list that includes any device from 192.168.1.X to connect to it via SNMP and names the list 42.
The configuration then creates a view of the SNMP tree named NMIS8RO that allows the whole tree (iso is the root) to be visible (this could be changed so only the ifTable was accessible, for example), a the community string NMISreadView is NMISreadView is then attached to the view NMIS8RO and added as read-only to the access list 42.
...
If read-write access is required you can use the next line, NMISwrite is configured as a it enables SNMP writes using NMISwrite as the community string that has full access to the snmp tree (no view given) when connecting from access list 42.
...