背景:
在centos6上安装oracle 11gR2,配置IPV6 ,想在客户端使用pl/sql developer通过IPV6连接oracle服务器。在爬坑的过程中发现在centos7上通过IPV6连接就没有问题,centos6就不行。所以在centos6上考虑问题,突然想到centos6还有一个ip6tables防火墙的,对的,问题就出现在ip6tables上,只要添加1521端口就行了:
[root@ml ~]# vim /etc/sysconfig/ip6tables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p ipv6-icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 546 -d fe80::/64 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp6-adm-prohibited
-A FORWARD -j REJECT --reject-with icmp6-adm-prohibited
COMMIT
[root@ml ~]# service ip6tables restart
ip6tables: Setting chains to policy ACCEPT: filter [ OK ]
ip6tables: Flushing firewall rules: [ OK ]
ip6tables: Unloading modules: [ OK ]
ip6tables: Applying firewall rules: [ OK ]
[root@ml ~]#
客户端配置:tnsnames.ora配置(同一台ipv4与ipv6地址,配置IPV4是想用来做判断)
24.128 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.24.128)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = dbsrv2)
)
)
ipv6_24.128 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = [FEC0:0:0:0001::3])(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = dbsrv2)
)
)
测试:
Microsoft Windows [版本 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\Users\ML>tnsping ipv6_24.128
TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 17-8月 -2018 08:56:01
Copyright (c) 1997, 2010, Oracle. All rights reserved.
已使用的参数文件:
C:\Users\ML\Downloads\instantclient-basic-windows.x64-12.2.0.1.0\instantclient_12_2\NETWORK\ADMIN\sqlnet.ora
已使用 TNSNAMES 适配器来解析别名
尝试连接 (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = [FEC0:0:0:0001::3])(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = dbsrv2)))
OK (20 毫秒)
C:\Users\ML>