IP配置需求
- 对于使用专用网络的单个接口的群集,每个节点的互连专用接口必须位于同一子网中,并且该子网必须连接到群集的每个节点。例如,如果私网子网掩码是255.255.255.0,那么私网地址的范围可以选择192.168.10.0-192.168.10.255,必须是这个范围内的;如果私网子网掩码地址是255.255.0.0,那么私网IP地址的范围是192.168.[0-255].[0-255].;如果子网掩码是255.255.255.248,也就是把0-255个ip地址分为32个段,每个网段8个ip,如192.168.10.[0-7]/[8-15].. 以此类推。 network地址也随之改变
- 对于使用冗余互连的群集,每个专用接口应位于不同的子网上。但是,每个群集成员节点在每个专用互连子网上都必须有一个接口,并且这些子网必须连接到群集的每个节点。例如,子网192.168.0和10.0.0上可以有专用网络,但每个群集成员节点必须有一个连接到192.168.0和10.0.0子网的接口。(如果使用系统级别的双网卡绑定,尤其在11g之后,需要使用主备模式)。
- 对于专用网络,所有指定互连接口的端点必须在网络上完全可访问。应该没有未连接到每个专用网络接口的节点。您可以使用ping测试是否可以访问互连接口,或者使用traceroute命令。
配置网络
我们可以通过oifcfg 配置相关公网、私网, oifcfg命令参数如下:
[grid@rac19c ~]$ oifcfg
Name:
oifcfg - Oracle Interface Configuration Tool.
Usage:
oifcfg iflist [-p] [-n] [-hdr]
Lists the network interfaces known to the operating system on this node that can be configured with 'oifcfg setif'.
-p displays a heuristic assumption of the interface type (PRIVATE, PUBLIC, or UNKNOWN).
-n displays the netmask.
-hdr displays column headings.
oifcfg setif {-node | -global} [/:[,...]][,...]
'oifcfg setif -global' or 'oifcfg setif -node ' is used to synchronize the interface details in the GPnP profile and OCR.
oifcfg getif [-node | -global] [ -if [/] [-type ]] [-hdr]
oifcfg delif {{-node | -global} [[/]] [-force] | -force}
oifcfg [-help]
- name of the host, as known to a communications network
- name by which the interface is configured in the system
- subnet address of the interface
- one or more comma-separated interface types { cluster_interconnect | public | asm}
[grid@rac19c ~]$
如上所示,不管是配置公网还是私网,此处配置的网络是subnet,也就是子网网段地址。 此配置需要根据子网掩码来配置,如255.255.255.0,直接写192.168.10.0即可,如果是其他数值,需要重新计算。(例如,192.168.10.9,255,255,255,248,此时需要使用192.168.10.8)。 尤其心跳地址,会校验这个subnet,如oifcfg配置与实际网络配置不同,集群无法启动。 也可通过操作系统命令计算:
[grid@rac19c ~]$ oifcfg getif
ens38 10.0.0.0 global cluster_interconnect,asm
ens33 192.168.80.0 global cluster_interconnect,asm
[grid@rac19c ~]$ ipcalc -mn 192.168.80.17 255.255.255.0
NETMASK=255.255.255.0
NETWORK=192.168.80.0
[grid@rac19c ~]$ ipcalc -mn 192.168.80.17 255.255.255.248
NETMASK=255.255.255.248
NETWORK=192.168.80.16
[grid@rac19c ~]$
子网掩码简单介绍
我们通常配置的子网掩码是255.255.255.0,转换成二进制就是11111111.11111111.11111111.00000000,如果都是255,那么一共是4*8个1组成,所以,有些配置文件支持ip/1的个数来描述子网掩码,如192.168.8.19/24 = 192.168.8.19/255.255.255.0.以最后一个掩码段为例,可以设置成如下数值
| 掩码数值 | 段内IP个数 | 几个段 |
| —- | —- | —- |
| 0 | 256 | 0 |
| 128 | 126 | 2 |
| 192 | 64 | 4 |
| 224 | 32 | 8 |
| 240 | 16 | 16 |
| 248 | 8 | 32 |
| 252 | 4 | 64 |
| 254 | 2 | 128 |
| 255 | 1 | 255 |
其中最后255,其实就是自己连接自己了。