| What is IP=FIRST in the LISTENER.ORA file ? [ID 300729.1] | |||||
|
|
|||||
| 修改时间 30-SEP-2011 类型 BULLETIN 状态 PUBLISHED | |||||
In this Document
Purpose
Scope and Application
What is IP=FIRST in the LISTENER.ORA file ?
References
| How The Listener Binds On TCP Protocol Addresses [ID 421305.1] | |||||
|
|
|||||
| 修改时间 11-JAN-2012 类型 BULLETIN 状态 PUBLISHED | |||||
In this Document
Purpose
Scope and Application
How The Listener Binds On TCP Protocol Addresses
Introduction
General algorithm
Interpreting listener status
Side effects
Checking tool: Please be aware that Oracle support does not support this tool nor can we assist with issues that arise in trying to compile it.
References
(a) Oracle does a gethostbyname() on that hostname; potentially more than one IP address is returned.
The gethostbyname() library function may query the DNS server(s), the /etc/hosts file, the NIS service and perhaps other methods, based on the system configuration. How this works exactly depends on the operating system type, but usually the/etc/host.conf, /etc/nsswitch.conf and /etc/resolv.conf files are governing the functionality on the UNIX platforms.
You can find the value that is expected to be given by using the ping tool (e.g. "ping" or "ping -s " and see what IP address will the hostname resolve to). Do not use host, nslookup or dig to find this information, since these tools will query only the DNS service and may give wrong answers in certain situations.
Be careful that even the ping utility may not disclose you all the information, e.g. it will not show all the addresses associated with a hostname, if there are more than one. Best choice is to use the check-lsnrbind program, attached to this note (see below section "Checking tool").
(b) Oracle does a gethostname() which will return the system's configured hostname.
The gethostname() library function (notice the missing by particle) will return the standard hostname set for the system (or current processor, per manual pages); this is usually done at system startup.
You can find the value that is expected to be given by using the hostname tool, without any parameters (e.g. simply run "hostname").
(c) Oracle does a gethostbyname() on the system's hostname found in the previous step (2b).
(d) Oracle compares the first IP returned in (2a) to all of the IPs returned in (2c). If no match is found, then the listener will bind to the resolved IP address. The IP address is registered in the listening endpoints list.
— OR —
(e) If a match is found in (2d), the listener binds on all (working) network interfaces. The fully qualified system hostname is registered in the listening endpoints list.
You may recognize that the listener has bound to all interfaces from the "netstat -an" output: if the listener is bound to all interfaces then the IP address 0.0.0.0 will be shown — it programmers' slang this is known as the INADDR_ANY address.
$ lsnrctl status LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 07-MAY-2007 15:29:48 Copyright (c) 1991, 2005, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production Start Date 13-APR-2007 14:11:16 Uptime 24 days 1 hr. 18 min. 32 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /opt/oracle/product/10.2.0/db_1/network/admin/listener.ora Listener Log File /opt/oracle/product/10.2.0/db_1/network/log/listener.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.10)(PORT=1527))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost.ro.oracle.com)(PORT=1521)))
cc check-lsnrbind.c -o check-lsnrbind
cc check-lsnrbind.c -o check-lsnrbind -lnsl
./check-lsnrbind test ./check-lsnrbind test1 test2.foo.com ./check-lsnrbind -v mysite.domain.com
NOTE:300729.1 - What is IP=FIRST in the LISTENER.ORA file ?
NOTE:359277.1 - Changing Default Listener Port Number
NOTE:69026.1 - Oracle8i and socket LISTEN operations
check-lsnrbind.c源码可以在这里下载
check-lsnrbind.c!下面是编译check-lsnrbind出命令,执行check-lsnrbind命令检查bind的、监听的接口:
[root@rhel1 ~]# cc check-lsnrbind.c -o check-lsnrbind
[root@rhel1 ~]# ./check-lsnrbind rhel1
System hostname is: rhel1.localdomain
Checking binding for "rhel1": will listen on all interfaces
[root@rhel1 ~]# ./check-lsnrbind -v rhel1
System hostname is: rhel1.localdomain
First IP address for system hostname: 192.168.204.111
Checking binding for "rhel1": [ 192.168.204.111* ]
will listen on all interfaces
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23135684/viewspace-715967/ ,如需转载,请注明出处,否则将追究法律责任。