如何更改/查看 Windows 机器上的临时端口范围? [英] How to change/view the ephemeral port range on Windows machines?

查看:55
本文介绍了如何更改/查看 Windows 机器上的临时端口范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Linux 中,我可以使用 /proc/sys/net/ipv4/ip_local_port_range 文件查看或更改临时端口范围.

In Linux I can view or change the ephemeral port range using the /proc/sys/net/ipv4/ip_local_port_range file.

如何查看或更改 Windows 机器上的临时端口范围?

How can I view or change the ephemeral port range on a Windows machine?

推荐答案

http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html#Windows 说:

根据 Microsoft 知识库文章 929851.同一篇文章还展示了如何根据需要更改范围,但默认范围现在对于大多数服务器来说已经足够了.

As of Windows Vista and Windows Server 2008, Windows now uses a large range (49152-65535) by default, according to Microsoft Knowledgebase Article 929851. That same article also shows how you can change the range if desired, but the default range is now sufficient for most servers.

对于较旧的 Windows 操作系统(Windows XP 和较早版本),Windows 使用传统的 BSD 范围 1024 到 4999 作为其临时端口范围.不幸的是,您似乎只能设置临时端口范围的上限.以下信息摘自 Microsoft 知识库文章 196271:

For older Windows operating systems (Windows XP and older), Windows uses the traditional BSD range of 1024 through 4999 for its ephemeral port range. Unfortunately it appears that you can only set the upper bound of the ephemeral port range. Here is information excerpted from Microsoft Knowledgebase Article 196271:

  • 启动注册表编辑器 (Regedt32.exe).
  • 在注册表中找到以下项:HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters
  • 在编辑"菜单上,单击添加值",然后添加以下注册表值:

  • Start Registry Editor (Regedt32.exe).
  • Locate the following key in the registry: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters
  • On the Edit menu, click Add Value, and then add the following registry value:

值名称:MaxUserPort 数据类型:REG_DWORD 值:65534 <例如>

有效范围:5000-65534(十进制)默认值:0x1388(十进制5000)

Valid Range: 5000-65534 (decimal) Default: 0x1388 (5000 decimal)

说明:此参数控制应用程序向系统请求任何可用用户端口时使用的最大端口号.通常,临时(即短期)端口分配在 1024 和 5000 之间(含).

Description: This parameter controls the maximum port number used when an application requests any available user port from the system. Normally, ephemeral (that is, short-lived) ports are allocated between the values of 1024 and 5000 inclusive.

注意:还有另一篇相关的知识库文章 (812873) 声称允许您设置排除范围,这可能意味着您可以排除端口 1024-9999(例如)以使临时端口范围为 10000-65534.但是,我们还不能让它工作(截至 2004 年 10 月).

Note: There is another relevant KB article (812873) which claims to allow you to set an exclusion range, which could mean that you could exclude ports 1024-9999 (for example) to have the ephemeral port range be 10000-65534. However, we have not been able to get this to work (as of October 2004).

这篇关于如何更改/查看 Windows 机器上的临时端口范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆