ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 通过SQLNET.ora文件限制Ip地址访问

通过SQLNET.ora文件限制Ip地址访问

原创 Linux操作系统 作者:yangzhangyue 时间:2013-07-25 14:47:09 0 删除 编辑
我们可以通过配置sqlnet.ora文件控制某些ip对数据库的访问

Access Control Settings in sqlnet.ora
Oracle Net Manager Field/Option sqlnet.ora File Parameter Description

Check TCP/IP client access rights

TCP.VALIDNODE_CHECKING

Use to specify whether to screen access to the database.

If this field is selected, Oracle Net Manager checks the parameters TCP.EXCLUDED_NODES and TCP.VALIDNODE_CHECKING to determine which clients to allow access to the database. If this field is deselected, Oracle Net Manager does not screen clients.

Clients excluded from access

TCP.EXCLUDED_NODES

Use to specify which clients using the TCP/IP protocol are denied access to the database.

Clients allowed to access


当我们需要屏蔽某些服务器时,或者说我们只希望某些ip可以连接时,我们可以通过设置sqlnet.ora实现。

设置前
在 192.168.6.52使用tnsping测试

[16:21:27 oracle@david_dgp ~]$ tnsping mydgl

TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 25-JUL-2013 16:21:35

Copyright (c) 1997, 2011, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.53)(PORT = 1530)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = myora)))
OK (0 msec)

在mydgl sqlnet.ora中添加如下内容:
TCP.VALIDNODE_CHECKING = YES

NAMES.DIRECTORY_PATH= (TNSNAMES)

TCP.INVITED_NODES= (192.168.6.53,192.168.6.51)

TCP.EXCLUDED_NODES= (192.168.6.52)

重启listener。

在 6.52上重新测试
[16:22:13 oracle@david_dgp ~]$ tnsping mydgl

TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 25-JUL-2013 16:22:48

Copyright (c) 1997, 2011, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.53)(PORT = 1530)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = myora)))
TNS-12547: TNS:lost contact
可以发现已经不能解析

在6.51上测试
[16:17:55 oracle@david_pri admin]$ tnsping mydgl

TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 25-JUL-2013 16:24:06

Copyright (c) 1997, 2011, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/11.2.0/db/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.6.53)(PORT = 1530)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = myora)))
OK (0 msec)

这将使我们在需要的时候控制某些ip的连接

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29033984/viewspace-767102/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-07-09

  • 博文量
    36
  • 访问量
    219936