Cent OS firewall Related

Centos7 open and view ports

  1. Install a firewall
    yum install -y firewalld yum install -y firewall-config
  2. Open / close ports

     firewall-cmd --zone=public --add-port=5672/tcp --permanent   # 开放5672端口  
     firewall-cmd --zone=public --remove-port=5672/tcp --permanent  #关闭5672端口  
     firewall-cmd --reload   # 配置立即生效 
  3. View all open firewall ports
    firewall-cmd --zone=public --list-ports

  4.  If you want to turn off the firewall ports open too much, too much trouble, you can turn off the firewall, security self-assessment
    systemctl stop firewalld.service

  5.  Check firewall status 
    firewall-cmd --state

  6.  Check listening port
    netstat -lnpt
    PS: centos7 no default netstat command, net-tools tools need to be installed
    yum install -y net-tools
  7.   Check the port is occupied by what process
    netstat -lnpt |grep 5672
  8.  To view the details of the process
    ps 6832
  9. Abort the process
    kill -9 6832

Guess you like

Origin www.cnblogs.com/yhongyin/p/11117799.html