使用RAC的时候,经常有朋友问如何修改IP,10.2的我就不说了,修改方法成熟的很,出了问题也很好解决。
从11.2开始,修改IP方法和以前差不多,但是出了问题,有些人不知道如何处理,这里介绍一个使用gpnp修复的方法(还可以用重建crs的方法),该方法已经在11.2和12c上都实施成功了。
模拟错误:
使用oifcfg故意设置错误的内部互联网段(其他使用oficfg错误的修改了IP,后果类似)
[root@lunar ~]# oifcfg -helpName:
oifcfg - Oracle Interface Configuration Tool.
Usage: oifcfg iflist [-p [-n]]
Shows the available interfaces that you can configure with 'setif' by querying the operating system to find which network interfaces are present on this node.
where -p displays a heuristic assumption of the interface type (PRIVATE, PUBLIC, or UNKNOWN).
-n displays the netmask.
oifcfg setif {-node <nodename> | -global} {<if_name>/ <subnet>:<if_type>[,<if_type>...]}[,...]
oifcfg getif [-node <nodename> | -global] [ -if <if_name>[/<subnet>] [-type <if_type>] ]
oifcfg delif { {-node <nodename> | -global} [<if_name>[/ <subnet>]] [-force] | -force}
oifcfg [-help]
<nodename> - name of the host, as known to a communications network
<if_name> - name by which the interface is configured in the system
<subnet> - subnet address of the interface
<if_type> - one or more comma-separated interface types { cluster_interconnect | public | asm}
[root@lunar ~]#
这里面尤其要注意,setif中写入的是subnet,我见过不只一次有人这个写错了导致crs不能启动……
[root@lunar ~]# oifcfg getif
eth1 10.10.10.0 global cluster_interconnect
eth0 192.168.30.0 global public
[root@lunar ~]#
[root@lunar ~]# ifconfig eth1
eth1 Link encap:Ethernet HWaddr 00:0C:29:CE:AC:D2
inet addr:10.10.10.66 Bcast:10.10.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:333 errors:0 dropped:0 overruns:0 frame:0
TX packets:106 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:67992 (66.3 KiB) TX bytes:18015 (17.5 KiB)
[root@lunar ~]#
计算ip地址(这是当前的正确的网络配置):
[root@lunar ~]# ipcalc -bnm 10.10.10.66 255.255.255.0
NETMASK=255.255.255.0
BROADCAST=10.10.10.255
NETWORK=10.10.10.0
[root@lunar ~]#
这是按照子网掩码252计算的网络配置,一会打算使用这个值模拟错误:
[root@lunar ~]# ipcalc -bnm 10.10.10.100 255.255.252.0
NETMASK=255.255.252.0
BROADCAST=10.10.11.255
NETWORK=10.10.8.0
[root@lunar ~]#
[root@lunar ~]# oifcfg getif
eth1 10.10.10.0 global cluster_interconnect
eth0 192.168.30.0 global public
[root@lunar ~]#
[root@lunar ~]# oifcfg delif -global eth1
PRIF-31: Failed to delete the specified network interface because it is the last private interface
[root@lunar ~]#
[root@lunar ~]# oifcfg setif -global eth1/10.10.8.0:cluster_interconnect
/proc/net/ipv6_route: No such file or directory
[root@lunar ~]#
[root@lunar network-scripts]# oifcfg getif
eth1 10.10.10.0 global cluster_interconnect
eth0 192.168.30.0 global public
eth1 10.10.8.0 global cluster_interconnect
[root@lunar network-scripts]#
[root@lunar network-scripts]# oifcfg delif -global eth1
PRIF-31: Failed to delete the specified network interface because it is the last private interface
[root@lunar network-scripts]#
[root@lunar ~]# oifcfg delif -global eth1/10.10.10.0
[root@lunar ~]#
[root@lunar ~]# oifcfg getif
eth0 192