当前位置:网站首页>How do I close and restore ports 135, 139 and 445?
How do I close and restore ports 135, 139 and 445?
2022-06-23 20:33:00 【shawyang】
Microsoft does not recommend shutting down 135 Port and 445 port
About these ports , I communicated with Microsoft engineers by telephone , Microsoft does not recommend shutting down , It is recommended to start from the firewall or security group ( Try to use cloud platform functions , Security group ) Take action instead of closing the port , To access these ports IP paragraph ( Intranet segment ) Release in security group inbound rule , Individual clients that need to access these ports on the Internet IP The section is also released , The rest of the clients IP All access to these ports is forbidden in the section
445 Ports are required by domain services , close 445 port , The domain business is suspended
135 The port is RPC agreement , To shut down 135 Port words , Have to intervene DCOM and RPC, Many underlying services depend on DCOM and RPC, This has too much impact on the system , such as 2008R2、2012R2 System off 135 Open the scheduled task after the port ( function taskschd.msc) Report errors " Remote computer not found "(≥2016 The system does not report an error ), After rollback , Schedule task recovery , It is found through investigation that Rpc\internet The registry (reg add HKLM\SOFTWARE\Microsoft\Rpc\internet) As a result of .
It is strongly recommended not to close TCP 135 port , A large number of services need this port , Refer to the following documents https://docs.microsoft.com/zh-CN/troubleshoot/windows-server/networking/service-overview-and-network-port-requirements
If you really want to close these ports , as follows
https://blog.csdn.net/u013761036/article/details/71915237
This document closes 135、139、445 The port approach applies to all Windows System , But it's too cumbersome , I translated it into an order
all Windows The general code scheme of the system is as follows
use netstat To filter whether there is monitoring
netstat -ano|findstr :445
netstat -ano|findstr :135
netstat -ano|findstr :139
【 close 135 port 】 Restart and take effect
reg add "HKLM\SOFTWARE\Microsoft\Ole" /v "EnableDCOM" /t REG_SZ /d "N" /f
reg add "HKLM\SOFTWARE\Microsoft\Rpc" /v "DCOM Protocols" /t reg_multi_sz /d "\0" /f
reg add "HKLM\SOFTWARE\Microsoft\Rpc\Internet" /f
【 Restore 135 port 】 Restart and take effect
reg add "HKLM\SOFTWARE\Microsoft\Ole" /v "EnableDCOM" /t REG_SZ /d "Y" /f
reg add "HKLM\SOFTWARE\Microsoft\Rpc" /v "DCOM Protocols" /t reg_multi_sz /d "ncacn_ip_tcp\0" /f
powershell -Command "Remove-Item HKLM:\SOFTWARE\Microsoft\Rpc\Internet -force -Confirm:0"
or
powershell -Command "Get-Item HKLM:\SOFTWARE\Microsoft\Rpc\Internet | Remove-Item -force -Confirm:0"
Above recovery 135 Port commands apply to all Windows System
Let's talk about it alone reg delete command
perform reg delete "HKLM\SOFTWARE\Microsoft\Rpc\Internet" /f Delete Rpc\Internet Report that you have no authority ,2008R2、2012R2 Open the registry and follow the path to find Rpc\Internet Delete with the mouse ,2016/2019 Use after raising the right reg delete It can be deleted , You can also delete with the mouse
If the right is raised , It is necessary to advance psexec.exe or psexec64.exe Put it in system32 Catalog ,
https://live.sysinternals.com/PsExec.exe
https://live.sysinternals.com/PsExec64.exe
And then execute
【psexec.exe】
psexec.exe -accepteula -nobanner -i -s reg delete "HKLM\SOFTWARE\Wow6432Node\Microsoft\Rpc\Internet" /f
or
psexec.exe -accepteula -nobanner -i -s reg delete "HKLM\SOFTWARE\Microsoft\Rpc\Internet" /f
【psexec64.exe】
psexec64.exe -accepteula -nobanner -i -s reg delete "HKLM\SOFTWARE\Wow6432Node\Microsoft\Rpc\Internet" /f
or
psexec64.exe -accepteula -nobanner -i -s reg delete "HKLM\SOFTWARE\Microsoft\Rpc\Internet" /f
【 Only one network card CVM, close 139 port 】powershell After two lines of code are executed, restart the machine to take effect
$netcardGUID=(getmac /fo list|findstr Tcpip_).split("\")[2]
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\$netcardGUID /v NetBIOSOptions /T REG_DWORD /D 2 /F
【 Only one network card CVM, Restore 139 port 】powershell After two lines of code are executed, restart the machine to take effect
$netcardGUID=(getmac /fo list|findstr Tcpip_).split("\")[2]
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\$netcardGUID /v NetBIOSOptions /T REG_DWORD /D 0 /F
【 Blackstone closed 139 port 】powershell After two lines of code are executed, restart the machine to take effect
$netcardGUID=(getmac /fo list|findstr Tcpip_)[1].split("\")[2]
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\$netcardGUID /v NetBIOSOptions /T REG_DWORD /D 2 /F
【 Black stone restoration 139 port 】powershell After two lines of code are executed, restart the machine to take effect
$netcardGUID=(getmac /fo list|findstr Tcpip_)[1].split("\")[2]
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\$netcardGUID /v NetBIOSOptions /T REG_DWORD /D 0 /F
【Windows 32 Bit system close 445 port 】 Restart the machine to take effect
cmd:
REG ADD HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters /v SMBDeviceEnabled /T REG_DWORD /D 0 /F && sc config LanmanServer start= disabled && net stop lanmanserver /y
【Windows 64 Bit system close 445 port 】 Restart the machine to take effect
cmd:
REG ADD HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters /v SMBDeviceEnabled /T REG_QWORD /D 0 /F && sc config LanmanServer start= disabled && net stop lanmanserver /y
【 Restore 445 port , Universal 32 Bit and 64 position 】 It takes effect without restarting the machine
reg delete HKLM\SYSTEM\CurrentControlSet\services\NetBT\Parameters /v SMBDeviceEnabled /f
sc.exe config LanmanServer start= auto
sc.exe start LanmanServer
边栏推荐
- What cloud disk types does Tencent cloud provide? What are the characteristics of cloud disk service?
- What are the useful personnel management software? Personnel management system software ranking!
- 同花顺网上开户安全吗,佣金高不高
- What is the difference between a database and a cloud disk drive? What functions can cloud disk drives achieve?
- Kubernetes resource topology aware scheduling optimization
- Tupu software digital twin intelligent water service, breaking through the development dilemma of sponge City
- 【Golang】快速复习指南QuickReview(一)——字符串string
- How to open a domestic futures account? Which futures company is safer to open an account?
- Kinsoku Jikou Desu Sina stock interface change
- Tcp/udp Fundamentals
猜你喜欢

vs2022scanf函数的使用,使用scanf的报错-返回值被忽略:解决·方法

Rstudio 1.4 software installation package and installation tutorial

LeetCode 473. 火柴拼正方形

Importance and purpose of test

SQL聯合查詢(內聯、左聯、右聯、全聯)的語法

Syntaxe des requêtes fédérées SQL (inline, left, right, full)

增加双因素认证,不惧密码泄露,更不惧123456

5 月最大的 GameFi 崩溃受害者能否在熊市中生存?| May Monthly Report

Yaokui tower in Fengjie, Chongqing, after its completion, will be the safety tower for Sichuan river shipping with five local scholars in the company

Live sharing | Tencent cloud mongodb intelligent diagnosis and Performance Optimization Practice
随机推荐
Kinsoku jikou desu新浪股票接口变动
金九银十,靠这个细节,offer拿到手软!
Kubernetes resource topology aware scheduling optimization
深入理解和把握数字经济的基本特征
教你如何用网页开发APP
同花顺网上开户安全吗,佣金高不高
How to open a domestic futures account? Which futures company is safer to open an account?
[golang] how to realize real-time hot update of Go program
Kubernetes 资源拓扑感知调度优化
[golang] quick review guide quickreview (x) -- goroutine pool
国元期货交易软件正规吗?如何安全下载?
GL Studio 5 安装与体验
【Golang】快速复习指南QuickReview(四)——函数
LeetCode 473. 火柴拼正方形
Digital procurement transformation solution: SaaS procurement management platform promotes enterprise sunshine procurement
Eight misunderstandings, broken one by one (final): the cloud is difficult to expand, the customization is poor, and the administrator will lose control?
Check four WiFi encryption standards: WEP, WPA, WPA2 and WPA3
八大误区,逐个击破(终篇):云难以扩展、定制性差,还会让管理员失去控制权?
More than 1200 phishing kits that can intercept 2fa detected in the field
FPGA based electromagnetic ultrasonic pulse compression detection system paper + source file