koolkid和ip–ware分别是im v kool什么意思思?

&&&&&&&&&&&&&&&&&&
posts - 291,comments - 44,trackbacks - 0
Oracle 11g RAC环境下Private IP修改方法及异常处理
Oracle 11g RAC环境下Private IP修改方法及异常处理 一、
确认所有节点CRS服务以启动 # olsnodes -s -n &i host1
Active host2
修改Private IP配置信息
如果之前只有一个私有网卡,则直接删除时会报错,如:PRIF-31:
the specified
interface.所以如果只是修改Private
IP而不用更改网卡时,可以参考以下操作命令: oifcfg getif
//查看Private IP配置
oifcfg setif -global en1/10.10.12.0:cluster_interconnect
//添加en1新的Private IP
oifcfg delif -global en1/10.10.11.0
//删除en1旧的Private IP oifcfg getif
//查看Private IP配置
如果需要更改Private IP网卡时,可以参考如下命令:
oifcfg getif
//查看Private IP配置
oifcfg setif -global en2/10.10.12.0:cluster_interconnect
//增加新的en2 上的Private IP oifcfg delif -global en1
//删除旧的en1上的Private IP oifcfg getif
//查看Private IP配
关闭CRS服务(所有节点都要执行): 参考命令: #crsctl stop crs -f
修改私有网络物理网卡IP地址和/etc/hosts文件(所有节点都要执行): 参考命令: # smit tcpip-& Minimum Configuration & Startup-&en1 #vi /etc/hosts
启动和查看CRS服务 参考命令: #crsctl start crs #crs_stat -t
二、异常处理 1.
问题描述 如果使用oifcfg setif命令修改Private IP配置信息时,subnet与实际配置的物理IP不致,则重启CRS服务时会导致CRS无法启动,如下所示: oifcfg setif命令配置: oifcfg setif -global en1/10.10.12.0:cluster_interconnect
//subnet为10.10.12.0 物理IP配置: 10.10.11.61/255.255.255.0
//subnet为10.10.11.0
日志错误信息: Alert*.log
12:38:41.795 [ohasd(8388676)]CRS-2765:Resource 'ora.crsd' has failed on server 'host1'.
12:38:43.189 [crsd()]CRS-0804:Cluster
error [PROC-44:
operations
interface operations
(:CRSD00111:)
in /u01/app/grid/product/11.2.0/grid/log/host1/crsd/crsd.log.
12:38:43.878 [ohasd(8388676)]CRS-2765:Resource 'ora.crsd' has failed on server 'host1'.
12:38:43.879 [ohasd(8388676)]CRS-2771:Maximum
'ora.crsd';
not restart.
12:38:42.985: [
OCRAPI][1]clsu_get_private_ip_addresses: no ip addresses found. [
OCRAPI][1]a_init_clsss: failed to call clsu_get_private_ip_addr (7)
12:38:43.188: [
OCRAPI][1]a_init:13!: Clusterware init unsuccessful : [44]
12:38:43.188:
CRSOCR][1]
in network address and interface oper ations Network address and interface operations error [7]
12:38:43.189:
CRSMAIN][1]
(:CRSD00111:)
OCR, error: PROC-44: Error in network address and interface operations Network address and interface operations error [7]
12:38:43.189: [
CRSD][1][PANIC] CRSD exiting: Could not init OCR, code: 44
12:38:43.189: [
CRSD][1] Done.
处理方法 可以使用gpnptool命令处理以上问题。GPNPD(Greater Pittsburgh Nonprofit Partnership)进程的主要的作用是在集群各个节点中同步GPnP profile文件,在Clusterware中,CSS、GPnP等服务的启动都需要依赖于GPnP
profile文件。而GPnP profile文件是一个xml文件,它存储 的 位 置 是 在 : $GRID_HOME/gpnp//profile/peer/profile.xml ,$GRID_HOME/gpnp/profile/peer/profile.xml(全局备份,最原始的配置信息)。GPnPD进程写的trace文件会存放在$GRID_HOME/log//gpnpd/gpnpd.log。 有几个重要的信息存储在GPnP profile文件: ?
网络接口和IP地址(公网和私网) ?
ASM diskstring和spfile信息 GPnP profile保存的是RAC的配置信息,包括集群名称、网络类型信息(public/private)、ASM和CSS的存储信息、安全的数字签名,以及ASM实例的SPFILE文件位置。当集群配置发生变化时,所有节点的该文件会被自动更新。在安装、系统引导或者当使用标准的集群工具更新期间,这些活动包括:oifcfg 改变网络信息、crsctl 改变css设备、ASM额外的存储等,会通过gpdpd进程复制GPnP profile到所有的其他节点。
当集群启动的时候,Cluster Synchronization Services (CSS)将扫描所有的ASM disks,它利用的是GPnP profile文件中的ASM discovery string。如下所示:
egistry.253."/& 这里可以看到spfile文件是存放在ASM卷组+DATA中的。但是有一个需要注意到事情是我们启动ASM的时候,需要spfile文件,Oracle从GPnP
profile中知道spfile的路径,然后它就会从底层磁盘中直接读取spfile标识,启动asm实例。 如果GPnP出现问题,可以使用cluvfy
gpnp组件验证命令检查在集群中所有节点网格即插即用的完整性:cluvfy comp gpnp [-n node_list] [-verbose]
最后,注意Oracle不支持手动修改profile.xml文件,直接对它的修改可能导致无法修复的问题,最终导致在所有节点重建Clusterware。
2.1 以排他模式和不启动crsd进程的方式启动crs # crsctl start crs -excl &nocrs
2.2 备份crs配置信息 #mkdir /u01/gpnp #gpnptool get -o=/u01/gpnp/profile.xml # more /u01/gpnp/profile.xml
xmlns="http://www.grid-pnp.org/2005/11/gpnp-profile" x mlns:gpnp="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:orcl="http://www.oracle.com/gpnp/2005/11/gpnp-profile" xmlns:x si="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.grid-pnp.org/2005/11/gpnp-profile gpnp-profile. xsd"
ProfileSequence="22"
ClusterUId="8c3ff8bfba9eec919fb4e4" ClusterName="host-scan" PALocation=""&rofile&IP="192.168.101.0" Use="public"/&etwork
Adapter="en1"
IP="10.10.12.0" Use="cluster_interconnect"/&S-Profile
DiscoveryString="+asm"
LeaseDuration="400"/&DiscoveryString="" SPFile="+DATA/ho st-scan/asmparameterfile/registry.253."/&xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&&
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/& Algorithm="http://www.w3. org/2000/09/xmldsig#rsa-sha1"/&Algorithm="http://www.w3.org/2000/09/xmldsig #enveloped-signature"/&http://www.w3.org/2001/10/xml-exc-c14n#"& www.w3.org/2001/10/xml-exc-c14n#"
PrefixList="gpnp
orcl xsi"/&://www.w3.org/2000/09/xmldsig#sha1"/&h2DxPI2dIQbGBji8BAAdimWLkkA=s:DigestValue&nfo&O1haZSJ3N6gC7B5blNK/0PeljlfjBoWODejCLCOOsqmb46eJM2TvhIoD7gVSVF2P0JKzXblsGlqkPpbfgzfasVpS/3nyowy/oMlfXI KloO445gzImd/lL1FCsvsZpe+GdqtvKgKaSKNJENHF/Ht4w9YCz6Gz6hhXi8u5n3jGU5E=eValue&
查看CRS的配置信息: # gpnptool
Warning: some command line parameters were defaulted. Resulting command line:
/u01/app/grid/product/11.2.0/grid/bin/gpnptool.bin get -o-
xmlns="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:gpnp="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:orcl="http://www.oracle.com/gpnp/2005/11/gpnp-profile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.grid-pnp.org/2005/11/gpnp-profile
gpnp-profile.xsd" ProfileSequence="22"
ClusterUId="8c3ff8bfba9eec919fb4e4" ClusterName="host-scan"
PALocation=""&HostName="*"&Use="public"/&Use="cluster_interconnect"/&id="css"
DiscoveryString="+asm"
LeaseDuration="400"/&DiscoveryString="" SPFile="+DATA/host-scan/asmparameterfile/registry.253."/&xmlns:ds="http://www.w3.org/2000/09/xmldsig#"& Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/& Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/& URI=""&Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/& Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"&
xmlns="http://www.w3.org/2001/10/xml-exc-c14n#"
PrefixList="gpnp
orcl xsi"/&Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/&h2DxPI2dIQbGBji8BAAdimWLkkA=O1haZSJ3N6gC7B5blNK/0PeljlfjBoWODejCLCOOsqmb46eJM2TvhIoD7gVSVF2P0JKzXblsGlqkPpbfgzfasVpS/3nyowy/oMlfXIKloO445gzImd/lL1FCsvsZpe+GdqtvKgKaSKNJENHF/Ht4w9YCz6Gz6hhXi8u5n3jGU5E=
备注:备份的profile.xml文件配置信息与&gpnptool
get&显示配置信息完全相同,同时也与$ORACLE_HOME /gpnp//profiles/peer下的profile.xml文件信息相同。
2.3 修改备份的CRS配置信息
2.3.1 备份配置文件: # cp /u01/gpnp/profile.xml /u01/gpnp/p.xml
2.3.2 获取当前的序列号(每次修改并写回crs中会有一个序列号作为标识): # gpnptool getpval -p=/u01/gpnp/p.xml -prf_sq -o- 22
2.3.3 获取共有网络和私有网络标识id (与实际网卡名称不一致,可以在配置文件中找到): # gpnptool getpval -p=/u01/gpnp/p.xml -net -o- net1 net3
2.3.4 修改配置文件中的序列号(原序列号值加1)和私网的实际网段(subnet)信息: #
-p=/u01/gpnp/p.xml
-o=/u01/gpnp/p.xml
-prf_sq=23 -net3:net_ip=10.10.11.0 Resulting profile written to "/u01/gpnp/p.xml". Success. 修改网卡名称#gpnptool
-p=/home/app/11.2.0.3/grid/gpnp/profiles/peer/profile.xml
-o=/home/app/11.2.0.3/grid/gpnp/profiles/peer/profile.xml
-prf_sq=5 net3:net_ada=em3
2.3.5 查看配置文件是否修改成功: # more /u01/gpnp/p.xml
xmlns="http://www.grid-pnp.org/2005/11/gpnp-profile" x mlns:gpnp="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:orcl="http://www.oracle.com/gpnp/2005/11/gpnp-profile" xmlns:x si="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.grid-pnp.org/2005/11/gpnp-profile gpnp-profile. xsd"
ProfileSequence="23"
ClusterUId="8c3ff8bfba9eec919fb4e4" ClusterName="host-scan" PALocation=""&rofile&IP="192.168.101.0" Use="public"/&etwork
Adapter="en1"
IP="10.10.11.0" Use="cluster_interconnect"/&S-Profile
DiscoveryString="+asm"
LeaseDuration="400"/&DiscoveryString="" SPFile="+DATA/ho st-scan/asmparameterfile/registry.253."/&xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&&
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/& Algorithm="http://www.w3. org/2000/09/xmldsig#rsa-sha1"/&Algorithm="http://www.w3.org/2000/09/xmldsig #enveloped-signature"/&http://www.w3.org/2001/10/xml-exc-c14n#"& www.w3.org/2001/10/xml-exc-c14n#"
PrefixList="gpnp
orcl xsi"/&://www.w3.org/2000/09/xmldsig#sha1"/&h2DxPI2dIQbGBji8BAAdimWLkkA=s:DigestValue&nfo&O1haZSJ3N6gC7B5blNK/0PeljlfjBoWODejCLCOOsqmb46eJM2TvhIoD7gVSVF2P0JKzXblsGlqkPpbfgzfasVpS/3nyowy/oMlfXI KloO445gzImd/lL1FCsvsZpe+GdqtvKgKaSKNJENHF/Ht4w9YCz6Gz6hhXi8u5n3jGU5E=eValue& 备注:红色标识改动信息。
2.3.6 验证序列号是否修改完成: # gpnptool getpval -p=/u01/gpnp/p.xml -prf_sq -o- 23
2.3.7 用私钥重新标识配置文件: # gpnptool sign -p=/u01/gpnp/p.xml -o=/u01/gpnp/p.xml -ovr -w=cw-fs:peer Resulting profile written to "/u01/gpnp/p.xml". Success.
2.3.8 查看配置文件改动: # more /u01/gpnp/p.xml
xmlns="http://www.grid-pnp.org/2005/11/gpnp-profile" x mlns:gpnp="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:orcl="http://www.oracle.com/gpnp/2005/11/gpnp-profile" xmlns:x si="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.grid-pnp.org/2005/11/gpnp-profile gpnp-profile. xsd"
ProfileSequence="23"
ClusterUId="8c3ff8bfba9eec919fb4e4" ClusterName="host-scan" PALocation=""&rofile&IP="192.168.101.0" Use="public"/&etwork
Adapter="en1"
IP="10.10.11.0" Use="cluster_interconnect"/&S-Profile
DiscoveryString="+asm"
LeaseDuration="400"/&DiscoveryString="" SPFile="+DATA/ho st-scan/asmparameterfile/registry.253."/&xmlns:ds="http://www.w3.org/2000/09/xmldsig#"&&
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/& Algorithm="http://www.w3. org/2000/09/xmldsig#rsa-sha1"/&Algorithm="http://www.w3.org/2000/09/xmldsig #enveloped-signature"/&http://www.w3.org/2001/10/xml-exc-c14n#"& www.w3.org/2001/10/xml-exc-c14n#"
PrefixList="gpnp
orcl xsi"/&://www.w3.org/2000/09/xmldsig#sha1"/&6p7GJFTV5ZoPtIqkUEudEvYnHB4=s:DigestValue&nfo&QNcNKDq1nbXDh1Htp8DYklSba6jzoYnSruNeJdLi6f9TALAQrLsrSAd6dYWaf4V7f2hGCb9qBGvr1pibl4JUeAnN7BBhgWOKyfwYKE Bx2FdP2RX5tPkLZC+k2X/PO3SpFfIH7NKbvyqmz5xiso2i5C134ZG0RF9s752ZU0e2jVk=eValue& 备注:红色标识改动信息。
2.3.9 回写配置文件信息到crs中: # gpnptool put -p=/u01/gpnp/p.xml
2.3.10 查看crs中配置信息: # gpnptool find -c=host-scan
//host-scan为RAC的 Found 1 instances of service 'gpnp'. mdns:service:gpnp._tcp.local.://host1:30391/agent=gpnpd,cname=host-scan,host=host1,pid=12648872/gpnpd h:host1 c:host-scan
# gpnptool rget -h=host1
//host1为主机名 Warning: some command line parameters were defaulted. Resulting command line:
/u01/app/grid/product/11.2.0/grid/bin/gpnptool.bin rget -h=host1 -o- Found 1 gpnp service instance(s) to rget profile from. RGET
tcp://host1:30391 (mdns:service:gpnp._tcp.local.://host1:30391/agent=gpnpd,cname=host-scan,host=host1,pid=12648872/gpnpd h:host1 c:host-scan):
xmlns="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:gpnp="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:orcl="http://www.oracle.com/gpnp/2005/11/gpnp-profile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.grid-pnp.org/2005/11/gpnp-profile
gpnp-profile.xsd" ProfileSequence="23"
ClusterUId="8c3ff8bfba9eec919fb4e4" ClusterName="host-scan"
PALocation=""&HostName="*"&Use="public"/&Use="cluster_interconnect"/&id="css"
DiscoveryString="+asm"
LeaseDuration="400"/&DiscoveryString="" SPFile="+DATA/host-scan/asmparameterfile/registry.253."/&xmlns:ds="http://www.w3.org/2000/09/xmldsig#"& Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/& Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/& URI=""&Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/& Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"&
xmlns="http://www.w3.org/2001/10/xml-exc-c14n#"
PrefixList="gpnp
orcl xsi"/&Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/&6p7GJFTV5ZoPtIqkUEudEvYnHB4=QNcNKDq1nbXDh1Htp8DYklSba6jzoYnSruNeJdLi6f9TALAQrLsrSAd6dYWaf4V7f2hGCb9qBGvr1pibl4JUeAnN7BBhgWOKyfwYKEBx2FdP2RX5tPkLZC+k2X/PO3SpFfIH7NKbvyqmz5xiso2i5C134ZG0RF9s752ZU0e2jVk= Success. #
2.3.11 启动crsd进程: # crsctl start res ora.crsd -init CRS-2672: Attempting to start 'ora.crsd' on 'host1' CRS-2676: Start of 'ora.crsd' on 'host1' succeeded # crs_stat -t CRS-0184: Cannot communicate with the CRS daemon.
2.3.12 查看和修改私有网络配置: # oifcfg getif en0
192.168.101.0
public en1
10.10.11.0
cluster_interconnect 如不正确使用下面命令重新修改: # oifcfg setif -global en1/10.10.11.0:cluster_interconnect # oifcfg getif en0
192.168.101.0
public en1
10.10.11.0
cluster_interconnect
2.3.13 重启crs服务: # crsctl stop crs -f # crsctl start crs CRS-4123: Oracle High Availability Services has been started. # crs_stat -t Name
------------------------------------------------------------ ora.DATA.dg
ora....up.type ONLINE
ora....ER.lsnr ora....er.type ONLINE
ora....N1.lsnr ora....er.type ONLINE
ora.asm.type
ora.cvu.type
ora.gsd.type
ora....SM1.asm application
ora....T1.lsnr application
ora.host1.gsd
application
ora.host1.ons
application
ora.host1.vip
ora....t1.type ONLINE
ora.host2.vip
ora....t1.type ONLINE
ora....network ora....rk.type ONLINE
ora.oc4j.type
ora.ons.type
ora....ry.acfs ora....fs.type ONLINE
ora.scan1.vip
ora....ip.type ONLINE
ora.yxdb.db
ora....se.type ONLINE
# oifcfg getif en0
192.168.101.0
public en1
10.10.11.0
cluster_interconnect 2.4 使用ocr自动备份不能恢复以上问题 以下为使用ocrconfig &restore方法进行恢复过程记录: # ocrconfig -showbackupp PROT-26: Oracle Cluster Registry backup locations were retrieved from a local copy
/u01/app/grid/product/11.2.0/grid/cdata/host-scan/backup00.ocr
/u01/app/grid/product/11.2.0/grid/cdata/host-scan/backup01.ocr
/u01/app/grid/product/11.2.0/grid/cdata/host-scan/backup02.ocr
/u01/app/grid/product/11.2.0/grid/cdata/host-scan/day.ocr
/u01/app/grid/product/11.2.0/grid/cdata/host-scan/week.ocr PROT-25: Manual backups for the Oracle Cluster Registry are not available # ocrconfig -restore /u01/app/grid/product/11.2.0/grid/cdata/host-scan/backup00.ocr PROT-35: The configured Oracle Cluster Registry locations are not accessible # crsctl start crs CRS-4123: Oracle High Availability Services has been started. # ocrconfig -restore /u01/app/grid/product/11.2.0/grid/cdata/host-scan/backup00.ocr # crsctl stop crs -f # crsctl start crs CRS-4123: Oracle High Availability Services has been started. # crs_stat -t CRS-0184: Cannot communicate with the CRS daemon. # crsctl start crs CRS-4123: Oracle High Availability Services has been started. # crs_stat -t CRS-0184: Cannot communicate with the CRS daemon.
阅读(...) 评论()博客分类:
我使用过的Linux命令之route - 显示和操作IP路由表
本文链接:
(转载请注明出处)
route命令用于显示和操作IP路由表(show / manipulate the IP routing table)。要实现两个不同的子网之间的通信,需要一台连接两个网络的路由器,或者同时位于两个网络的网关来实现。在Linux系统中,设置路由通常是为了解决以下问题:该Linux系统在一个局域网中,局域网中有一个网关,能够让机器访问Internet,那么就需要将这台机器的IP地址设置为Linux机器的默认路由。要注意的是,直接在命令行下执行route命令来添加路由,不会永久保存,当网卡重启或者机器重启之后,该路由就失效了;可以在/etc/rc.local中添加route命令来保证该路由设置永久有效。本文中的例子中会验证这一点。
格式:route
格式:/sbin/route
用于打印路由表(display the current routing table)。
在非root用户使用时需要使用完整路径执行route命令。
格式:route -n
格式:/sbin/route -n
用于打印路由表,加上-n参数就是在输出的信息中不打印主机名而直接打印ip地址。像netstat命令也有此参数。
格式:route add default gw {IP-ADDRESS} {INTERFACE-NAME}
用于设置默认路由(adds a default route, which will be used if no other route matches),其中,
参数{IP-ADDRESS): 用于指定路由器(网关)的IP地址(Specify router IP address);
参数{INTERFACE-NAME}: 用于指定接口名称,如eth0(Specify interface name such as eth0)。使用/sbin/ifconfig -a可以显示所有接口信息。
man route 写道
route add default gw mango-gw
adds a default route (which will be used if no other route matches).
All packets using this route
be gatewayed through "mango-gw". The device which will actually be used for that route depends on how we
can reach "mango-gw" - the static route to "mango-gw" will have to be set up before.
格式:route add -net {NETWORK-ADDRESS} netmask {NETMASK} dev {INTERFACE-NAME}
添加到指定网络的路由规则,其中
参数{NETWORK-ADDRESS}: 用于指定网络地址
参数{NETMASK}: 用于指定子网掩码
参数{INTERFACE-NAME}: 用于指定接口名称,如eth0。
man route 写道
route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0
adds a route to the network 192.56.76.x via "eth0". The Class C netmask modifier is not really necessary
here because 192.* is a Class C IP address. The word "dev" can be omitted here.
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
is an obscure one documented so people know how to do it. This sets all of the class D (multicast)
IP routes to go via "eth0". This is the correct normal configuration line with a multicasting kernel.
格式:route add -net {NETWORK-ADDRESS} netmask {NETMASK} reject
设置到指定网络为不可达,避免在连接到这个网络的地址时程序过长时间的等待,直接就知道该网络不可达。
man route 写道
route add -net 10.0.0.0 netmask 255.0.0.0 reject
This installs a rejecting route for the private network "10.x.x.x."
格式:route del -net {NETWORK-ADDRESS} netmask {NETMASK} dev {INTERFACE-NAME}
格式:route del -net {NETWORK-ADDRESS} netmask {NETMASK} reject
用于删除路由设置。参数指定的方式与route add相似。
route命令输出的路由表字段含义如下:
Destination 目标
The destination network or destination host. 目标网络或目标主机。
Gateway 网关
The gateway address or '*' if none set. 网关地址,如果没有就显示星号。
Genmask 网络掩码
'255.255.255.255' for a
host destination and '0.0.0.0' for the default route.
Possible flags include 标志,常用的是U和G。
U (route is up) 路由启用
H (target is a host) 目标是主机
G (use gateway) 使用网关
R (reinstate route for dynamic routing)
D (dynamically installed by daemon or redirect)
M (modified from routing daemon or redirect)
A (installed by addrconf)
C (cache entry)
(reject route)
Metric 距离、跳数。暂无用。
The 'distance' to the target (usually counted in
recent kernels, but may be needed by routing dae-
不用管,恒为0。
Number of references to this route. (Not used in the Linux
该路由被使用的次数,可以粗略估计通向指定网络地址的网络流量。
of lookups for the route.
Depending on the use of -F and
-C this will be either route cache misses (-F) or hits (-C).
Iface 接口,即eth0,eth0等网络接口名
Interface to which packets for this route will be sent.
示例一 打印当前路由表(root用户)
[root@jfht ~]# route
Kernel IP routing table
Destination
Flags Metric Ref
211.103.28.0
255.255.255.224 U
192.168.1.0
255.255.255.0
169.254.0.0
255.255.0.0
211.103.28.1
[root@jfht ~]# /sbin/route
Kernel IP routing table
Destination
Flags Metric Ref
211.103.28.0
255.255.255.224 U
192.168.1.0
255.255.255.0
169.254.0.0
255.255.0.0
211.103.28.1
[root@jfht ~]# route -n
Kernel IP routing table
Destination
Flags Metric Ref
211.103.28.0
255.255.255.224 U
192.168.1.0
255.255.255.0
169.254.0.0
255.255.0.0
211.103.28.1
[root@jfht ~]# /sbin/route -n
Kernel IP routing table
Destination
Flags Metric Ref
211.103.28.0
255.255.255.224 U
192.168.1.0
255.255.255.0
169.254.0.0
255.255.0.0
211.103.28.1
[root@jfht ~]#
示例二 打印当前路由表(非root用户)
[web@hnweb1 ~]$ route
-bash: route: command not found
[web@hnweb1 ~]$ /sbin/route
Kernel IP routing table
Destination
Flags Metric Ref
10.66.10.0
255.255.255.128 U
192.130.12.0
10.66.10.1
255.255.255.0
255.255.255.0
10.66.10.1
255.255.0.0
134.161.0.0
10.66.10.1
255.255.0.0
10.66.10.1
255.255.0.0
169.254.0.0
255.255.0.0
172.224.0.0
10.66.10.1
255.255.0.0
10.66.10.22
[web@hnweb1 ~]$ route -n
-bash: route: command not found
[web@hnweb1 ~]$ /sbin/route -n
Kernel IP routing table
Destination
Flags Metric Ref
10.66.10.0
255.255.255.128 U
192.130.12.0
10.66.10.1
255.255.255.0
255.255.255.0
10.66.10.1
255.255.0.0
134.161.0.0
10.66.10.1
255.255.0.0
10.66.10.1
255.255.0.0
169.254.0.0
255.255.0.0
172.224.0.0
10.66.10.1
255.255.0.0
10.66.10.22
[web@hnweb1 ~]$
示例三 设置到某网络的路由的例子
下面的例子
来自一个实际的服务器配置。
route命令写在了/etc/rc.local中,这样就设置了一条永久路由。
[root@jf07 root]# grep route /etc/rc.local
route add -net 10.0.0.0/8 gw 10.33.149.1 dev eth1
[root@jf07 root]# route
Kernel IP routing table
Destination
Flags Metric Ref
10.32.181.182
10.33.149.1
255.255.255.255 UGH
10.33.136.135
10.33.149.1
255.255.255.255 UGH
10.32.208.13
10.33.149.1
255.255.255.255 UGH
10.33.149.0
255.255.255.128 U
192.168.1.0
255.255.255.0
169.254.0.0
255.255.0.0
0 eth110.0.0.0
10.33.149.1
192.168.1.254
[root@jf07 root]#
示例四 添加拒绝路由的测试
[root@jfht ~]# route
Kernel IP routing table
Destination
Flags Metric Ref
211.103.28.0
255.255.255.224 U
192.168.1.0
255.255.255.0
169.254.0.0
255.255.0.0
211.103.28.1
[root@jfht ~]# ping 10.33.11.12
PING 10.33.11.12 (10.33.11.12) 56(84) bytes of data.Ctrl+C
--- 10.33.11.12 ping statistics ---
21 packets transmitted, 0 received, 100% packet loss, time 19999ms
[root@jfht ~]# route add -net 10.0.0.0 netmask 255.0.0.0 reject
[root@jfht ~]# route
Kernel IP routing table
Destination
Flags Metric Ref
211.103.28.0
255.255.255.224 U
192.168.1.0
255.255.255.0
169.254.0.0
255.255.0.0
211.103.28.1
[root@jfht ~]# ping 10.33.11.12
connect: Network is unreachable
[root@jfht ~]#
示例五 设置路由之后重启机器的测试
[root@node34 root]# route
Kernel IP routing table
Destination
Flags Metric Ref
192.168.227.0
255.255.255.0
169.254.0.0
255.255.0.0
192.168.227.2
[root@node34 root]# route add -net 10.0.0.0 netmask 255.0.0.0 reject
[root@node34 root]# route
Kernel IP routing table
Destination
Flags Metric Ref
192.168.227.0
255.255.255.0
169.254.0.0
255.255.0.0
192.168.227.2
[root@node34 root]# reboot
Broadcast message from root (pts/0) (Thu Jul
7 05:31:26 2011):
The system is going down for reboot NOW!
[root@node34 root]#
Last login: Thu Jul
7 05:30:50 2011 from 192.168.227.1
[root@node34 root]# route
Kernel IP routing table
Destination
Flags Metric Ref
192.168.227.0
255.255.255.0
169.254.0.0
255.255.0.0
192.168.227.2
[root@node34 root]#
上面的测试表明route设置的路由在机器重启之后就消失了。
示例六 将route命令添加到/etc/rc.local来设置永久路由的测试
先用vi在/etc/rc.local后面添加route命令。
[root@node34 root]# tail /etc/rc.local
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local#
add permanent route test
route add -net 10.0.0.0 netmask 255.0.0.0 reject
[root@node34 root]# route
Kernel IP routing table
Destination
Flags Metric Ref
192.168.227.0
255.255.255.0
169.254.0.0
255.255.0.0
192.168.227.2
[root@node34 root]# reboot
Broadcast message from root (pts/0) (Fri Jul 15 14:43:44 2011):
The system is going down for reboot NOW!
[root@node34 root]#
Last login: Fri Jul 15 14:40:22 2011 from 192.168.227.1
[root@node34 root]# route
Kernel IP routing table
Destination
Flags Metric Ref
192.168.227.0
255.255.255.0
169.254.0.0
255.255.0.0
192.168.227.2
[root@node34 root]#
示例七 删除路由的测试
删除路由的时候只需将route add改成route del,其他参数类似。如果报“无效的参数”或“没有那个进程”,可能是因为提供的参数不够。
[root@node34 root]# route
Kernel IP routing table
Destination
Flags Metric Ref
192.168.227.0
255.255.255.0
169.254.0.0
255.255.0.0
192.168.227.2
[root@node34 root]#
[root@node34 root]# route del -net 10.0.0.0
SIOCDELRT: 无效的参数
[root@node34 root]# route del -net 10.0.0.0 netmask 255.0.0.0
SIOCDELRT: 没有那个进程
[root@node34 root]#
[root@node34 root]# route del -net 10.0.0.0 netmask 255.0.0.0 reject
[root@node34 root]#
[root@node34 root]# route
Kernel IP routing table
Destination
Flags Metric Ref
192.168.227.0
255.255.255.0
169.254.0.0
255.255.0.0
192.168.227.2
[root@node34 root]#
【1】nixCraft Linux setup default gateway with route command
http://www.cyberciti.biz/faq/linux-setup-default-gateway-with-route-command/
【2】360doc Linux route命令
http://www.360doc.com/content/11/74.shtml
【3】Linux公社 Linux下route add route del 用法
http://www.linuxidc.com/Linux/32.htm
【4】鳥哥的 Linux 私房菜 第五章、 Linux 常用網路指令
http://linux.vbird.org/linux_server/0140networkcommand.php#route
浏览 29133
codingstandards
浏览: 3519897 次
来自: 上海
如果有A进程原代码情况下,通过如下调用,把他的子进程继承关闭则 ...
楼主咋没分析下源码呢?
tail -F 就可以吧
新手学习了,就是不明白为一个网卡配多个ip有什么用
不错,谢谢!
(window.slotbydup=window.slotbydup || []).push({
id: '4773203',
container: s,
size: '200,200',
display: 'inlay-fix'}

我要回帖

更多关于 im v kool什么意思 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信