# Modifying the master agent IP/UDP port

Once the NMS subagents and multiplexer are installed, modify the SNMP master agent's IP/UDP port so it connects to the NMS multiplexer port (port 49212) instead of the network port (port 161).

You can use another port if port 49212 is already in use, or if you are already using an SNMP multiplexer in your system. To configure the secondary port on the multiplexer, edit the snmp.cfg file and modify the value MasterAgentPort in the [common] section (see Reconfiguring multiplexer IP/UDP ports). Then restart the multiplexer and the subagents to make your changes effective.

This topic describes how to change the SNMP master agent's UDP port under:

- Windows

- UNIX

## Windows

Complete the following steps to change the SNMP master agent's UDP port:

Step | Action
1 | Open the file Services for editing. This file can be found in \Windows\system32\drivers\etc\Services.
2 | In this file, find the following line: SNMP 161 / udp
3 | Change the line to: SNMP 49212 / udp
4 | Save and close this file.
5 | Open a command prompt window.
6 | Stop and restart the SNMP service by entering the following commands: net stop snmp net start snmp

## UNIX

### Solaris

Complete the following steps to change the SNMP master agent's UDP port:

Step | Action
1 | Log on as superuser.
2 | Open the file /etc/init.d/init.snmpdx for editing
3 | In this file, find the line beginning with: /usr/lib/SNMP/snmpdx -p 161 ...
4 | Replace the first section of the line with: /usr/lib/SNMP/snmpdx -p 49212 ...
5 | Save and close this file.
6 | Access a console window.
7 | Stop and restart the master agent if it is running. To determine if the master agent is running, enter: ps -A | grep snmpdx If the master agent is running, the command produces output similar to: 136 ? 0:00 snmpdx
8 | If the master agent is running, run the kill command to send a kill signal to that process using the output of the previous command: kill -9 136 Another way to stop the master agent process is by entering: /etc/init.d/init.snmpdx stop
9 | Restart the master agent. To do so, enter: /etc/init.d/init.snmpdx start

The following example is an extract of the file init.snmpdx:

#
# Copyright (c) 1997 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident "@(#)init.snmpdx 1.12 97/12/08 SMI"
case "$1" in
'start')
if [ -f /etc/SNMP/conf/snmpdx.rsrc -a -x /usr/lib/SNMP/snmpdx ]; then
/usr/lib/SNMP/snmpdx -p 161 -y -c /etc/SNMP/conf -d 0
fi
;;
'stop')
/usr/bin/pkill -9 -x -u 0 '(snmpdx|snmpv2d|mibiisa)'
;;
*)
echo "Usage: $0 { start | stop }"

### Linux

Complete the following steps to change the SNMP master agent's UDP port:

Step | Action
1 | Log in as superuser.
2 | Open the file /etc/snmp/snmpd.conf for editing.
3 | In this file, insert or modify the line beginning with agentaddress so it matches the following example: agentaddress udp:49212
4 | Save and close this file.
5 | Open a console window.
6 | Stop and restart the master agent if it is running. To determine if the master agent is running, enter: ps -A | grep snmpd If the master agent is running, the command produces output similar to: 136 ? 0:00 snmpd If the master agent is running, run the kill command to send a kill signal to that process using the output of the previous command: kill -9 136
7 | Another way to stop the master agent process is by invoking: /etc/rc.d/init.d/snmpd stop
8 | Restart the master agent by entering: /etc/rc.d/init.d/snmpd start