Gra*_*ant 6 vpn internal-dns split-dns split-tunnel windows-10
这是设置:
问题:
我想要发生的事情:
我试过的:
我怀疑,如果我可以让 VPN 根本不列出任何 DNS 服务器,NRPT 规则将仅适用于 example.local,并且一切都会正常工作。但是我找不到办法让它不使用 RRAS 服务器提供的那些。
小智 5
您可以尝试的一种潜在解决方法是建立 Server 2016 DNS 服务器并实施 DNS 策略以执行具有地理定位意识的拆分 dns。这将允许您告诉来自设备 VPN 子网的 DNS 查询使用外部 IP 而不是内部 IP。
powershell 命令如下所示。
设备 VPN 子网
Add-DnsServerClientSubnet -Name "DeviceVPNSubnet" -IPv4Subnet "192.168.1.0/24"
Run Code Online (Sandbox Code Playgroud)
设备 VPN 区域范围
Add-DnsServerZoneScope -ZoneName "example.com" -Name "DeviceVPNZoneScope"
Run Code Online (Sandbox Code Playgroud)
默认A记录(应该已经存在)
Add-DnsServerResourceRecord -ZoneName "example.com" -A -Name "mail" -IPv4Address "192.168.0.5"
Run Code Online (Sandbox Code Playgroud)
设备 VPN A 记录
Add-DnsServerResourceRecord -ZoneName "example.com" -A -Name "mail" -IPv4Address "203.0.113.5" -ZoneScope "DeviceVPNZoneScope"
Run Code Online (Sandbox Code Playgroud)
设备 VPN 解析策略
Add-DnsServerQueryResolutionPolicy -Name "Device VPN Policy" -Action ALLOW -ClientSubnet "eq,DeviceVPNSubnet" -ZoneScope "DeviceVPNZoneScope,1" -ZoneName "example.com"
Run Code Online (Sandbox Code Playgroud)
请参阅:使用 DNS 策略对主服务器进行基于地理位置的流量管理
我想出了解决办法。
将接口指标调整为比现有以太网/wifi 适配器更大的数字将使其更喜欢本地网络上的 DNS 服务器,但 NRPT 规则仍然可以通过 VPN 将我自己的域的 DNS 查询发送到我的服务器。
但是,无法在 powershell、VBscript、.NET 或 VPNv2 CSP 中调整 VPN 连接的接口指标。
如果 VPN 已连接,则可以使用 Set-NetIPInterface cmdlet 在 powershell 中更改指标,但当 VPN 未连接时,它根本不会显示。并且那里的更改不会在重新启动后持续存在。
更改它的唯一方法似乎是编辑文件C:\ProgramData\Microsoft\Network\Connections\Pbk\rasphone.pbk并更改行IpInterfaceMetric和Ipv6InterfaceMetric更高的数字。我把它们都改为100。
之后,结合 NRPT 规则,DNS 将按预期工作 - example.local 的所有查询都会发送到我的 AD DNS 服务器。其他任何内容(包括 example.com)都会发送到其本地网络的 DNS 服务器。
| 归档时间: |
|
| 查看次数: |
15337 次 |
| 最近记录: |