I have two laptops (both running Windows 10, 64-bit) connected to my home network using wifi. Here are details about each laptop (please ask if you need more info):
Laptop #1
2017 Microsoft SQL Server Express (64-bit)
SQL Server Management Studio v17.9.1
Engine: Named Instance (SQLEXPRESS)
Local IP: 10.0.0.5
Laptop #2
2019 Microsoft SQL Server Developer (64-bit)
SQL Server Management Studio v18.4
Engine: Unnamed/Default Instance (MSSQLSERVER)
Local IP: 10.0.0.53
I'd like Laptop #1 to be the server and Laptop #2 to be the client connecting to that server.
Following things I made sure on Laptop #1:
- I tried pinging 10.0.0.53 which SUCCEEDED.
- Enable TCP/IP in SQL Server Configuration Manager.
- Inside TCP/IP Properties, under
IPAll
,TCP Dynamic Ports = [Blank]
(I cleared it) andTCP Port = 1433
. I went into SQL Server Services and restarted the SQL Server service. - Inside TCP/IP Properties, under
IP8
,Active = Yes
,Enabled = Yes
,TCP Dynamic Ports = [Blank]
,TCP Port = 1433
. - Created an inbound Windows-Firewall rule for TCP Port 1433 with "Private" group.
- In Laptop #1's SQL Server Management Studio, under
Server Properties
>Security
,Server authentication = SQL Server and Windows Authentication mode
. - In Laptop #1's SQL Server Management Studio, under
Server Properties
>Connections
,Remote server connections = Allow remote connections to this server [ticked]
. - I've added a user to my database and allowed him to read/write to tables.
Following things I tried from Laptop #2:
- I tried pinging 10.0.0.5 which SUCCEEDED (all packets came through)
Server name: 10.0.0.5\SQLEXPRESS,1433
,Authentication = SQL Server Authentication
,Login = ...
,Password = ...
- No windows firewall rules created. In SQL Server Configuration Manager (I enabled TCP/IP and noted that
IPAll::TCP Port = 1433
andIPAll::TCP Dynamic Ports = [Blank]
.
But still getting following error:
Cannot connect to 10.0.0.5\SQLEXPRESS,1433. Additional Information: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The wait operation timed out.) (Microsoft SQL Server, Error: 258)
Troubleshooting History
At first I was able to ping Laptop #1 from Laptop #2 but not the other way around. As it turns out, Laptop #2 (being new) had McAfee which configured my firewall settings and disabled ICMP IPv4. I uninstalled McAfee, rebooted, and made sure inbound rules "File and Printer Sharing (Echo Request - ICMPv4-In)" for "private/public/domain groups" (and for "*-ICMPv6-In") are "enabled". Afterwards, I was able to ping Laptop #2 from Laptop #1. I still get the same error when trying to log in.
Following some DAOverflow member's advice, I checked SQL Server Logs to see which ports the database Engine listened on. The logs (which can be found under Management
> SQL Server Logs
) contained the following:
Date Source Message
... | spid16s | Server is listening on ['any' <ipv4> 1433]
... | spid16s | Server is listening on ['any' <ipv6> 1433]
I enabled Telnet Client on Laptop #2's powershell but could not connect to the host 10.0.0.5:1433.
Update
I talked to a friend who suggested turning off Windows Firewall on Laptop #1. I did so and afterwards was able to telnet
to Laptop #1 from #2. I was also able to locate the SQL server on Laptop #1, login, and view tables. The issue appears to be with my Windows Firewall Settings.
Solution
On Laptop #1 I had to create two inbound rules: TCP Port 1433
and UDP Port 1434
. Both rules apply to Domain
, Private
, and Public
profiles. After enabling both rules, I was able to connect to the SQL Server. I also did some further testing:
I disabled UDP 1434
(leaving TCP 1433
enabled) and sure enough I couldn't log in (nor see the server be listed on the network when "Browsing for more [servers]" on the Connect to Server
dialog window).
I disabled TCP 1433
(leaving UDP 1434
enabled) and sure enough I couldn't log in though the server was listed on the Browse for Servers
dialog window.