0
点赞
收藏
分享

微信扫一扫

linux命令防火墙

_阿瑶 2022-04-13 阅读 123
linuxcentos

一. firewalld防火墙(centos7后)

  1. 查看防火墙暴露端口:
firewall-cmd --zone=public --list-ports
  1. 查看防火墙某个端口是否开放:
firewall-cmd --query-port=3306/tcp
  1. 开放防火墙端口3306,需重新加载
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
  1. 关闭防火墙端口5672:
firewall-cmd --zone=public --remove-port=5672/tcp --permanent
  1. 查看防火墙状态:
systemctl status firewalld
  1. 关闭防火墙:
systemctl stop firewalld
  1. 打开防火墙:
systemctl start firewalld
  1. 开放一段端口后需重新加载否则失效:
firewall-cmd --zone=public --add-port=40000-45000/tcp --permanent
firewall-cmd --reload
  1. 永久关闭防火墙:
systemctl disable firewalld

iptables防火墙(centos7前)

  1. 查看防火墙状态
service iptables status
  1. 停止防火墙
service iptables stop
  1. 启动防火墙
service iptables restart
  1. 重启防火墙
service iptables restart
  1. 永久关闭防火墙
chkconfig iptables off
  1. 永久关闭后重启
chkconfig iptables on
  1. 打开某8080端口
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
举报

相关推荐

Linux防火墙命令

linux 防火墙命令

Linux关闭防火墙命令

Linux防火墙

Linux 入门(4)防火墙命令

linux防火墙

防火墙命令大全

思科防火墙命令

0 条评论