标签:切换 out ble 生效 systemctl 访问 commit related start
CentOS 7防火墙
?
参考
firewalld基本使用
?
参考
CentOS7使用firewalld打开关闭防火墙与端口
CentOS6.5 配置防火墙+允许指定ip访问端口
?
firewalld基本使用
?
1 systemctl start firewalld #启动
2 systemctl stop firewalld #关闭
3 systemctl status firewalld #查看状态
4 systemctl disable firewalld #开机禁用
5 systemctl enable firewalld #开机启用
?
?
1 systemctl start firewalld.service #启动一个服务
2 systemctl stop firewalld.service #关闭一个服务
3 systemctl restart firewalld.service #重启一个服务
4 systemctl status firewalld.service #显示某服务状态
5 systemctl enable firewalld.service #开机时启用
6 systemctl disable firewalld.service #开机时禁用
7 systemctl is-enabled firewalld.service #查看服务是否开机启动
8 systemctl list-unit-files|grep enabled #查看已启动的服务列表
9 systemctl --failed #查看启动失败的服务列表
?
?
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#添加一个端口
2 firewall-cmd --zone=public --add-port=80/tcp --permanent
3#-permanent永久生效,没有此参数重启后失效
4
5#重新载入
6 firewall-cmd --reload
7
8#查看端口
9 firewall-cmd --zone= public --query-port=80/tcp
10
11#删除端口
12 firewall-cmd --zone=public --remove-port=80/tcp --permanent
?
?
关闭firewall
1 service firewalld stop systemctl disable firewalld.service
?
安装iptables
1 yum install iptables-services
?
编辑iptables配置
1 vi /etc/sysconfig/iptables
?
完整iptables配置文件案例
1 Firewall configuration written by system-config-firewall Manual customization of this file is not recommended.
2 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0]
3 -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
4 -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT
5 -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
6 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
7 -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
8 -A INPUT -j REJECT --reject-with icmp-host-prohibited
9 -A FORWARD -j REJECT --reject-with icmp-host-prohibited
10 COMMIT
标签:切换 out ble 生效 systemctl 访问 commit related start
原文地址:https://www.cnblogs.com/wan117/p/12073805.html