简体   繁体   English

重置 windows 防火墙规则后与 RDP 断开连接

[英]Disconnected from RDP after resetting windows firewall rules

I disabled the firewall for all the profiles in my windows vm.我为我的 windows vm 中的所有配置文件禁用了防火墙。 However, when I tried to enable the firewall back on by resetting it, I lost the connection to RDP and I am not able to connect with the VM again.但是,当我尝试通过重置防火墙重新启用它时,我失去了与 RDP 的连接,并且我无法再次与 VM 连接。 Any idea on why that could have happened?知道为什么会发生这种情况吗?

Your firewall is the security of your windows network.您的防火墙是 windows 网络的安全性。 Once enabled it will strictly prohibit other ports that can enter your network and by disabling the firewall will allow the port to enter your network.一旦启用,它将严格禁止其他可以进入您的网络的端口,并且通过禁用防火墙将允许该端口进入您的网络。

For this concern there is also a firewall in your GCP network which I think port 3389 for RDP is already open since you mentioned that once your firewall in windows is disable you can access RDP.对于这个问题,您的 GCP 网络中还有一个防火墙,我认为 RDP 的端口 3389 已经打开,因为您提到一旦 windows 中的防火墙被禁用,您就可以访问 RDP。

If you want to enable firewall and still can access RDP you can enable RDP from this link then here is a link where you can open a specific port, for example 3389 for RDP.如果您想启用防火墙并且仍然可以访问 RDP,您可以从此链接启用 RDP,那么这里有一个链接,您可以在其中打开特定端口,例如 RDP 的 3389。

As what @derpirscher have explained about your firewall rule you should disable your firewall on the Windows VM to establish your connection via RDP.正如@derpirscher 对您的防火墙规则所解释的那样,您应该禁用 Windows VM 上的防火墙,以通过 RDP 建立连接。

Here's the steps for troubleshooting your connection to RDP.以下是对与 RDP 的连接进行故障排除的步骤。

Ensure the Windows instance is Online/Up.确保 Windows 实例处于联机/启动状态。

Connect to the interactive serial console连接到交互式串行控制台

How to connect to Serial port Console 2 (Interactive Mode)如何连接到串口控制台 2(交互模式)

  1. In the GCP console, click the Navigation menu > then click Compute Engine在 GCP 控制台中,点击导航菜单 >,然后点击计算引擎
  2. Click VM instances点击虚拟机实例
  3. In the Name column, click the name of the instance for which you want to Connect using Serial Console.在名称列中,单击要使用串行控制台连接的实例的名称。
  4. Click the EDIT button at the top of the page.单击页面顶部的编辑按钮。
  5. Tick the "Enable connecting to serial ports" under "Remote access".勾选“远程访问”下的“启用连接到串行端口”。
  6. Scroll down and click "Save"向下滚动并单击“保存”
  7. Scroll up, click the dropdown arrow next to Connect to serial console, and select Serial port 2向上滚动,单击连接到串行控制台旁边的下拉箭头,然后单击 select 串行端口 2
  8. At the SAC> prompt, run "cmd" to create a new channel.在 SAC> 提示符下,运行“cmd”以创建新频道。 SAC returns the channel name, for example, Cmd001. SAC 返回通道名称,例如 Cmd001。 (SAC - Special Administrative Console) (SAC - 特别管理控制台)
  9. Run ch -sn [CHANNEL_NAME] and press any key to connect to the channel.运行ch -sn [CHANNEL_NAME]并按任意键连接到频道。 For example:例如:
SAC> cmd
The Command Prompt session was successfully launched.
SAC>
EVENT:   A new channel has been created.  Use "ch -?" for channel help.
Channel: Cmd0001
SAC> ch -sn cmd0001
Press any key to confirm connection to the channel.
  1. Enter the username, domain, and password of the instance to connect.输入要连接的实例的用户名、域和密码。

Commands to use for troubleshooting用于故障排除的命令

Check that your RDP service is listening (Default port 3389)检查您的 RDP 服务是否正在侦听(默认端口 3389)

C:\Windows\system32>netstat -an | find "3389"

Check to see that the 'Remote Desktop Service' is running:检查“远程桌面服务”是否正在运行:

C:\Windows\system32>net start | find "Remote Desktop Services"

To stop windows RDP停止 windows RDP

The following services are dependent on the Remote Desktop Services service.以下服务依赖于远程桌面服务服务。 Stopping the Remote Desktop Services service will also stop these services.停止远程桌面服务服务也会停止这些服务。

C:\Windows\system32>net stop "Remote Desktop Services"

Remote Desktop Services UserMode Port Redirector远程桌面服务用户模式端口重定向器

Do you want to continue this operation? (Y/N) [N]: y
The Remote Desktop Services UserMode Port Redirector service is stopping.
The Remote Desktop Services UserMode Port Redirector service was stopped successfully.

The Remote Desktop Services service is stopping.
The Remote Desktop Services service was stopped successfully

To start windows RDP启动 windows RDP

C:\Windows\system32>net start "Remote Desktop Services"

The Remote Desktop Services service is starting.
The Remote Desktop Services service was started successfully.

The Remote Desktop Services service was started successfully.

To turn off windows firewall关闭 windows 防火墙

C:\Windows\system32>netsh advfirewall set allprofiles state off

To turn on windows firewall开启windows防火墙

C:\Windows\system32>netsh advfirewall set allprofiles state on

To show windows firewall status显示 windows 防火墙状态

C:\Windows\system32>netsh advfirewall show allprofiles

You can also check this Troubleshooting RDP , Troubleshooting Windows VMs and Connect to the Windows SAC for reference.您还可以查看此RDP 故障排除、Windows VM 故障排除连接到 Windows SAC以供参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM