centos6及以下
防火墙开启1521端口
vi /etc/sysconfig/iptables
添加
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT
centos7及以上
查看防火墙状态:
firewall-cmd --state (若为not running : systemctl start firewall )
添加开放的端口
firewall-cmd --add-port=8090/tcp --permanent
重载防火墙
firewall-cmd --reload
查看目前开放的端口
firewall-cmd --list-ports
如果是centos7 要返回到更经典的iptables设置。
首先,停止并屏蔽firewalld服务:
systemctl stop firewalld
systemctl mask firewalld
然后,安装iptables-services软件包:
yum install iptables-services
在启动时启用服务:
systemctl enable iptables
管理服务
systemctl [stop|start|restart] iptables
保存防火墙规则可以如下进行:
service iptables save
systemctl start iptables给予 Failed to start iptables.service在CentOS 7上不起作用
尝试以下命令iptables-save
iptables-save > /etc/sysconfig/iptables