Linux Centos firewalld 使用
创始人
2025-02-10 19:03:35
0

一、 firewalld 基操

       start: systemctl start firewalld
    stop: systemctl stop firewalld
  status: systemctl status firewalld 
  开机禁用  : systemctl disable firewalld
  开机启用  : systemctl enable firewalld

二、systemctl介绍
  启动服务:systemctl start firewalld.service
  关闭服务:systemctl stop firewalld.service
  重启服务:systemctl restart firewalld.service
  显示服务的状态:systemctl status firewalld.service
  在开机时启用服务:systemctl enable firewalld.service
  在开机时禁用服务:systemctl disable firewalld.service
  查看服务是否开机启动:systemctl is-enabled firewalld.service
  查看已启动的服务列表:systemctl list-unit-files|grep enabled
  查看启动失败的服务列表:systemctl --failed
 
三、firewalld-cmd 命令
 
  1、查看版本: firewall-cmd --version
  2、查看帮助: firewall-cmd --help
  3、显示状态: firewall-cmd --state
  4、查看所有打开的端口: firewall-cmd --zone=public --list-ports
  5、更新防火墙规则: firewall-cmd --reload
  6、查看区域信息:  firewall-cmd --get-active-zones
  7、查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
  8、拒绝所有包:firewall-cmd --panic-on
  9、取消拒绝状态: firewall-cmd --panic-off
  10、查看是否拒绝: firewall-cmd --query-panic
 
四、端口操作命令
  1、添加:firewall-cmd --zone=public --add-port=1222/tcp --permanent    

       -permanent永久生效,没有此参数重启后失效
  2、重载:firewall-cmd --reload
  3、查看:firewall-cmd --zone= public --query-port=1222/tcp
  4、删除:firewall-cmd --zone= public --remove-port=1222/tcp --permanent

五、 访问连接配置

1、ssh 连接允许指定ip访问

firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.0.1" port protocol="tcp" port="22" accept'

2、ssh 拒绝指定ip

firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.0.1" port protocol="tcp" port="22" reject'

3、ssh 连接 移除公共访问

firewall-cmd --permanent --zone=public --remove-service=ssh

4、ssh连接放开访问

firewall-cmd --permanent --zone=public --add-service=ssh

相关内容

热门资讯

一直以来!哈局八张辅助,小闲川... 一直以来!哈局八张辅助,小闲川南辅助工具,技巧教程(确实真的是有挂)-哔哩哔哩1、小闲川南辅助工具a...
透视好友房!wepoker透视... 透视好友房!wepoker透视底牌脚本,wepoker手机版辅助,烘培教程(其实有挂)-哔哩哔哩1、...
透视检测!wepoker轻量版... 透视检测!wepoker轻量版有透视吗(透视)开挂辅助插件(总是真的有挂)-哔哩哔哩1)wepoke...
这一现象值得深思!仟众部落辅助... 这一现象值得深思!仟众部落辅助,四川途游辅助软件,wepoke教程(本来存在有挂)-哔哩哔哩1、这一...
透视黑科技!werplan辅助... 透视黑科技!werplan辅助,wepoker透视器免费,演示教程(总是真的是有挂)-哔哩哔哩1、玩...
透视黑科技!福建大菠萝万能辅助... 透视黑科技!福建大菠萝万能辅助器(透视)开挂辅助器(总是真的是有挂)-哔哩哔哩福建大菠萝万能辅助器辅...
据报道!拱趴大菠萝辅助神器,情... 据报道!拱趴大菠萝辅助神器,情怀游戏字牌辅助,可靠教程(一直真的有挂)-哔哩哔哩在进入拱趴大菠萝辅助...
透视辅助!aapoker插件,... 透视辅助!aapoker插件,pokerworld辅助器,方案教程(果然真的是有挂)-哔哩哔哩;透视...
据权威媒体报道!微乐卡五星祈福... 据权威媒体报道!微乐卡五星祈福有用吗,创思维激k辅助器下载,揭秘教程(竟然真的是有挂)-哔哩哔哩1、...
透视新版!wepoker看底牌... 透视新版!wepoker看底牌(透视)开挂辅助脚本(本来是有挂)-哔哩哔哩1)wepoker看底牌辅...