需求:
目前有2台服务器,服务器A是应用服务器 IP地址为192.168.13.6:222(外网地址为:111.81.35.37:1111)
服务器B是ORACLE数据库服务器 IP地址为192.168.13.111 没有外网地址
A可以访问B,客户端服务器可以访问A服务器,但是不能直接访问数据库服务器B,
这将导致我们平常的PL SQL DEVELOPER 不能练到数据库中。
目前采用解决方法如下:
1、在 /etc/sysctl.conf 增加net.ipv4.ip_forward = 1 允许转发
2、防火墙中配置转发规则
[root@appserver01 ~]# iptables -t nat -A PREROUTING -p tcp -m tcp --dport 222 -j DNAT --to-destination 192.168.13.111:1521
[root@appserver01 ~]#
[root@appserver01 ~]# iptables -t nat -A POSTROUTING -p tcp -m tcp --dport 1521 -j SNAT --to-source 192.168.13.6
[root@appserver01 ~]#
[root@appserver01 ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
[root@appserver01 ssh]# service iptables restart
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: nat [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
3、
C:\Documents and Settings\htaix>sqlplus test/test@111.81.35.37:1111/testdb
SQL*Plus: Release 10.2.0.1.0 - Production on 星期五 2月 21 21:54:23 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select tname from tab;
TNAME
------------------------------------------------------------
TEST
阅读(7734) | 评论(0) | 转发(0) |