易秋网络旗下全球VPS测评站
云主机测评/独立服务器测评/主机优惠码

linux如何关闭无用端口/Linux禁用111端口

收到机房发来预警,就是说你的机器端口111开着,会引发Ddos攻击啥的,安全起见还是禁用掉没用的端口。

> Dear Sir or Madam,
>
> the Portmapper service (portmap, rpcbind) is required for mapping RPC
> requests to a network service. The Portmapper service is needed e.g.
> for mounting network shares using the Network File System (NFS).
> The Portmapper service runs on port 111 tcp/udp.
>
> In addition to being abused for DDoS reflection attacks, the
> Portmapper service can be used by attackers to obtain information
> on the target network like available RPC services or network shares.
>
> Over the past months, systems responding to Portmapper requests from
> anywhere on the Internet have been increasingly abused DDoS reflection
> attacks against third parties.

下面简单记录下禁用111端口过程。

1)、查看本机正在监听的端口:

root@Proxmox-VE / #  netstat -tlnup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:8006            0.0.0.0:*               LISTEN      1550/pveproxy
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      683/rpcbind
tcp        0      0 127.0.0.1:85            0.0.0.0:*               LISTEN      1509/pvedaemon
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      4957/sshd
tcp        0      0 0.0.0.0:3128            0.0.0.0:*               LISTEN      1582/spiceproxy
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1429/master
tcp6       0      0 :::111                  :::*                    LISTEN      683/rpcbind
tcp6       0      0 :::22                   :::*                    LISTEN      4957/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      1429/master
udp        0      0 0.0.0.0:111             0.0.0.0:*                           683/rpcbind
udp        0      0 0.0.0.0:859             0.0.0.0:*                           683/rpcbind
udp6       0      0 :::111                  :::*                                683/rpcbind
udp6       0      0 :::859                  :::*                                683/rpcbind

2)、查看正在监听的111端口,由哪个服务使用

root@Proxmox-VE / # cat /etc/services | grep -w 111
sunrpc          111/tcp         portmapper      # RPC 4.0 portmapper
sunrpc          111/udp         portmapper

3)、查看使用111端口服务的详细状态信息

root@Proxmox-VE / # systemctl list-unit-files --all |grep portmapper
root@Proxmox-VE / #  systemctl list-unit-files --all |grep rpcbind
rpcbind.service                        enabled
rpcbind.socket                         enabled
rpcbind.target                         static

4)、关闭正在使用111端口的服务,并设置开机不启动该服务

root@Proxmox-VE / #  systemctl stop rpcbind.socket
root@Proxmox-VE / #  systemctl disable rpcbind.socket
Removed /etc/systemd/system/sockets.target.wants/rpcbind.socket.

操作完毕后,再看看111端口禁用了

教程参考:https://www.wandouip.com/t5i283482/

赞(6) 打赏
版权归求VPS所有,未经允许不准转载!求VPS » linux如何关闭无用端口/Linux禁用111端口
【声明】:求VPS,易秋网络旗下专业VPS测评站,主要侧重筛选全球质量比较好的VPS、云主机以及独立服务器,并且进行简单测评,仅供参考。因为全国网络差异较大,求VPS的VPS以及独立服务器测评数据仅对当时的测评环境有效。求VPS不强制网友购买本站介绍的VPS以及独立服务器资源,如果网友购买了本站介绍的资源,风险自担!

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏