LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
12
返回列表 发新帖
楼主: jkm

oracle居然与iptables的设置有关?

[复制链接]
 楼主| 发表于 2003-4-21 16:55:56 | 显示全部楼层

补充

lsnrctl stop,start 执行很快的时候oracle就不正常,而很慢的时候就正常
发表于 2003-4-22 01:34:22 | 显示全部楼层
其中一台连/etc/sysconfig/iptables文件都不存在,问题也是一样.也许是我的oracle设置有问题,呵呵

如果在没有防火墙的时候ORACLE都不工作,那就应该好好检查一下ORACEL本身了。
 楼主| 发表于 2003-4-22 16:29:01 | 显示全部楼层

更正

现在发现,其实在iptables -F以后,也就是在
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain RH-Lokkit-0-50-INPUT (0 references)
target     prot opt source               destination
的情况下,oracle使用是完全正常的
我现在改了以下script,如下
#!/bin/sh
echo "Starting iptables rules..."
/sbin/iptables -F INPUT
/sbin/iptables -F OUTPUT
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s  10.137.18.194/26 --dport ssh -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s  10.137.16.0/22 --dport 21 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s  10.137.16.0/22 --dport 20 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s  10.137.18.194/26 --dport 139 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s  10.137.18.194/26 --dport 1521 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s  10.137.18.194/26 --dport 6003 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s  10.137.18.194/26 --dport 32773 -j ACCEPT
运行以后,iptables -L显示:
Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:ssh
ACCEPT     tcp  --  10.137.16.0/22       anywhere           tcp dpt:ftp
ACCEPT     tcp  --  10.137.16.0/22       anywhere           tcp dpt:ftp-data
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:netbios-ssn
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:1521
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:6003
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:32773

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain RH-Lokkit-0-50-INPUT (0 references)
target     prot opt source               destination
在这种情况下,开始oracle正常,几分钟后开始出现错误:"ORA-12545:连接因对象主机或对象不存在而失败"
发表于 2003-4-23 11:35:12 | 显示全部楼层
对照我上面贴的表,你会发现很多ORACLE端口都被你的规则屏蔽了。我把你的script修改了一下,我假定你想允许来自10.137.18.194/26的SSH,来自10.137.18.194/26的FTP,和来自10.137.18.194/26的ORACLE请求。

#!/bin/sh
echo "Starting iptables rules..."
/sbin/iptables -F

/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -P FORWARD DROP
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport ssh -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.16.0/22 --dport 20:21 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport 139 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport 1521 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport 1810 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport 1748 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport 1754 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport 1808:1809 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport 6100 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport 6200 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport 6003 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport 6667 -j ACCEPT
/sbin/iptables -A INPUT -p tcp -s 10.137.18.194/26 --dport 32773 -j ACCEPT
===============
我没有加ORACLE HTTP和WEB CACHE的口,如果你需要,也可以加上试试。

另外,如果你从另外一台机器(在10.137.18.194/26网段中的)联上述服务器的ORACLE,请确认两边在没有防火墙的时候通讯无误,再起防火墙测试。
 楼主| 发表于 2003-4-23 19:32:01 | 显示全部楼层

谢谢

我明天会去马上试试看
 楼主| 发表于 2003-4-24 07:59:52 | 显示全部楼层

还是不行啊

我试过在没有防火墙的时候确实是正常的,在加了防火墙如下:
[root@Backup root]# iptables -L
Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:ssh
ACCEPT     tcp  --  10.137.16.0/22       anywhere           tcp dpt:ftp
ACCEPT     tcp  --  10.137.16.0/22       anywhere           tcp dpt:ftp-data
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:netbios-ssn
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:1521
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:6003
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:32773
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:1810
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:afs3-fileserver
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:1748
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:1754
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:1808
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:1809
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:6100
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:6200
ACCEPT     tcp  --  10.137.18.192/26     anywhere           tcp dpt:ircd

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain RH-Lokkit-0-50-INPUT (0 references)
target     prot opt source               destination
以后,就不行
此时看到netstat -atn为:
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:32768           0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:32769         0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:515             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:32773           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:32775           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:38195         127.0.0.1:1521          ESTABLISHED
tcp        0      0 10.137.18.244:139       10.137.18.249:1032      ESTABLISHED
tcp        0      0 10.137.18.244:1521      10.137.18.249:2596      TIME_WAIT
tcp        0    272 10.137.18.244:22        10.137.18.249:1049      ESTABLISHED
tcp        0      0 127.0.0.1:1521          127.0.0.1:38195         ESTABLISHED
tcp        0      0 10.137.18.244:22        10.137.18.249:1906      ESTABLISHED
我看到此时的1521 port连接为time_wait,不知道为什么会这样,在没有连接的时候没看到有1521的连接
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:32768           0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:32769         0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:515             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:32773           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:32775           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:38195         127.0.0.1:1521          ESTABLISHED
tcp        0      0 10.137.18.244:139       10.137.18.249:1032      ESTABLISHED
tcp        0    272 10.137.18.244:22        10.137.18.249:1049      ESTABLISHED
tcp        0      0 127.0.0.1:1521          127.0.0.1:38195         ESTABLISHED
tcp        0      0 10.137.18.244:22        10.137.18.249:1906      ESTABLISHED
 楼主| 发表于 2003-4-24 08:01:17 | 显示全部楼层
好象就是激活不了连接
发表于 2003-4-27 23:02:42 | 显示全部楼层
当防火墙加载了以后,从运行ORACLE的机器上联接ORACLE,能联通吗?如果能,你就应该检查一下iptables里设置的source IP(如10.137.18.192/26)是不是把你的客户端机器给屏蔽掉了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表