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

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

  •  
  •   acbot · May 9, 2022 · 3021 views
    This topic created in 1671 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
    Archeb
    May 9, 2022❤️1
    1
    Linux 的我不知道,Windows 上你可以把 默认动态端口范围 调整成你想禁止的端口 /端口段,而且也可以按 TCP/UDP 限制

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

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