views:

1214

answers:

5

Hi all,

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!

+3  A: 

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

Byron Whitlock
You are right, it is not possible because I've discovered that hosts files only acts as a pointer to a specific IP address and nothing else. I might go and do the SQL Alias option that Remus Rusanu has suggested. Thanks!
mallows98
+1  A: 

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

Phil Ross
+4  A: 

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

Remus Rusanu
+1 Good answer.
Byron Whitlock
A: 

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.

wallyk
A: 

If this helps anyone I definded mine as below 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.

Tina