How to check if SQL Server is listening on a dynamic port or static port
Article
This article discusses how to determine whether your Microsoft SQL Server named instance is listening on a dynamic port versus a static port. This information can be helpful when you troubleshoot different connection issues that are related to SQL Server.
By default, a SQL Server named instance is configured to listen on dynamic ports. It gets an available port from the operating system. You can also configure SQL Server named instances to start at a specific port. This is known as a static port. For more information about static and dynamic ports in the context of SQL Server, see Static vs Dynamic Ports.
Use the following procedure to determine whether the SQL Server named instance is listening on a dynamic port versus a static port.
Option 1: Use SQL Server Configuration Manager
In SQL Server Configuration Manager, expand SQL Server Network Configuration, expand Protocols for instance name, and then double-click TCP/IP.
In TCP/IP Properties, select Protocol.
Check the value in the Listen All setting. If it's set to Yes, go to step 4. If it's set to No, go to step 6.
Go to IP Addresses, and scroll to the bottom of the TCP/IP Properties page.
Check the values in IP All, and use the following table to determine whether the named instance is listening on a dynamic or static port.
TCP dynamic ports
TCP port
SQL Server instance using dynamic or static ports?
Blank
Blank
Dynamic ports
<Number>
Blank
Dynamic ports - <Number> is the dynamic port that SQL Server is currently listening on
<Number1>
<Number2>
Concurrently listening on a dynamic port <Number1> and a static port <Number2>
Switch to IP Addresses.
Notice that several IP addresses appear in the format of IP1, IP2, up to IP All. One of these IP addresses is intended for the loopback adapter, 127.0.0.1. More IP addresses appear for each IP address on the computer. (You will probably see both IP4 and IP6 addresses.) To check whether a specific IP address is configured for a dynamic versus static port, use the following table.
TCP dynamic ports
TCP port
SQL Server instance using dynamic or static ports?
Blank
Blank
Dynamic ports
<Number>
Blank
Dynamic ports - <Number> is the dynamic port that SQL Server is currently listening on.
<Number1>
<Number2>
Concurrently listening on a dynamic port <Number1> and a static port <Number2>
Note
A value of 0 in TCP dynamic ports indicates that the named instance is currently not running and is configured for dynamic ports. After you start the instance, the value field will reflect the dynamic port that the instance is currently using.
Option 2: Use PowerShell
Run the following script in the PowerShell ISE. The Console window displays all the relevant TCP/IP for all your SQL Server instances (SQL Server 2014 through SQL Server 2019) that are currently installed on the system.
In the output, check the value in the ListenOnAllIPs column for your SQL Server instance (refer to the corresponding value in ServerInstance for that row). If the value is set to 1, go to step 3. If it's set to 0, go to step 4.
Scan the output for a row that has an Any IP Address entry in the DisplayName column for your instance, or check the values of TcpDynamicPorts and TcpPort for the row. Then use the following table to determine whether the named instance is listening on a dynamic or static port.
TCP dynamic ports
TCP port
SQL Server instance using dynamic or static ports?
Blank
Blank
Dynamic ports
<Number>
Blank
Dynamic ports - <Number> is the dynamic port SQL is currently listening on
<Number1>
<Number2>
Concurrently listening on a dynamic port <Number1> and a static port <Number2>
Notice that several IP addresses appear in the format of IP1, IP2, up to IP All. One of these IP addresses is intended for the loopback adapter, 127.0.0.1. More IP addresses appear for each IP address on the computer. (You will probably see both IP4 and IP6 addresses.) To check whether a specific IP address is configured for a dynamic versus static port, use the following table.
TCP dynamic ports
TCP port
SQL Server instance using dynamic or static ports?
Blank
Blank
Dynamic ports
<Number>
Blank
Dynamic ports - <Number> is the dynamic port that SQL Server is currently listening on.
<Number1>
<Number2>
Concurrently listening on a dynamic port <Number1> and a static port <Number2>
Note
A value of 0 in TCP dynamic ports indicates that the named instance is currently not running and is configured for dynamic ports. After you start the instance, the value field will reflect the dynamic port that the instance is currently using.
Learn how to securely connect an Azure SQL server using an Azure Private Endpoint via the Azure portal, ensuring private and safe communication with your SQL server.
Learn how to use SQL Server Configuration Manager to configure the Database Engine to listen on a specific fixed port other than the default port, 1433.
Get acquainted with tabular data stream (TDS) endpoints. See how to use them to configure the SQL Server Database Engine to listen on multiple TCP ports.
Find out how to configure the named pipe that the SQL Server Database Engine listens on. Learn how to connect a client application to a specific named pipe.