首页 > 编程知识 正文

windows虚拟内存能不能清理,windows虚拟内存删除

时间:2023-05-03 23:38:01 阅读:231216 作者:4518

目录

一、虚拟机扩容后,C盘可用空间变小。

二、3389被少量sync攻击后,mstsc连接不上。


       

       前段时间处理了两个windows的问题,感觉有点意义,记录一下,一个是虚拟机扩容后,C盘可用空间变小,一个是3389端口被少量syn后,mstsc 连接不上windows.

一、虚拟机扩容后,C盘可用空间变小。

这是由于机器内存增加,windows系统自动增大了虚拟内存的体积造成的,有以下两个原因:

1、内存大小和休眠文件大小有直接关系,一般休眠文件等于内存大小    hiberfil.sys

2、加了内存之后,系统自动分配的虚拟内存也会增多,所以C盘空间会大量被占到用。  pagefile.sys

 

重新设置虚拟内存大小即可,方法如下:

1、右击“计算机”,选择“属性”;

2、在弹出的窗口中选择“高级系统设置”,然后点击“性能”这一栏中的“设置...”按钮;

3、在弹出的对话框中选择“高级”选项卡,然后点击“更改..."进行虚拟内存的设置;

4、在弹出的窗口中取消勾选“自动管理所有驱动器的分页文件大小(A)”,然后选择要设置虚拟内存的盘符,勾选“自定义大小”,在设置了合适的虚拟内存大小后点击设置,最后点击确定完成设置操作。

 

上图为腾讯云的设置,我们可以参照。

 

休眠文件关闭: power -h off

调节休眠文件大小:powercfg hibernate size XX

 

二、3389被少量sync攻击后,mstsc连接不上。

用户报障过来说 3389 远程连接不上,立即排查

表现大概就是telnet 3389端口,表现是一会通,一会不通,不通的情况下抓包分析是windows内部reject了这个连接。

1、当时通过抓宿主机上的包,发现有少量的syn包过,然后guest 回了syn+ack后,对端还是只有持续少量的syn包过

2、随即判断可能是这个这个少量的syn包导致,大概一秒会有1到2个sync攻击过来。 然后用户就rdp远程登陆不上了。

3、1/2秒不算高频,不应该的,syn没完成,如果能稳定重现,那可能是windows 防火墙防flood的功能

4、于是把远程连接端口改成其它端口,发现就没有问题,所以判断可能是windows防火墙的防flood的作用。

于是搜索资料如下:

To protect the network against SYN attacks, follow these generalized steps, explained later in this document:

Enable SYN attack protectionSet SYN protection thresholdsSet additional protectionsEnable SYN Attack Protection

The named value to enable SYN attack protection is located beneath the registry key: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpIpParameters.

Value name: SynAttackProtect

Recommended value: 2

Valid values: 0, 1, 2

Description: Causes TCP to adjust retransmission of SYN-ACKS. When you configure this value the connection responses timeout more quickly in the event of a SYN attack. A SYN attack is triggered when the values of TcpMaxHalfOpen or TcpMaxHalfOpenRetried are exceeded.

Set SYN Protection Thresholds

The following values determine the thresholds for which SYN protection is triggered. All of the keys and values in this section are under the registry key HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpIpParameters. These keys and values are:

Value name: TcpMaxPortsExhaustedRecommended value: 5Valid values: 0–65535Description: Specifies the threshold of TCP connection requests that must be exceeded before SYN flood protection is triggered.Value name: TcpMaxHalfOpenRecommended value data: 500Valid values: 100–65535Description: When SynAttackProtect is enabled, this value specifies the threshold of TCP connections in the SYN_RCVD state. When SynAttackProtect is exceeded, SYN flood protection is triggered.Value name: TcpMaxHalfOpenRetriedRecommended value data: 400Valid values: 80–65535Description: When SynAttackProtect is enabled, this value specifies the threshold of TCP connections in the SYN_RCVD state for which at least one retransmission has been sent. When SynAttackProtect is exceeded, SYN flood protection is triggered.

参考资料: https://www.24x7serversolutions.com/blog/how-to-protect-windows-server-from-syn-flood/

                https://social.technet.microsoft.com/Forums/en-US/c55aa101-059d-491e-9fc2-73b5d8171eb8/protect-against-syn-attacks

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。