实验环境:
操作系统 : Red Hat Enterprise Linux Server release 5.7 (Tikanga)
数据库版本: Oracle Database 12c Release 12.1.0.1.0 - 64bit Production
前两天在服务器上安装了ORACLE 12c后,从客户端连接到数据库的时候,出现ORA-12170错误,由于以前在博客的ORA-12170:TNS:连接超时总结过这个问题,所以很快定位到是防火墙问题,于是编辑iptables,开放1521端口,然后重新启动防火墙
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT
但是依然没有解决问题,于是有重新检查各项:ping、listener.ora、 tnsnames.ora等配置都OK,tnsping报ORA-12535错误,于是我再次确认防火墙是否开启了1521端口,如下所示,
[root@getoraclelnx01 sysconfig]# iptables -L -n Chain INPUT (policy ACCEPT) target prot opt source destination RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0 Chain FORWARD (policy ACCEPT) target prot opt source destination RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0 Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain RH-Firewall-1-INPUT (2 references) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255 ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0 ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:631 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:5901 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:1521 [root@getoraclelnx01 sysconfig]#
从上面可以看出,防火墙开放了1521端口,于是我尝试关闭防火墙,发现居然可以从客户端连接到服务器了,那么肯定是防火墙配置问题,重启防火墙,用telnet xxx.xxx.xxx.xxx 1521 测试是否
最后发现居然是配置开放1521端口的时候,将配置选项放在-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited下面导致的,
于是调整顺序保存后,重启iptables服务,问题解决了。看来根本原因还是对iptables不熟悉导致,需要花点时间去研究下Linux下防火墙的配置。
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 5901 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 1521 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
相关推荐
iptables-1.4.21-35.el7.i686.rpm和iptables-services-1.4.21-35.e
centOS7适用,iptables-services-1.4.21-35.el7.x86_64.rpm
iptables-services-1.4.21-28.el7.x86_64.rpm 下载安装
iptables-services-1.4.21-34.el7.x86_64.rpm
centos7 iptables-services-1.4.21-17.el7.x86_64.rpm 安装包 下载
linux iptables 防火墙配置文件
Linux-Netfilter&iptables实现机制的分析及应用.pdf
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
iptables-sesrvices1.4.21版本
centos7离线安装iptables,iptables-1.4.21-34.el7.x86_64.rpm和iptables-services-1.4.21-34.el7.x86_64.rpm
替换系统自带防火墙应用,直接rpm -ivh安装即可 需要先查找并卸载系统自带的firewalld iptables配置 vi /etc/sysconfig/iptables
iptables rpm包(redhat 6.9 )
LINUX之iptables-tutorial-1-1-19
iptables iptables iptables iptables iptables iptables iptables iptables iptables iptables iptables iptables iptables iptables iptables iptables
centos6-iptables-1.4.7-16.el6.x86-64
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
替换系统自带防火墙应用,直接rpm -ivh安装即可 需要先查找并卸载系统自带的firewalld iptables配置 vi /etc/sysconfig/iptables
离线安装包,亲测可用
本书深入了解了TCP / IP层,协议,数据包格式和逐步配置以实现安全的Linux环境。
CentOS6 64位(ipv4 only,如需ipv6请私信我)iptables防火墙安装rpm文件,安装方法: rpm -ivh iptables-1.4.7-19.el6.x86_64.rpm or yum localinstall -y iptables-1.4.7-19.el6.x86_64.rpm 启动: service ...