In this article:
You will see how to configure VMWare to use your network DNS server instead of its internal DNS server. This can resolve some errors you may see in the Console Services trace logs regarding "A network-related or instance-specific error occurred while establishing a connection to SQL Server...". This can be caused by an issue with the DNS server. Some times it is more consistent to use your own network DNS server instead of the one built-in to VMWare so you can see what is actually in the tables and manage it more effectively.
You may see errors in the Console similar to the following:
System.Data.SqlClient.SqlException (0x80131904): 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The network path was not found...
This may occur if you cannot ping the SQL server from the Console server.
Step 1 - Test Connectivity
Make sure you are able to ping the physical server where SQL Server is installed from the client machine. If not, you can try to connect to the SQL Server using an IP Address (for default instance) or IP Address\Instance Name for a named instance.
If it resolves using an IP address, you can add the SQL Server machine into /etc/host file. To add the entry in the /host file type %SystemRoot%\system32\drivers\etc\ in the run window and open the host file using Notepad. In the below image I added IP address 126.96.36.199 with a machine name of SQLDBPool. Now I should be able to use the machine name instead of the IP address to connect to the SQL Server.
Step 2 - Configure VMWare to Use Network DNS Server
If you want a more permanent resolution you should configure VMWare to use your network DNS Server instead of its internal DNS Server. This is done by going to your VMWare Wrokstation Manager and click on the Edit button at the top then selecting "Virtual Network Editor":
Once you are in the Virtual Network Editor, you will click on "Change Settings" at the bottom and say YES when prompted. Then select the "NAT" option and click "NAT Settings..." button:
In the NAT Settings window, click "DNS Settings..." button:
In the Domain Name Server (DNS) window, de-select "Auto detect available DNS servers", then add entries for your network DNS Servers in the DNS Servers fields:
Click OK to exit this window and continue exiting windows until the Virtual Network Editor is closed.
Step 3 - Flush DNS
Go to your virtual machines on this VMWare host, and run the following commands on each VM in order to flush your existing DNS settings:
- Hold down the Windows key and press R. (this will open the Run dialogue),
- Type cmd and Right-click on the command that appears in the start menu, then select "Run as Administrator" (this will open a command prompt as an Administrator - you may be prompted for admin credentials if you are not a local admin on the machine).
- Type ipconfig /flushdns and press Enter.
- Type ipconfig /registerdns and press Enter.
- Type ipconfig /release and press Enter.
- Type ipconfig /renew and press Enter.