Implement SNMP

SNMP (Simple Network Management Protocol) consists of an application layer protocol and database schema. It used to control and monitor network devices with different manufacturers and models. With the rapid development of IoT (interest of things) technology, network management becomes a critical issue. SNMP provides a solution to monitor these network devices.

Quick Menu

Before burning the bin file into your EVB:

  1. Connect W5500 EVB to the router/NAT that you are using, or any other device that allows you to connect to internet
  2. Manually change the Network configuration:
    • Go to the definition of function set_default() (Should be inside device.c), make sure the subnet mask, local IP address, gateway and DNS are set according to the internet setting you are using with your router/NAT
  3. Rebuild the sample code and burn it into W5500EVB

Code Explanation

int main(void)

After boot or reboot W5500EVB, all necessary configurations are initialized.

    uint8 m=0;	
    printf("W5500 EVB initialization over.\r\n");
    printf("W5500 initialized!\r\n");  

These are all the 


There are the main loop of SNMP Demo.

        for ( m=0; m<10; m++)
            GPIO_SetBits(GPIOA, LED0);
            GPIO_ResetBits(GPIOA, LED0);

Main loop 
for SNMP Demo



void UserSnmpDemo(void)
    WDEBUG("\r\n\r\nStart UserSnmpDemo");
        dataEntryType enterprise_oid = {8, {0x2b, 6, 1, 4, 1, 0, 0x10, 0},
           SNMPDTYPE_OBJ_ID,8 ,{"\x2b\x06\x01\x04\x01\x00\x10\x00"},
           NULL, NULL};
        dataEntryType trap_oid1 = {8, {0x2b, 6, 1, 4, 1, 0, 11, 0}, 
           SNMPDTYPE_OCTET_STRING, 30, {""}, NULL, NULL};
        dataEntryType trap_oid2 = {8, {0x2b, 6, 1, 4, 1, 0, 12, 0}, 
           SNMPDTYPE_INTEGER, 4, {""}, NULL, NULL};
        strcpy((int8*)trap_oid1.u.octetstring, "Alert!!!");
        trap_oid2.u.intval = 123456;
        SnmpXTrapSend("", "", "public", 
           enterprise_oid, 1, 0, 0);
        SnmpXTrapSend("", "", "public", enterprise_oid, 
           6, 0, 2, &trap_oid1, &trap_oid2);

Test process

  1. Execute cmd.exe
  2. Enter cd \usr\bin to change the current directory
  3. Enter the following commands to test SNMP
Type Commands(E.g. IP address = Return
ReadDescription: read the status of LED (return String)
snmpget -v 1 -c public {IP address} .
E.g. snmpget -v 1 -c public .
-LED Off
Read Description: read the status of LED (return integer)
snmpget -v 1 -c public {IP address} .
E.g. snmpget -v 1 -c public .
-0: LED Off
-1: LED On
Write Description: set the status of LED
snmpset -v 1 -c public {IP address} . i {enable}
E.g.  Enable: snmpset -v 1 -c public . i 1
Disable: snmpset -v 1 -c public . i 0


  1. There are three version of SNMP, SNMP V1, SNMP V2C, SNMP V3. In this sample code, we demostrate the implementation of SNMP V1.
  2. Before this demostration, we need to install and configure SNMP service. (In window 10 computer, SNMP service is NOT installed. In window 7 computer, please install and enable SNMP in control panel.)
  3. For firewall port setting, please ensure the ports are open. The default UDP port for SNMP trap message is port 162.