centos7开启关闭端口

  • Post author:
  • Post category:其他


一、查看端口开启状态

[zhujiang@localhost n2]$ sudo firewall-cmd –query-port=9998/udp

[sudo] password for zhujiang:

no

二、开启端口


[zhujiang@localhost n2]$ sudo firewall-cmd –add-port=9998/udp –permanent

success

–permanent表示永久生效,重启不会丢失配置。

三、关闭端口

[zhujiang@localhost n2]$ sudo firewall-cmd –remove-port=9998/udp –permanent

Warning: NOT_ENABLED: 9998:udp

success

重新加载配置

[zhujiang@localhost n2]$ sudo firewall-cmd –reload

success

[zhujiang@localhost n2]$



版权声明:本文为zj_jim原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。