I have an interesting situation here. We're basically trying to migrate some SQL Server infrastructure to new hardware, and one of the boxes (single-instance, 2-node cluster) is running 2008R2. The others are 2012 & 2014, but those don't exhibit this problem.
There's an app that connects to a server named, say, "OLD-SQL"; and let's say that IP is 22.214.171.124. This is the name of the legacy SQL box running the default instance, SQL 2008R2, and Windows Server 2008R2. The app's connection setting/config/string/whatever cannot be changed at this time.
The new SQL box that is set to replace that one, is named, say, "NEW-SQL"; and let's say it's IP is 126.96.36.199. Also running SQL 2008R2 (same SQL build). OS is Windows Server 2012 R2 (newer OS). Both boxes are actually Clustered Instances w/ 2 nodes each (old-fashioned failover clustering, nothing fancy).
So to aid the migration, for now, for testing/QA purposes, we've done the following: 1. Set up Hosts file on the client QA'ing machine to redirect the name "OLD-SQL" to 188.8.131.52 (new server). 2. Created a SQL Server Alias on the NEW-SQL server (using SQL Config Mgr.), named "OLD-SQL", pointing at itself, port 1433, protocol TCP/IP.
To test it out, I try connect via SSMS; I enter "OLD-SQL" as the server-name to connect to. It fails with the infamous "SSPI context" error (https://support.microsoft.com/en-us/kb/811889). The same thing happens with the application that's being tested. Ping from cmd-line resolves fine -- it knows "OLD-SQL" resolves to new IP 184.108.40.206 based on the Hosts file.
Now, to really throw a wrench into things. I go back onto the server NEW-SQL, and add another Alias, same parameters but named "OLD-SQL2". This name is unique within the domain network. I go back to my box, change my Hosts file to point from that name to the IP (220.127.116.11), and go to SSMS and try to connect again. THIS WORKS!
I verify that I'm on the "right server" by doing a
SELECT @@SERVERNAME, and lo-and-behold, it says "NEW-SQL". But of course this isn't the alias I really want; I want to be able to give it the alias "OLD-SQL" and have my app redirected to "NEW-SQL" via the Hosts entry and the SQL Alias.
So what am I doing wrong with the first alias? Is it just that I can't use the same name as an existing server on the network, with 2008R2?
Similar post on SO: https://stackoverflow.com/questions/6406811/alias-not-working-on-sql-server-2008-r2 (Did not solve the issue)
PS: I say "with 2008R2" specifically, because when I try the same setup (Hosts, SQL Alias) with our 2012-2014 boxes, they work the first way just fine! (I.e. the Alias on the "NEW-SQL2012" box can be "OLD-SQL2012", which is the same as an existing server, and no problems connecting or anything.)
PPS: I did read about these aliases being more of a client-side thing, but that's why I'm using the Hosts file trick. When we get ready for the "real" migration, we'll use DNS and other tricks outside of my knowledge (that's the SysEng's domain) to do the redirection of clients (apps/computers) to the new servers, but they said for now, for testing, the Hosts file thing is a good substitute.
Update: The main difference between the "working" setups and the "non-working" one, besides the SQL Server versions, is the fact that the old 2008R2 instance "SQL-OLD", when I connect using the "pristine" setup (no aliases or hosts-file-redir.), uses Kerberos authentication. When I connect via a unique alias or redirect, such as "OLD-SQL2", it registers as NTLM. And in ALL OTHER working connection methods, it's also NTLM. What the hell is Kerberos doing to me??