请选择 进入手机版 | 继续访问电脑版

      Oracle数据库IPv6配置教程

      2018-8-30 10:20| 发布者: admin| 查看: 554| 评论: 0

      摘要: 什么是IPV6?Internet Protocol Version 6(IPV6), IPV6演变的主要影响因素是:地址空间IPV4的耗尽。 IPV4中较少的地址空间迫使用户使用网络地址转换(NAT)。我们都知道IPV6有128位, 那IPV6的地址空间就有2的128次 ...

      Internet Protocol Version 6(IPV6), IPV6演变的主要影响因素是:地址空间IPV4的耗尽。 IPV4中较少的地址空间迫使用户使用网络地址转换(NAT)。我们都知道IPV6有128位, 那IPV6的地址空间就有2的128次方,IPV4有4Billion个地址,而IPV6有340 Undecillion(340,282,366,920,938,000,000,000,000,000,000,000,000 )大到不可想象。

      IPv6的地址格式

      IPV6 具有许多默认分配给操作系统的地址类型,下面使用的是GUA地址,其它还有Link Local等。IPV6的设计考虑地址空间的维护,被设计为自多配置,有DHCP分配,本文使用的是手动指定的方式,通常情况下对于及时像运行着 ORACLE 数据库的 服务器 主机也不需要手动配置IPV6地址。

      1.   IPv6是128位,比IPv4多96位
      2.  使用的是十六进程表示
      3.  每段之间使用”:”隔开,而不是”.”
      4.  128位地址有2部分组成,Network Prefix 64-bit,  Host Prefix 64-bit

      IPv6地址如:2001:db8::1234:1235:abcd:abef

      Note:

      IPv6地址中可以删除连接出现的0,缩写同样等效,如IPV4的回路地址127.0.0.1,在IPV6中是0000:0000:0000:0000:0000:0000:0000:0001, 可以缩写为”::1″ 。

      Oracle IPv6 Ready Portfolio

      ORACLE数据库支持IPv6配置教程

      ORACLE 11.2 启第一个支持IPv6的 数据库 版本, 但是只支持 单实例模式的IPv6地址和连接, 从ORACLE 12版本开始完全的支持IPV6地址通过Public Vip到ORACLE RAC,也就是从12.1.0.1开始支持public network,但是对于Private network还必须使用IPv4, 操作系统也支持同时运行IPV4和IPV6,ORACLE数据库和监听也可以同时使用IPV4和IPV6。 从12.2版本开始所有组件可以完全支持IPv6。

      同时也可以配置IPv4 Mapping Address, 允许IPV6的应用程序使用IPv4的协议, 但是IPv4 MA不是IPV6隧道,只是操作系统的配置,IPv4 MA IPv6地址规则是前80位为0,接下来是16位的1,最后32位是IPv4的点位表示或是十六进制的等效IPv4如下面的是同一个地址,更多配置可以参考MOS  note 831153.1

      0000:0000:0000:0000:0000:FFFF:129.168.134.145
      0000:0000:0000:0000:0000:FFFF:81A8:8691
      ::FFFF: 129.168.134.145
      ::FFFF: 81A8:8691
      LINUX 配置 IPv6 (  我的版本是OEL6.6)

      [root@anbob ~]# cat /etc/issue
      Oracle Linux Server release 6.6
      Kernel \r on an \m

      Load the IPV6 module as root user
      [oracle@anbob net]$ modprobe ipv6
      [oracle@anbob net]$
      如果上面输出有错误修改/etc/modprobe.conf 如下面后,重启主机:

      #alias net-pf-10 off

      #alias ipv6 off

      #options ipv6 disable=1

      To add IPV6 interface

      /sbin/ifconfig inet 6 add /

      [root@anbob ~]# ifconfig eth2 inet6 add 2001:db8::1234:1235:abcd:abef/64
      [root@anbob ~]# ifconfig
      eth2 Link encap:Ethernet HWaddr 08:00:27:CE:89:B8
      inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0
      inet6 addr: 2001:db8::1234:1235:abcd:abef/64 Scope:Global
      inet6 addr: fe80::a00:27ff:fece:89b8/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
      RX packets:250 errors:0 dropped:0 overruns:0 frame:0
      TX packets:222 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:27493 (26.8 KiB) TX bytes:66904 (65.3 KiB)

      lo Link encap:Local Loopback
      inet addr:127.0.0.1 Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING MTU:65536 Metric:1
      RX packets:8 errors:0 dropped:0 overruns:0 frame:0
      TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:680 (680.0 b) TX bytes:680 (680.0 b)

      [root@anbob ~]# ip -6 addr
      1: lo: mtu 65536
      inet6 ::1/128 scope host
      valid_lft forever preferred_lft forever
      2: eth2: mtu 1500 qlen 1000
      inet6 2001:db8::1234:1235:abcd:abef/64 scope global
      valid_lft forever preferred_lft forever
      inet6 fe80::a00:27ff:fece:89b8/64 scope link
      valid_lft forever preferred_lft forever

      [oracle@anbob net]$ cat /proc/net/if_inet6
      00000000000000000000000000000001 01 80 10 80       lo
      20010db80000000012341235abcdabef 02 40 00 80     eth2
      fe800000000000000a0027fffece89b8 02 40 20 80     eth2

      [root@anbob ~]# ping6 2001:db8::1234:1235:abcd:abef
      PING 2001:db8::1234:1235:abcd:abef(2001:db8::1234:1235:abcd:abef) 56 data bytes
      64 bytes from 2001:db8::1234:1235:abcd:abef: icmp_seq=1 ttl=64 time=0.033 ms
      64 bytes from 2001:db8::1234:1235:abcd:abef: icmp_seq=2 ttl=64 time=0.082 ms
      64 bytes from 2001:db8::1234:1235:abcd:abef: icmp_seq=3 ttl=64 time=0.071 ms

      [root@anbob ~]# vi /etc/sysconfig/network:

      NETWORKING=yes
      HOSTNAME=anbob.com
      # Enable global IPv6 initialization
      NETWORKING_IPV6=yes         
      # Disable global IPv6 forwarding and have host configure itself 
      # to not be an IPv6 router
      IPV6FORWARDING=no             
      # Disable global IPv6 auto-configuration so a static IPv6 address can be set
      IPV6_AUTOCONF=no               
      # Disable automatic IPv6 tunneling as we are not setting up an IPv6 tunnel
      IPV6_AUTOTUNNEL=no

      [root@anbob ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth2
      DEVICE=eth2
      BOOTPROTO=none
      HWADDR=00:1E:4F:E6:FE:11
      ONBOOT=yes
      IPADDR=192.168.56.101
      NETMASK=255.255.255.0
      GATEWAY=192.168.56.1
      TYPE=Ethernet
      USERCTL=no
      PEERDNS=yes
      IPV6INIT=yes
      IPV6ADDR=2001:db8::1234:1235:abcd:abef/64

      [root@anbob ~]# cat /etc/hosts
      127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
      ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

      192.168.56.101 anbob.com anbob

      2001:db8::1234:1235:abcd:abef    anbob6.com
      ORACLE 配置LISTENER, TNS 使用IPV6地址

      [oracle@anbob ~]$ vi /u02/app/oracle/product/12.2.0/db_1/network/admin/listener.ora
      # listener.ora Network Configuration File: /u02/app/oracle/product/12.2.0/db_1/network/admin/listener.ora
      # Generated by Oracle configuration tools.

      LISTENER =
        (DESCRIPTION_LIST =
          (DESCRIPTION =
            (ADDRESS = (PROTOCOL = TCP)(HOST = anbob.com)(PORT = 1521))
            (ADDRESS = (PROTOCOL = TCP)(HOST = anbob6.com)(PORT = 1522))
            (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          )
        )

      [oracle@anbob ~]$ lsnrctl start

      LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 16-AUG-2018 16:51:03

      Copyright (c) 1991, 2016, Oracle.  All rights reserved.

      Starting /u02/app/oracle/product/12.2.0/db_1/bin/tnslsnr: please wait...

      TNSLSNR for Linux: Version 12.2.0.1.0 - Production
      System parameter file is /u02/app/oracle/product/12.2.0/db_1/network/admin/listener.ora
      Log messages written to /u02/app/oracle/diag/tnslsnr/anbob/listener/alert/log.xml
      Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=anbob.com)(PORT=1521)))
      Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=2001:db8::1234:1235:abcd:abef)(PORT=1522)))
      Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

      Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=anbob.com)(PORT=1521)))
      STATUS of the LISTENER
      ------------------------
      Alias                     LISTENER
      Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
      Start Date                16-AUG-2018 16:51:05
      Uptime                    0 days 0 hr. 0 min. 1 sec
      Trace Level               off
      Security                  ON: Local OS Authentication
      SNMP                      OFF
      Listener Parameter File   /u02/app/oracle/product/12.2.0/db_1/network/admin/listener.ora
      Listener Log File         /u02/app/oracle/diag/tnslsnr/anbob/listener/alert/log.xml
      Listening Endpoints Summary...
        (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=anbob.com)(PORT=1521)))
        (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=2001:db8::1234:1235:abcd:abef)(PORT=1522)))
        (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      The listener supports no services
      The command completed successfully
      Note:

      这里监听配置好了IPv6 地址的1522端口, 同时保留了原来的IPv4地址的1521端口。 当前no service是因为数据库还没有打开。

      为了让系统服务注册到这个端口上,tnsnames.ora 文件增加,并修改LOCAL_LISTENER配置文件

      show parameter local

      PARAMETER_NAME                                               TYPE        VALUE
      ------------------------------------------------------------ ----------- -------------------------------------
      local_listener                                               string      LISTENER_ANBOB
      parallel_force_local                                         boolean     FALSE


      SQL> alter system set local_listener='LISTENER_ANBOB','PDBANBOBv6';
      System altered.

      SQL> alter system register;
      System altered.

      [oracle@anbob admin]$ lsnrctl status

      LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 16-AUG-2018 17:14:36
      Copyright (c) 1991, 2016, Oracle.  All rights reserved.
      Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=anbob.com)(PORT=1521)))
      STATUS of the LISTENER
      ------------------------
      Alias                     LISTENER
      Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
      Start Date                16-AUG-2018 16:51:05
      Uptime                    0 days 0 hr. 23 min. 30 sec
      Trace Level               off
      Security                  ON: Local OS Authentication
      SNMP                      OFF
      Listener Parameter File   /u02/app/oracle/product/12.2.0/db_1/network/admin/listener.ora
      Listener Log File         /u02/app/oracle/diag/tnslsnr/anbob/listener/alert/log.xml
      Listening Endpoints Summary...
        (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=anbob.com)(PORT=1521)))
        (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=2001:db8::1234:1235:abcd:abef)(PORT=1522)))
        (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
      Services Summary...
      Service "465fa0ab8243396ae0530338a8c0fc9e.com" has 1 instance(s).
        Instance "anbob", status READY, has 1 handler(s) for this service...
      Service "4a0d4eafec1b1916e0530338a8c07871.com" has 1 instance(s).
        Instance "anbob", status READY, has 1 handler(s) for this service...
      Service "anbob.com" has 1 instance(s).
        Instance "anbob", status READY, has 1 handler(s) for this service...
      Service "anbobXDB.com" has 1 instance(s).
        Instance "anbob", status READY, has 1 handler(s) for this service...
      Service "pdbanbob.com" has 1 instance(s).
        Instance "anbob", status READY, has 1 handler(s) for this service...
      Service "pdbweejar.com" has 1 instance(s).
        Instance "anbob", status READY, has 1 handler(s) for this service...
      The command completed successfully

      [oracle@anbob admin]$ netstat -an|grep 1522
      tcp        0      0 2001:db8::1234:1235:ab:1522 :::*                        LISTEN      
      tcp        0      0 2001:db8::1234:1235:a:63072 2001:db8::1234:1235:ab:1522 ESTABLISHED 
      tcp        0      0 2001:db8::1234:1235:ab:1522 2001:db8::1234:1235:a:63072 ESTABLISHED 

      [oracle@anbob admin]$ lsof -i:1522
      COMMAND    PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
      tnslsnr   4792 oracle   12u  IPv6  14281      0t0  TCP anbob6.com:ricardo-lm (LISTEN)
      tnslsnr   4792 oracle   16u  IPv6  16114      0t0  TCP anbob6.com:ricardo-lm->anbob6.com:63072 (ESTABLISHED)
      ora_lreg_ 4861 oracle   11u  IPv6  16113      0t0  TCP anbob6.com:63072->anbob6.com:ricardo-lm (ESTABLISHED)

      [oracle@anbob admin]$ ps -ef|grep 4792|grep -v grep
      oracle    4792     1  0 16:51 ?        00:00:00 /u02/app/oracle/product/12.2.0/db_1/bin/tnslsnr LISTENER -inherit

      [oracle@anbob admin]$ ps -ef|grep 4861|grep -v grep
      oracle    4861     1  0 16:52 ?        00:00:00 ora_lreg_anbob
      Note:

      可以看到当前监听已经配置好了IPv4和IPv6两种地址,并且LREG进程已经把服务注册到LISTENER进程的1522端口上。

      测试连接

      [oracle@anbob ~]$ tnsping pdbanbob             
      TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 16-AUG-2018 23:46:20
      Copyright (c) 1997, 2016, Oracle.  All rights reserved.
      Used parameter files:
      /u02/app/oracle/product/12.2.0/db_1/network/admin/sqlnet.ora
      Used TNSNAMES adapter to resolve the alias
      Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = anbob.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdbanbob.com)))
      OK (0 msec)

      [oracle@anbob ~]$ tnsping pdbanbobv6
      TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 16-AUG-2018 23:46:36
      Copyright (c) 1997, 2016, Oracle.  All rights reserved.
      Used parameter files:
      /u02/app/oracle/product/12.2.0/db_1/network/admin/sqlnet.ora

      Used TNSNAMES adapter to resolve the alias
      Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =2001:db8::1234:1235:abcd:abef)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = pdbanbob.com)))
      OK (0 msec)
      [oracle@anbob ~]$ sqlplus anbob/anbob@pdbanbobv6

      SQL*Plus: Release 12.2.0.1.0 Production on Thu Aug 16 23:48:01 2018
      Copyright (c) 1982, 2016, Oracle.  All rights reserved.
      Last Successful login time: Thu Aug 16 2018 17:42:40 +08:00

      Connected to:
      Oracle Database 12c EE Extreme Perf Release 12.2.0.1.0 - 64bit Production


      USERNAME             INST_NAME            HOST_NAME                 SID   SERIAL#  VERSION    STARTED  SPID       OPID  CPID            SADDR            PADDR
      -------------------- -------------------- ------------------------- ----- -------- ---------- -------- ---------- ----- --------------- ---------------- ----------------
      ANBOB                PDBANBOB-anbob       anbob                     59    60861    12.2.0.1.0 20180816 4725       54    4723            000000006D22C440 000000006EC3DB98


      SQL> exit
      Disconnected from Oracle Database 12c EE Extreme Perf Release 12.2.0.1.0 - 64bit Production
      [oracle@anbob ~]$ sqlplus anbob/anbob@pdbanbob    --IPV4

      SQL*Plus: Release 12.2.0.1.0 Production on Thu Aug 16 23:48:10 2018
      Copyright (c) 1982, 2016, Oracle.  All rights reserved.
      Last Successful login time: Thu Aug 16 2018 23:48:01 +08:00

      Connected to:
      Oracle Database 12c EE Extreme Perf Release 12.2.0.1.0 - 64bit Production


      USERNAME             INST_NAME            HOST_NAME                 SID   SERIAL#  VERSION    STARTED  SPID       OPID  CPID            SADDR            PADDR
      -------------------- -------------------- ------------------------- ----- -------- ---------- -------- ---------- ----- --------------- ---------------- ----------------
      ANBOB                PDBANBOB-anbob       anbob                     59    43474    12.2.0.1.0 20180816 4730       54    4728            000000006D22C440 000000006EC3DB98


      SQL>
      NOTE:

      连接成功!

      Oracle 11.2中除了ORACLE RAC和Oracle Clusterware所有功能都支持IPv6, 还有也不支持ASM使用IPv6,也支持IPv6和IPv4共存. 在ORACLE 12C中,Oracle支持IPv4和IPv6在同一个网络,同样也可以配置PLUBIC network(Public/vip)在IPv6和IPv4,但是确保同一集群中所有节点使用相同的IP协议。但12.1 时不支持WINDOWS和private newwork. 在12.2 版本中 ORACLE提供了完全的支持IPv6,包括WINDOWS平台,ASM, FAN, 所有平台中的ORACLE Clusterwarer的private network。

      鲜花

      握手

      雷人

      路过

      鸡蛋

      相关阅读

      最新评论

      QQ|Archiver|手机版|小黑屋|IPv6.la(IPv6技术网)

      GMT+8, 2020-7-5 16:20 , Processed in 0.160049 second(s), 23 queries .

      IPv6.la ©版权所有

      © 2020 IPv6.la(IPv6技术网)

      返回顶部