Deprecation Warning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066

If you use an IP address instead of a ServerName in the SQL Server database connection properties, you may see the following warning/error.

Deprecation warning - Setting the TLS ServerName to an IP address is not permitted

DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066.

To create a working connection, it is necessary to specify the ServerName.
And in case the ServerName cannot be used, you can try (for testing purposes) a workaround.
This can be done by simply editing the hosts file.

What is a hosts file?

A hosts file is a plain-text file that maps domain names to IP addresses.

What modifications are necessary?

Let’s say you want to connect to 192.168.0.115, which is the IP address of the machine running your SQL Server Express. Simply type the following simple mapping into the hosts file:

192.168.0.115 testsqlserverexpress

In this way, we assign a name to the IP address that we will later use when creating a database connection.

How to modify the hosts file?

The following sections describe step-by-step instructions for Windows, Linux or macOS.
Note: Before you edit your hosts file, it is strongly recommended that you make a backup copy of it.

Windows 11

  1. Type Notepad into the search box in the main taskbar.
  2. In the results, right-click Notepad and select Run as administrator.
Running Notepad as Administrator on Windows 11
  1. Open a file from the following location:
    c:\Windows\System32\Drivers\etc\hosts
  2. Write the mapping to the file
  3. Save your changes by clicking File -> Save
Hosts file on Windows 11

macOS

  1. Start Terminal
  2. Type the following command to open the hosts file in a text editor
sudo nano /private/etc/hosts
  1. Enter your password
  2. Add your new mappings after the default mappings.
  3. To save your changes, press Control+X and when asked if you want to overwrite your changes, press Y.

Linux

  1. Start Terminal
  2. Type the following command to open the hosts file in a text editor
sudo nano /etc/hosts
  1. Enter your password
  2. Add your new mappings after the default mappings.
  3. To save your changes, press Control+X and when asked if you want to overwrite your changes, press Y.

Note: to apply the changes, you may need to flush the DNS cache.

Creating a working database connection in Luna Modeler

You can now create a new connection for SQL Server and use the name specified in the hosts file.
When you click the Load button, Luna Modeler connects to the SQL Server and loads a list of databases from which you can select the one you want to visualize.

SQL Server Connection properties in Luna Modeler - database design tool

After loading the database, the result can look like this:

ERD created with Luna Modeler - database design tool.

For more information see article Visualization of SQL Server databases.

Conclusion

In this article, we’ve shown you how to edit the hosts file on Windows, Linux, and macOS and how to use the mapped name for establishing a new connection to your SQL Server database. Please note that we recommend following the instructions in your test environment, not in the production environment.

Enjoy database modeling with Luna Modeler – the database modeling tool for SQL Server

Download

#

Quick links

Download Buy Now!

Blog Categories
Blog by Platforms