For troubleshooting purposes, it may be necessary to check if a port is already in use by a different application on a server.
To check the listening ports and applications with netstat:
netstat -bano
C:\netstat -bano | more
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:port 0.0.0.0:0 LISTENING process ID
[process.exe]
TCP 0.0.0.0:port 0.0.0.0:0 LISTENING process ID
[process.exe]
...
process
is the name of the applicationport
is the port that is being usedprocess ID
is the process ID of the processCan not obtain ownership information"
appears instead of the [process.exe] entry, to find more information navigate to the Windows Task Manager using the process ID:The output shows the processes that are listening, as well as the name of the process and process ID. When reviewing the information, only look at the ports that are listening on that port. If no process is listening on a port, it means that the port is free to be utilized.
When determining what is listening on the port, decide what action needs to be taken to resolve the conflict. This involves stopping a service or uninstalling the application that is utilizing the port.
For a list of ports used by VMware products, see TCP and UDP Ports required to access VMware vCenter Server, VMware ESXi and ESX hosts, and other network components.
Note: Mac OS and certain distributions of Linux do not support listing the process name with netstat. If using Mac OS or are seeing errors on a distribution of Linux, follow the lsof
instructions below.
To check the listening ports and applications with netstat:
netstat -pan
[root@server]# netstat -pan
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:port 0.0.0.0:* LISTEN process ID/process
tcp 0 0 0.0.0.0:port 0.0.0.0:* LISTEN process ID/process
...
process
is the name of the applicationport
is the port that is being usedprocess ID
is the process ID of the processTo check the listening ports and applications with lsof
:
lsof -i -P -n
[root@server]# lsof -i -P -n
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
process process ID root 3u IPv4 3011 TCP *:port (LISTEN)
process process ID root 3u IPv4 3011 TCP *:port (LISTEN)
...
process
is the name of the applicationport
is the port that is being usedprocess ID
is the process ID of the processThe output from either of these two commands shows the processes that are listening, the name of the process, and the process ID. When reviewing the information it is important to only look at the ports that are listening to ensure findind the correct application that is listening on that port. If no process is listening on a port, it means that the port is free to be utilized.
When determining what is listening on the port, decide what action needs to be taken to resolve the conflict. This involves stopping a service or uninstalling the application that is utilizing the port.
For a list of ports used by VMware products, see TCP and UDP Ports required to access VMware vCenter Server, VMware ESXi and ESX hosts, and other network components.