当前位置:网站首页>Increase the dynamic port range to solve TCPIP alarm

Increase the dynamic port range to solve TCPIP alarm

2022-06-24 05:49:00 shawyang

The internal and external network of the machine cannot go out , No other abnormalities found , The event viewer found that tcp/ip Several logs of the source

Increase the dynamic port range to solve tcpip The alarm

event ID4227:EVENT_TCPIP_TCP_TIME_WAIT_COLLISION

Powershell Filter :

Get-EventLog -LogName System -Source Tcpip |Where-Object {$_.EventID -eq "4227" -or $_.EventID -eq "4231" -or $_.EventID -eq "4266"} |FT TimeGenerated,EventID,EntryType,Source,Message

TCP/IP Unable to establish outgoing connection , Because the selected local endpoint was recently used to connect to the same remote endpoint . When opening and closing outgoing connections at a high rate , This will cause all available local ports to be used , And force TCP/IP Reuse the local port for outgoing connections , This error usually occurs . In order to minimize the number According to the risk of damage , In a continuous connection between a given local endpoint and a given remote endpoint , TCP/IP The standard needs to wait for the shortest period of time .

Solution :

netsh int ipv4 set dynamicport tcp start=5001 num=60535

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "TcpTimedWaitDelay" /t REG_DWORD /d 30 /f

this 2 The following sentence adjusts 2 Registry (s)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

"MaxUserPort"=dword:0000f077

"TcpTimedWaitDelay"=dword:0000001e

No need to restart the machine

Be careful : stay win10 and server2019 In the system , When performing adjustment tcp Dynamic port range command , It doesn't generate automatically MaxUserPort, There is no need for human intervention , Operating system is hidden MaxUserPort; stay <win10 and server2019 In the system , Perform adjustments tcp Dynamic port range command , It will generate automatically MaxUserPort.

MaxUserPort Not the maximum user port number , It is the maximum number of user ports , The algorithm is tcp The number of ports included in the dynamic port range +1024.

Such as execution netsh int ipv4 set dynamicport tcp start=10000 num=55535 ,tcp The dynamic port range is 10000~65534, common 55535 Ports ,MaxUserPort yes 55535+1024=56559

If you execute netsh int ipv4 set dynamicport tcp start=49152 num=16384 Restoring the original dynamic range will automatically generate MaxUserPort=17408,tcp The dynamic port range is 49152 ~65535, common 16384 Ports ,MaxUserPort yes 16384+1024=17408

I usually use dynamicport tcp 5001~65535, The perform netsh int ipv4 set dynamicport tcp start=5001 num=60535

Plus

<2012R2 and Win8.1 The system of , perform :

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "TcpTimedWaitDelay" /t REG_DWORD /d 30 /f

≥2012R2 and Win8.1 The system of , perform :

reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "TcpTimedWaitDelay" /t REG_DWORD /d 2 /f

Key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

Value:

TcpTimedWaitDelay

Data Type:

REG_DWORD

Range:

Windows Server 2012 and earlier: 30-300 (decimal)Windows 8 and earlier: 30-300 (decimal)Windows Server 2012 R2 and later: 2-300 (decimal)Windows 8.1 and later: 2-300 (decimal)

Default value:

0x78 (120 decimal)

Recommended value:

30

Value exists by default?

No, needs to be added.

原网站

版权声明
本文为[shawyang]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/08/20210803175950449T.html

猜你喜欢

    随机推荐