Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including Port numbers in %systemroot%\system32\drivers\etc\hosts File

Is it possible to include port numbers in hosts file? Reason that I'm asking is because I have sites that I'm trying to migrate from one hosting server to another, and the sites are pointing to an old SQL server that uses the standard TCP/IP port (1433). On the new server, the SQL Server port is different, and I don't want to change the connection strings for these sites.

Thank you!

like image 249
mallows98 Avatar asked Nov 18 '09 22:11

mallows98


People also ask

Can I add port number in hosts file?

The hosts file is for host name resolution only (on Windows as well as on Unix-like systems). You cannot put port numbers in there, and there is no way to do what you want with generic OS-level configuration - the browser is what selects the port to choose.

How do I add a port to my local host?

In the Local address text box on the right, enter the IP address or hostname on which your site is hosted on the web server running in your development machine, followed by the port number. For example, if your site is running on localhost:7331 enter localhost:7331 . Click Add.

What is System32 drivers etc hosts?

The hosts file is a plain text file used to map host names to IP addresses. On Windows, it is located in the C:\Windows\System32\drivers\etc folder. Note that the "Hosts" file is owned by the "System" account [NT AUTHORITY/SYSTEM] and may only be modified by an administrator.

What is ETC hosts file used for?

The /etc/hosts file contains the Internet Protocol (IP) host names and addresses for the local host and other hosts in the Internet network. This file is used to resolve a name into an address (that is, to translate a host name into its Internet address).


1 Answers

This is not possible in the host file. DNS doesn't know anything about port numbers.

like image 161
Byron Whitlock Avatar answered Oct 10 '22 21:10

Byron Whitlock