reject-with icmp-port-unreachable Chain OUTPUT (policy ACCEPT) num target prot opt source destination GBase 8a MPP Cluster 产品手册 3 集群安装升级与卸载 文档版本953(2022-04-10) 南大通用数据技术股份有限公司 51 # service ip6tables status Table: filter Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT all ::/0 ::/0 state RELATED,ESTABLISHED 2 ACCEPT icmpv6 ::/0 ::/0 3 ACCEPT all ::/0 ::/0 4 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:22 5 REJECT all ::/0 ::/0 reject-with icmp6-adm-prohibited Chain FORWARD (policy ACCEPT) num target prot opt source destination 1 REJECT all ::/0 ::/0 reject-with icmp6-adm-prohibited Chain OUTPUT (policy ACCEPT) num target prot opt source destination 执行如下命令查看防火墙是否在开机时自动启动: # chkconfig --list iptables iptables 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭 # chkconfig --list ip6tables ip6tables 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭 RHEL7.X、Centos8.X:执行如下命令查看各节点的防火墙状态: #systemctl status firewalld.service SUSE:执行如下命令查看各节点的防火墙状态: #rcSuSEfirewall2 status 示例2、关闭防火墙 RHEL6.X:执行如下命令关闭防火墙,具体命令如下: # service iptables stop iptables: Flushing firewall rules: [ OK ] iptables: Setting chains to policy ACCEPT: filter [ OK ] GBase 8a MPP Cluster 产品手册 3 集群安装升级与卸载 文档版本953(2022-04-10) 南大通用数据技术股份有限公司 52 iptables: Unloading modules: [ OK ] # chkconfig iptables off 说明:如果此命令执行无效,可执行如下命令: # chkconfig iptables off --level 2345 # service ip6tables stop ip6tables: Flushing firewall rules: [ OK ] ip6tables: Setting chains to policy ACCEPT: filter [ OK ] ip6tables: Unloading modules: [ OK ] # chkconfig ip6tables off 说明:如果此命令执行无效,可执行如下命令: # chkconfig ip6tables off --level 2345 RHEL7.X、Centos8.X -- 关闭防火墙 #systemctl stop firewalld.service -- 禁止防火墙开机启动 #systemctl disable firewalld.service SUSE 11 -- 关闭操作为: #service SuSEfirewall2_setup stop #service SuSEfirewall2_init stop -- 取消开机启动防火墙: #chkconfig SuSEfirewall2_init off #chkconfig SuSEfirewall2_setup off SUSE 12 -- 关闭操作为: #systemctl stop SuSEfirewall2.service -- 取消开机启动防火墙: #systemctl disable SuSEfirewall2.service 示例3、开放端口号: 设置端口规则和开发端口的命令参考如下: RHEL6.X 1. 设置默认规则。 GBase 8a MPP Cluster 产品手册 3 集群安装升级与卸载 文档版本953(2022-04-10) 南大通用数据技术股份有限公司 53 # iptables -A INPUT -j DROP # iptables -A FORWARD -j ACCEPT 2. 开放端口,PORT 为要开放的端口号。 -- 开放TCP 端口 # iptables -I INPUT -p tcp --dport PORT -j ACCEPT # iptables -I OUTPUT -p tcp --dport PORT -j ACCEPT # iptables -I INPUT -p tcp --sport PORT -j ACCEPT # iptables -I OUTPUT -p tcp --sport PORT -j ACCEPT -- 开放UDP 端口 # iptables -I INPUT -p udp --dport PORT -j ACCEPT # iptables -I OUTPUT -p udp --dport PORT -j ACCEPT #iptables -I INPUT -p udp --sport PORT -j ACCEPT #iptables -I INPUT -p udp --sport PORT -j ACCEPT RHEL7.X、Centos8.X -- 查看已经开放的端口 #firewall-cmd --list-ports -- 开放端口(开放后需要要重启防火墙才生效),PORT 为要开放的端口号 #firewall-cmd --zone=public --add-port=PORT/tcp --permanent -- 重启防火墙 #firewall-cmd --reload SUSE 1. 手动修改/etc/sysconfig/SuSEfirewall2 配置文件(PORT1 和PORT2 代表要开放的 多个端口): #vi /etc/sysconfig/SuSEfirewall2 # TCP 端口 FW_SERVICES_EXT_TCP = "PORT1 PORT2" #UDP 端口 FW_SERVICES_EXT_UDP = "PORT1 PORT2" 2. 重启防火墙 #rcSuSEfirewall2 restart GBase 8a MPP Cluster 产品手册 3 集群安装升级与卸载 文档版本953(2022-04-10) 南大通用数据技术股份有限公司 54