Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
acbot
V2EX  ›  Linux

Linux 和 Windows 能禁止程序绑定和使用某些端口吗?

  •  
  •   acbot · May 9, 2022 · 2697 views
    This topic created in 1481 days ago, the information mentioned may be changed or developed.

    Linux 和 Windows 能禁止程序绑定和使用某些端口吗? 比如:我不想让任何程序绑定和使用 9000 端口 或 8000-9000 端口段,如果能精确到 UDP ,TCP 就更好了,这样的需求有没有办法实现,如何配置?

    Supplement 1  ·  May 9, 2022
    这里主要是指服务端程序不能显示绑定这些端口!
    6 replies    2022-05-09 14:37:55 +08:00
    Archeb
        1
    Archeb  
       May 9, 2022   ❤️ 1
    Linux 的我不知道,Windows 上你可以把 默认动态端口范围 调整成你想禁止的端口 /端口段,而且也可以按 TCP/UDP 限制

    https://docs.microsoft.com/zh-CN/troubleshoot/windows-server/networking/default-dynamic-port-range-tcpip-chang

    之前就被这个坑了一把,某个程序把这个范围调成了我常用的端口段导致我一大堆代理软件开不起来
    Archeb
        2
    Archeb  
       May 9, 2022 via iPhone
    netsh int ipv4 show excludedportrange protocol=tcp
    搜了下,还有个保留端口段的设置
    acbot
        3
    acbot  
    OP
       May 9, 2022
    @Archeb 谢谢!
    recall704
        4
    recall704  
       May 9, 2022
    Linux:
    ip_local_reserved_ports ip_local_port_range
    acbot
        5
    acbot  
    OP
       May 9, 2022
    @recall704 谢谢,如果是服务程序显示绑定,这两个参数能起作用吗?
    pocketz
        6
    pocketz  
       May 9, 2022
    @Archeb 被坑过+1 ,每次开机被 Hyper-V 随机占用
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   835 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 21:25 · PVG 05:25 · LAX 14:25 · JFK 17:25
    ♥ Do have faith in what you're doing.