Linux防火墙相关命令(开启防火墙、关闭防火墙、添加ip白名单等)

  1. 查看防火状态
    systemctl status firewalld
    service  iptables status
    
  2. 暂时关闭防火墙
    systemctl stop firewalld
    service  iptables stop
    
  3. 永久关闭防火墙
    systemctl disable firewalld
    chkconfig iptables off
    
  4. 启动防火墙
    systemctl start firewalld
    
  5. 重启防火墙
    systemctl enable firewalld
    service iptables restart  
    
  6. 设置开机启动
    systemctl enable firewalld
    
  7. 停止并禁用开机启动
    sytemctl disable firewalld
    
  8. 在指定区域打开端口(记得重启防火墙)
    firewall-cmd --zone=public --add-port=80/tcp
    
    永久生效再加上 --permanent
    firewall-cmd --zone=public --add-port=5060-5059/udp --permanent
    

你可能感兴趣的:(日常工作总结,linux,tcp/ip,运维)