D-Link DGS-3024 password reset

The DGS-3024 does not have a built-in reset function that resets the password, but here’s how you can do it (without contacting the D-Link support).

First, you need to reset the switch to its default settings. This will not touch the user accounts on the switch. It will, however, reset other settings, most importantly the IP address to the defaults (10.90.90.90/24). To reset to default settings, boot the switch and wait until

  Please wait, loading runtime image ...................... XX%

is displayed on the serial console, then press Shift-3. After that, press y when asked if you want to load the default configuration.

Note: If you press Shift-3 earlier (during the power on self test), you will just be able to flash the switch, or change the flashing settings.

After that, connect the switch to a computer (using an ethernet cable) and assign it an IP address in the appropriate range (e.g. 10.90.90.1/24).

Secondly, you will need to setup a TFTP server, and in its root put a file named ‘pw.cfg’ containing:

create account admin someuser
pass
pass

where someuser is the user you want to create, and pass is the password you want for that user. If you use a username that already exists, it won’t work (unless you first delete that user).

Third, you will need to download the MIBs for the DGS-3024 (available here), and unpack them.

Then, use SNMP commands to make the switch download and execute the file you created earlier:

# File type (switch configuration)
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private 10.90.90.90 1.3.6.1.4.1.171.12.1.2.1.1.6.3 i 3 

# Type of transfer (?)
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private 10.90.90.90 1.3.6.1.4.1.171.12.1.2.1.1.4.3 i 2 

# Filename
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private 10.90.90.90 1.3.6.1.4.1.171.12.1.2.1.1.5.3 s pw.cfg 

# Transfer direction (download)
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private 10.90.90.90 1.3.6.1.4.1.171.12.1.2.1.1.7.3 i 3 

# TFTP server IP (the one you set earlier)
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private 10.90.90.90 1.3.6.1.4.1.171.12.1.2.1.1.3.3 a 10.90.90.1

# Start the transfer
snmpset -M DGS3024_MIB_20060721/standard/:DGS3024_MIB_20060721/private/ -v2c -c private 10.90.90.90 1.3.6.1.4.1.171.12.1.2.1.1.8.3 i 3

After running these commands you should immediately be able to login to the switch (using serial or telnet) using the username and password you specified earlier.

Thanks goes to this blog post (in russian), that helped me figure out how to reset the password.