当前位置:   article > 正文

Linux防火墙命令_port protocol= tcp

port protocol= tcp

1.查看防火墙状态:
firewall-cmd --state 或 systemctl status firewalld
2.开启防火墙命令:
systemctl start firewalld.service
3.关闭防火墙命令:
systemctl stop firewalld.service
4.开机自启:
systemctl enable firewalld.service
5.关闭开机自启:
systemctl disable firewalld.service
6.查看端口:
firewall-cmd --zone=public --query-port=8080/tcp
7.删除端口:
firewall-cmd --zone=public --remove-port=8080/tcp --permanent
8.查看开启了哪些端口:
firewall-cmd --list-port
9.查看开启了哪些服务:
firewall-cmd --list-service
10.允许一个端口、或者一个端口范围
默访认都允许访问
firewall-cmd --permanent --zone=public --add-port=100-500/tcp
配置效果:<port protocol="tcp" port="100-500"/>
firewall-cmd --permanent --zone=public --add-port=100/udp 
配置效果:<port protocol="udp" port="100"/>
11.允许某个IP访问某端口
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.166" port protocol="tcp" port="6379" accept"   加一个IP
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.142.0/24" port protocol="tcp" port="6379-6380" accept"   加一个IP段、端口段
12.查看已启动的服务列表:systemctl list-unit-files|grep enabled
13.查看启动失败的服务列表:systemctl --failed
14.查看版本:firewall-cmd --version
15.查看帮助:firewall-cmd --help
16.更新防火墙规则:firewall-cmd --reload
17.查看区域信息: firewall-cmd --get-active-zones
18.查看指定接口所属区域:firewall-cmd --get-zone-of-interface=eth0
19.取消拒绝状态:firewall-cmd --panic-off
20.查看是否拒绝:firewall-cmd --query-panic
 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/282498
推荐阅读
相关标签
  

闽ICP备14008679号