Question

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!

Was it helpful?

Solution

You can configure an alias in the SQL Configuration Management tool. Is designed to cover exactly this scenario.

OTHER TIPS

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

The hosts file translates host names to IP addresses (and vice-versa). You can't include port numbers.

You could set up a router to do port forwarding at the new site, and—if not already routed through the router, then give the router's address as the new host.

If this helps anyone I definded mine as follows, in the hosts file:

xxx.xxx.xxx.xxx  MyServer

The MyServer works on a specific port.

The when SQL Server 2005 management studio asks for 'server name' when creating a connection, I entered 'Myserver,1234' where 1234 was the port number.

Since it remembers them in a drop down for next time, this was good enough for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top