How to configure static MAC via SNMP?

Steven_zhangCreated at:Dec 11, 2019 13:02:44Updated at:Dec 11, 2019 13:03:07

This article uses ECS4100-28T for the example.

Step 1:

Setting the static MAC address (40-16-7e-66-a4-36) on port 7.

snmpset -v 2c -c private 192.168.1.1 .1.3.6.1.2.1.17.7.1.3.1.1.3.1.64.22.126.102.164.53.0 x 02

64.22.126.102.164.53 = 40-16-7e-66-a4-36

Those value means the MAC address which you want to set and MAC address need be converted from Hexadecimal to Decimal.

Hexadecimal->Decimal
40->64
16->22
7e->126

"x" means octets.

"02" means port 7. 

- Here's the way to calculate the value.

Please see this form to understand how to specify the value for port number.

mceclip0.png

- If you want to set the port 1, then the value is 80.

mceclip1.png

Note:

You cannot use single digit, ex: "x 8" in the end, it will fail. 

mceclip0.png

The correct value of port 1 should be double digits, ex: "x 80".

mceclip1.png

 

Here's another example.

- If you want to set the port 10, the value is 0040.mceclip2.png

Step 2:

Setting the static MAC address type.

snmpset -v 2c -c private 192.168.1.1 .1.3.6.1.2.1.17.7.1.3.1.1.4.1.64.22.126.102.164.53.0 i 3

"i" means integer32.

"3" means type 3. 

- There are five types for this value, Edgecore switch supported two types.

permanent(3)

deleteOnReset(4)

mceclip1.png

Here's the Result:

We can see the MAC address which be configured to MAC table via SNMP successfully. 

mceclip0.png