Restrict IP or Machine to Access Database Server

At times DBA / System Administrator have to block incoming connection on database server due to security reasons , for example we only allow application server and DBA machine to access database machine and want to block others or we just want to block single IP



Linux OS:
  • Block Single IP
iptables -A INPUT -s xx.xxx.xx.xx -j DROP


If you only want to restict database port only then 


iptables -A INPUT -s  xx.xxx.xx.xx  -p tcp --destination-port 1521 -j DROP


Block Incoming Port 1521 except for IP Address xx.xxx.xx.xx


iptables -A INPUT -p tcp -i eth1 -s ! xx.xxx.xx.xx --dport 1521 -j DROP
  • Un-Block
iptables -D INPUT -s xx.xxx.xx.xx -j DROP


Note: Iptable command located in # /sbin/


Windows 2008:


Add IP in  start > administrative tools > windows firewall with advanced security.