到其他域的VPN导致本地域身份validation停止工作

我有一个本地域(我们称之为mycorp.local )。

在一台计算机上,我build立了一个到远程域的VPN连接(让我们假设它的DNS后缀是remote.local )。

只要我build立远程连接,本地域authentication停止工作。 例如,我尝试使用集成身份validation连接到SQL服务器,但失败并出现此错误:

login失败。 login来自不受信任的域,不能与Windows身份validation一起使用。 (Microsoft SQL Server,错误:18452)

如果我断开VPN,我可以再次login到SQL。

两个域都没有信任关系。

我的第一个猜测是,VPN连接优先于本地DNS。 这就是为什么我遵循这个答案: VPN连接导致DNS使用错误的DNS服务器 。 基本上,答案允许改变接口的顺序来尝试DNSparsing。

我假设DNS设置是正确的,因为我可以在build立VPN时ping通sql和ad计算机。

是否有任何参数/configuration要应用,以确保身份validation发生在正确的域名?


如果可以帮忙的话,下面是我的设置的一些细节:

  • 2个网卡
    • 1可以访问ADnetworking
    • 1与互联网接入
  • 本地子网:192.168.10.0/24。 公制设置为1
  • 第二张卡的子网:192.168.66.0/24。 公制设置为100
  • VPN连接的子网:172.16.0.0/16。 公制设置为9999

在任何情况下, ping sqlping sql.mycorp.localping adping ad.mycorp.local都可以正确parsingIP地址(当然可以使用一些ipconfig /flushdns )。

ipconfig /all的完整输出是:

 Windows IP Configuration Host Name . . . . . . . . . . . . : mycomputer Primary Dns Suffix . . . . . . . : mycorp.local Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : mycorp.local remote.local Ethernet adapter Local: Connection-specific DNS Suffix . : mycorp.local Description . . . . . . . . . . . : Microsoft Hyper-V Network Adapter #3 Physical Address. . . . . . . . . : 00-15-5D-14-20-0D DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::d117:9048:ce1c:1422%16(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.10.30(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : DHCPv6 IAID . . . . . . . . . . . : 385881437 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-19-8B-E5-3D-00-15-5D-14-20-0F DNS Servers . . . . . . . . . . . : fe80::80ce:dc9d:37c5:39f3%16 192.168.10.10 NetBIOS over Tcpip. . . . . . . . : Enabled Ethernet adapter RJ45: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft Hyper-V Network Adapter #2 Physical Address. . . . . . . . . : 00-15-5D-14-20-0E DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes IPv6 Address. . . . . . . . . . . : 2a01:e35:8a84:7240:c0eb:c8d1:9c3f:8fc0(Preferred) Link-local IPv6 Address . . . . . : fe80::c0eb:c8d1:9c3f:8fc0%13(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.66.11(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Lease Obtained. . . . . . . . . . : lundi 12 août 2013 13:06:28 Lease Expires . . . . . . . . . . : jeudi 22 août 2013 13:06:28 Default Gateway . . . . . . . . . : fe80::207:cbff:fe3c:5b7f%13 192.168.66.254 DHCP Server . . . . . . . . . . . : 192.168.66.254 DNS Servers . . . . . . . . . . . : fe80::80ce:dc9d:37c5:39f3%13 192.168.10.10 NetBIOS over Tcpip. . . . . . . . : Enabled Ethernet adapter Wifi: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft Hyper-V Network Adapter Physical Address. . . . . . . . . : 00-15-5D-14-20-0F DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::c551:f03f:7557:9b17%11(Preferred) Autoconfiguration IPv4 Address. . : 169.254.155.23(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.0.0 Default Gateway . . . . . . . . . : DHCPv6 IAID . . . . . . . . . . . : 234886493 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-19-8B-E5-3D-00-15-5D-14-20-0F DNS Servers . . . . . . . . . . . : fe80::80ce:dc9d:37c5:39f3%11 192.168.10.10 NetBIOS over Tcpip. . . . . . . . : Enabled PPP adapter VPN remote: Connection-specific DNS Suffix . : remote.local Description . . . . . . . . . . . : VPN remote Physical Address. . . . . . . . . : DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes IPv4 Address. . . . . . . . . . . : 172.16.110.243(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.255 Default Gateway . . . . . . . . . : DNS Servers . . . . . . . . . . . : 172.16.100.47 172.16.100.43 Primary WINS Server . . . . . . . : 172.16.100.47 Secondary WINS Server . . . . . . : 172.16.122.100 NetBIOS over Tcpip. . . . . . . . : Enabled Tunnel adapter isatap.{DEFE2CAC-D001-4E79-A33F-AD95A8106CA8}: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft ISATAP Adapter Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Tunnel adapter Local Area Connection* 9: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Tunnel adapter isatap.{2AE1C64F-102F-48B4-A60A-AA28461A96EF}: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2 Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Tunnel adapter isatap.remote.local: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : remote.local Description . . . . . . . . . . . : Microsoft ISATAP Adapter #3 Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Tunnel adapter isatap.mycorp.local: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : mycorp.local Description . . . . . . . . . . . : Microsoft ISATAP Adapter #4 Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0 DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes 

完整的route print命令的输出是:

 =========================================================================== Interface List 16...00 15 5d 14 20 0d ......Microsoft Hyper-V Network Adapter #3 13...00 15 5d 14 20 0e ......Microsoft Hyper-V Network Adapter #2 11...00 15 5d 14 20 0f ......Microsoft Hyper-V Network Adapter 28...........................VPN Remote 1...........................Software Loopback Interface 1 12...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter 14...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface 15...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2 17...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3 18...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #4 =========================================================================== IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 192.168.66.254 192.168.66.11 100 77.245.100.10 255.255.255.255 192.168.66.254 192.168.66.11 101 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 169.254.0.0 255.255.0.0 On-link 169.254.155.23 261 169.254.155.23 255.255.255.255 On-link 169.254.155.23 261 169.254.255.255 255.255.255.255 On-link 169.254.155.23 261 172.16.0.0 255.255.0.0 172.16.110.240 172.16.110.243 10000 172.16.110.243 255.255.255.255 On-link 172.16.110.243 10255 192.168.10.0 255.255.255.0 On-link 192.168.10.30 257 192.168.10.30 255.255.255.255 On-link 192.168.10.30 257 192.168.10.255 255.255.255.255 On-link 192.168.10.30 257 192.168.66.0 255.255.255.0 On-link 192.168.66.11 356 192.168.66.11 255.255.255.255 On-link 192.168.66.11 356 192.168.66.255 255.255.255.255 On-link 192.168.66.11 356 224.0.0.0 240.0.0.0 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 192.168.10.30 257 224.0.0.0 240.0.0.0 On-link 192.168.66.11 356 224.0.0.0 240.0.0.0 On-link 169.254.155.23 261 224.0.0.0 240.0.0.0 On-link 172.16.110.243 10255 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 192.168.10.30 257 255.255.255.255 255.255.255.255 On-link 192.168.66.11 356 255.255.255.255 255.255.255.255 On-link 169.254.155.23 261 255.255.255.255 255.255.255.255 On-link 172.16.110.243 10255 =========================================================================== Persistent Routes: None IPv6 Route Table =========================================================================== Active Routes: If Metric Network Destination Gateway 13 356 ::/0 fe80::207:cbff:fe3c:5b7f 1 306 ::1/128 On-link 13 108 2a01:e35:8a84:7240::/64 On-link 13 356 2a01:e35:8a84:7240:c0eb:c8d1:9c3f:8fc0/128 On-link 16 257 fe80::/64 On-link 13 356 fe80::/64 On-link 11 261 fe80::/64 On-link 13 356 fe80::c0eb:c8d1:9c3f:8fc0/128 On-link 11 261 fe80::c551:f03f:7557:9b17/128 On-link 16 257 fe80::d117:9048:ce1c:1422/128 On-link 1 306 ff00::/8 On-link 16 257 ff00::/8 On-link 13 356 ff00::/8 On-link 11 261 ff00::/8 On-link =========================================================================== Persistent Routes: None 

[编辑]跟进TheCleaner的评论。

 klist purge klist 

输出:

 Current LogonId is 0:0x6a9a3 Deleting all tickets: Ticket(s) purged! Current LogonId is 0:0x6a9a3 Cached Tickets: (0) 

启动程序并尝试连接(Sql Management Studio)。 那么成功了:

 sqlcmd -S sql -E -Q "select getdate()" klist 

输出:

 Current LogonId is 0:0x6a9a3 Cached Tickets: (0) 

build立VPN连接,然后:

 sqlcmd -S sql -E -Q "select getdate()" klist 

输出:

 Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.. 

当前LogonId是0:0x6a9a3

 Cached Tickets: (1) #0> Client: steve @ mycorp.LOCAL Server: krbtgt/mycorp.LOCAL @ mycorp.LOCAL KerbTicket Encryption Type: RSADSI RC4-HMAC(NT) Ticket Flags 0x40e00000 -> forwardable renewable initial pre_authent Start Time: 8/12/2013 15:14:22 (local) End Time: 8/13/2013 1:14:22 (local) Renew Time: 8/19/2013 15:14:22 (local) Session Key Type: RSADSI RC4-HMAC(NT) 

[编辑2] 激活kerberos事件日志logging后 ,我得到一个特定的事件日志:

 A Kerberos Error Message was received: on logon session Client Time: Server Time: 19:18:33.0000 8/12/2013 Z Error Code: 0x7 KDC_ERR_S_PRINCIPAL_UNKNOWN Extended Error: Client Realm: Client Name: Server Realm: remote.LOCAL Server Name: MSSQLSvc/sql:1433 Target Name: MSSQLSvc/sql:[email protected] Error Text: File: 9 Line: f09 Error Data is in record data. 

如果你看看这个领域,你会发现这个领域不是mycorp.local而是remote.local

我终于find了一个简单的方法来解决这个问题。

解决scheme是从这个technet线程 。

在VPN连接文件( .pbk )中将UseRasCredentials参数设置为0解决了问题。

我扣除这个参数告诉Windows不要使用VPN连接的凭据。 我每次连接到远程networking时都必须input我的login名/密码,但是我确定。

正如post所说,要注意用GUI编辑连接重置这个参数为1。

这是传递到SQL服务器,而不是您的mycorp.local原始凭据(自运行作品)的VPN凭据。

但不知道是否可以强制它保留并传递最初的一组凭证,而不是新获得的集成authentication令牌…我不这么认为,因为这真的是Run As方式”,解决方法是通过另一个一套凭证。

就个人而言,在VPN上创buildRun As方式的快捷方式应该可以解决这个问题,但也许其他专家有更好的主意。