Question:

What is the sample configuration for SNMPv2c?


Solution:


This article gives the sample configuration for snmpv2c, to use for both traps generation and running snmp agent to do snmp walk.

admin@Branch1-cli> show configuration snmp
agent {
    enabled;
    ip 127.0.0.1;
    udp-port 161;
    version {
        v1;
        v2c;
    }
    max-message-size 50000;
}
system {
    contact "";
    name Branch1;
    location "Bangalore,Bangalore,Bangalore,Karnataka, India 560035";
}
community admin {
    sec-name admin;
}
community kenji {
    sec-name kenji;
}
community public {
    sec-name public;
}
community sample {
    sec-name versa-private;
}
target admin-traps {
    ip 10.192.94.1;
    udp-port 162;
    tag [ std_v2_inform std_v2_trap ];
    timeout 1500;
    retries 3;
    v2c {
        sec-name admin;
    }
}
notify std_v1_trap {
    tag std_v1_trap;
    type trap;
}
notify std_v2_inform {
    tag std_v2_inform;
    type inform;
}
notify std_v2_trap {
    tag std_v2_trap;
    type trap;
}
notify std_v3_inform {
    tag std_v3_inform;
    type inform;
}
notify std_v3_trap {
    tag std_v3_trap;
    type trap;
}
target-source 10.192.94.6;
vacm {
    group all {
        member admin {
            sec-model [ v1 v2c ];
        }
        member kenji {
            sec-model [ v1 v2c ];
        }
        member public {
            sec-model [ v1 v2c ];
        }
        access any no-auth-no-priv {
            read-view internet;
            write-view internet;
            notify-view internet;
        }
    }
    view internet {
        subtree 1.2 {
            included;
        }
        subtree 1.3 {
            included;
        }
        subtree 1.3.1.2 {
            included;
        }
        subtree 1.3.6.1 {
            included;
        }
    }
}
[ok][2017-09-27 11:51:40]


Sample Traps for Interface Down

versa@ubuntu:~$ sudo tcpdump -i br0 "port 162"
[sudo] password for versa:
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on br0, link-type EN10MB (Ethernet), capture size 262144 bytes
11:37:36.855463 IP 10.192.94.6.50592 > 10.192.94.1.snmp-trap: C="admin" V2Trap(544) system.sysUpTime.0=16767762 S:1.1.4.1.0=E:42359.2.2.2.1.3.2.2 E:42359.2.2.2.3.1.2.0="interfaceDown" E:42359.2.2.2.3.1.3.0="system" E:42359.2.2.2.3.1.4.0="interfaceDown" E:42359.2.2.2.3.1.6.0="" E:42359.2.2.2.3.1.7.0=0 E:42359.2.2.2.3.1.8.0=5 E:42359.2.2.2.3.1.9.0=612 E:42359.2.2.2.3.1.11.0=07_e1_09_1b_0b_26_1e_00_2d_08_00 E:42359.2.2.2.3.1.12.0=6 E:42359.2.2.2.3.1.13.0=1 E:42359.2.2.2.3.1.14.0="Interface vni-0/0 is down (n/a)" E:42359.2.2.2.3.1.15.0="ServiceProvider-A" E:42359.2.2.2.1.3.1.2.0=2 E:42359.2.2.2.1.3.1.1.0=1064 E:42359.2.2.2.1.3.1.3.0=2 E:42359.2.2.2.1.3.1.4.0="" E:42359.2.2.2.3.1.15.0="ServiceProvider-A"
11:37:36.862193 IP 10.192.94.6.50592 > 10.192.94.1.snmp-trap: C="admin" Inform(544) system.sysUpTime.0=16767762 S:1.1.4.1.0=E:42359.2.2.2.1.3.2.2 E:42359.2.2.2.3.1.2.0="interfaceDown" E:42359.2.2.2.3.1.3.0="system" E:42359.2.2.2.3.1.4.0="interfaceDown" E:42359.2.2.2.3.1.6.0="" E:42359.2.2.2.3.1.7.0=0 E:42359.2.2.2.3.1.8.0=5 E:42359.2.2.2.3.1.9.0=612 E:42359.2.2.2.3.1.11.0=07_e1_09_1b_0b_26_1e_00_2d_08_00 E:42359.2.2.2.3.1.12.0=6 E:42359.2.2.2.3.1.13.0=1 E:42359.2.2.2.3.1.14.0="Interface vni-0/0 is down (n/a)" E:42359.2.2.2.3.1.15.0="ServiceProvider-A" E:42359.2.2.2.1.3.1.2.0=2 E:42359.2.2.2.1.3.1.1.0=1064 E:42359.2.2.2.1.3.1.3.0=2 E:42359.2.2.2.1.3.1.4.0="" E:42359.2.2.2.3.1.15.0="ServiceProvider-A"


Snmpwalk check

admin@Branch1-cli> show system load-stats
VSN CPU MEM LOAD
ID LOAD LOAD FACTOR
-------------------------
0 66 52 6


CPU

versa@ubuntu:~$ snmpwalk -v2c -c kenji 10.192.94.6 .1.3.6.1.4.1.42359.2.2.1.1.1.1.2.0
iso.3.6.1.4.1.42359.2.2.1.1.1.1.2.0 = Gauge32: 66
versa@ubuntu:~$ snmpwalk -v2c -c kenji 10.192.94.6 .1.3.6.1.4.1.42359.2.2.1.1.1.1.2.0
iso.3.6.1.4.1.42359.2.2.1.1.1.1.2.0 = Gauge32: 50
versa@ubuntu:~$


Memory

versa@ubuntu:~$ snmpwalk -v2c -c kenji 10.192.94.6 .1.3.6.1.4.1.42359.2.2.1.1.1.1.3.0
iso.3.6.1.4.1.42359.2.2.1.1.1.1.3.0 = Gauge32: 52
versa@ubuntu:~$ snmpwalk -v2c -c kenji 10.192.94.6 .1.3.6.1.4.1.42359.2.2.1.1.1.1.3.0
iso.3.6.1.4.1.42359.2.2.1.1.1.1.3.0 = Gauge32: 52