How to block access to database by IP address in Linux and Windows

IN LINUX:

Solution:
1. [oracle@localhost ~]$ cd $ORACLE_HOME/network/admin

2. [oracle@localhost admin]$

3. Edit the sqlnet.ora file similar way:

4. [oracle@localhost admin]$ cat sqlnet.ora

    # sqlnet.ora Network Configuration File: /u01/app/oracle/product/11.1.0/db_1/network/admin/sqlnet.ora

    # Generated by Oracle configuration tools.

5. Now Paste Following lines in sqlnet.ora

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
tcp.validnode_checking = yes
tcp.invited_nodes = (localhost, 192.168.11.22)
tcp.excluded_nodes = (192.168.33.44)

6. save it

[oracle@localhost admin]$

6. Restart the listener.
Now connection to your database from one of the IPs excluded will be prevented.
Example:
Trying to connect mysid Oracle db from ip 192.168.33.44:

C:\>sqlplus myuser/...@mysid

SQL*Plus: Release 11.2.0.1.0 Production on
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
ERROR:
ORA-12537: TNS:connection closed
Enter user-name:

                                                       IN WINDOWS


1. C:> CD  oracle/product/11.1.0/db_1/network/admin/sqlnet.ora

2. Now pas following lines in sqlnet.ora

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
tcp.validnode_checking = yes
tcp.invited_nodes = (localhost, 192.168.11.22)
tcp.excluded_nodes = (192.168.33.44)

4. stop LSNRCTL = listner

5. start listner.

Comments