If you follow my work, you could see that I work a lot with Windows and SNMP. For the folks who are not familiar, SNMP stands for for Simple Network Management Protocol. It is used for monitoring target network devices. Windows and Windows Servers support them for the last 20 years. You can get different metrics, from system uptime, CPU load, disk space to Windows service status.
SNMP uses the UDP port 161 for general SNMP messages. It uses UDP port 162 for SNMP Traps.
In this article, I will show you how to change the default support on Windows and Windows Servers. The procedure is applicable from Windows 7 to Windows 11, and from Windows Server 2012 to Windows Server 2022.
Regardless of what operating system and edition you are running: An administrator account is required.
Windows and Windows Servers with GUI
This procedure includes all operating system that provides you with Desktop experience. That includes the following operating systems:
- Windows 7, 8, 8.1, 10 and 11
- Windows Server 2012, 2012 R2, 2016, 2019 and 2022
Let’s do it together.
- Press Windows logo + R.
- Type the UNC below and press Enter. This will automatically opens File Explorer or Windows Explorer (in older OS).
%systemroot%\System32\Drivers\Etc
- Right-click on file services and open it in the text editor. I use Notepad++, but you can use any other text editor (Sublime Text, native Notepad, etc.).
- Navigate to lines 67 and 68. You should find there snmp and snmptraps.
- Change the port and save the file (File > Save).
- Press Windows logo + R.
- Type services.msc and press Enter to open Services tool.
- Navigate to SNMP, and then right click on it and then click Restart.
- You have successfully changed default port and restarted your SNMP service.
- Configure SNMP port on your NMS (Network Monitoring Solution) and start monitoring.
Window Server Core and Hyper-V Server Core
As there is no Desktop experience with Server Core editions, you will need to make changes using PowerShell. This procedure is applicable to the following systems:
- Windows Server Core 2012, 2012 R2, 2016, 2019 and 2022
- Hyper-V Server Core 2012, 2012 R2, 2016 and 2019
Let’s do it together.
- Open PowerShell. You can do it by pressing 15 and then Enter.
- Type notepad.exe and press Enter to open Notepad text editor.
- Click on File > Open and navigate to Windows\System32\Drivers\etc.
- Under File of types select All Files, and then select Services.
- Click Open to open services in Notepad.
- Navigate to snmp and snmptrap.
- Change the port and save the file (File > Save).
- Close Notepad.
- Go back to PowerShell and reset the SNMP services by running the following command.
PS> Restart-Service SNMP
PS> Restart-Service SNMPTRAP
- You have successfully changed default port and restarted your SNMP service.
- Configure SNMP port on your NMS (Network Monitoring Solution) and start monitoring.
I hope you found this article helpful. If so, feel free to share it with your friends and connections using social media button(s) below. Thank you.