oracle 掩码,oracle RAC 修改子网掩码如何计算subnet

一般情况下,RAC中public与private的子网掩码都为255.255.255.0,所以通过oifcfg setif -global进行设置时,常看到以下的形式:

oifcfg setif -global e1000g0/171.197.26.0:public

其中171.197.26.0代表一个网段,当子网掩码不为255.255.255.0的时候,这里可能就不再是设置为171.197.26.0了,具体的该设置为多少,可以通过官方文档“How to calculate the correct subnet for an interface [ID 1059759.1]”中的方法来计算。

How to calculate the correct subnet for an interface [ID 1059759.1]文档内容如下:

In this Document

Goal

Fix

Applies to:

Oracle Server - Enterprise Edition - Version 10.2.0.1 to 11.2.0.2 [Release 10.2 to 11.2]

Information in this document applies to any platform.

Goal

How to calculate the correct subnet to use in oifcfg, etc.

oifcfg requires you to enter the subnet used for public and cluster_interconnect networks.

However, ifconfig usually shows the IP and the netmask, but not the subnet.

This note will show how to determine the subnet to be used with oifcfg.

More generally, it also applies to the general question of determining the subnet for a given interface, given the IP address and netmask.

Fix

Suppose that the interface to be used for public network is e1000g0 with ip address 171.197.26.137 and netmask ffffffc0.

In ifconfig -a output we will see this:

e1000g0:

flags=209040843

mtu 1500 index 2

inet 171.197.26.137 netmask ffffffc0 broadcast 171.197.26.191

groupname prod

ether 0:14:4f:95:39:9a

Note that the netmask is displayed as ffffffc0 in hex. (In some platforms it is displayed in decimal rather than hex.)

This netmask ffffffc0 = ff.ff.ff.c0 = 255.255.255.192 .

In binary notation this is 11111111.11111111.11111111.11000000

Another common way you may see to represent the netmask is as a simple 2-digit number like "26", to get this number, simply add up the digits:

11111111.11111111.11111111.11000000

=> (1+1+1+1+1+1+1+1) + (1+1+1+1+1+1+1+1) + (1+1+1+1+1+1+1+1) + (1+1+0+0+0+0+0+0)

= 8+8+8+2 = 26

A fast way to find the subnet, given the network address (171.197.26.137) and the netmask (255.255.255.192), is to use an IP calculator.

Free IP calculators are available online. In this example, I used the calculator at http://jodies.de/ipcalc. Many others are available.

Plugging the address (171.197.26.137) and the netmask (255.255.255.192) into the calculator at http://jodies.de/ipcalc gives this output:

Result:

Address:  171.197. 26.137       10101011.11000101.00011010.10 001001

Netmask:  255.255.255.192 = 26  11111111.11111111.11111111.11 000000

Wildcard:   0.  0.  0. 63       00000000.00000000.00000000.00 111111

=>

Network:  171.197. 26.128/26    10101011.11000101.00011010.10 000000 (Class B)

Broadcast:171.197. 26.191       10101011.11000101.00011010.10 111111

HostMin:  171.197. 26.129       10101011.11000101.00011010.10 000001

HostMax:  171.197. 26.190       10101011.11000101.00011010.10 111110

Hosts/Net: 62

=> note how that gives the network 171.197.26.128/26

Ignore the /26 in this output, the "subnet" needed for oifcfg is 171.197.26.128.

Another way to get this information is to do a bit-AND on each bit of the address and netmask:

171.197. 26.137 => 10101011.11000101.00011010.10 001001

255.255.255.192 => 11111111.11111111.11111111.11 000000

& ------------------------------------

10101011.11000101.00011010.10 000000 => 171.197.26.128

Yet another way to get this information is from oifcfg itself.

The command oifcfg iflist shows the interface name and subnet for each interface:

$ ./oifcfg iflist

e1000g0 171.197.26.128

e1000g2 171.197.26.128

e1000g3 10.241.6.0

So now you see where that 128 is coming from in oifcfg iflist. For each interface, oifcfg iflist shows the subnet for that interface.

So to enter this into oifcfg as the public network, you would use this syntax:

oifcfg setif -global e1000g0/171.197.26.128:public

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值