Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

how can I define some IP filters for SQL server 2008 remote connection? (my server is running on winserver 2008 R2), I use remote desktop to to view my server and I can run firewall and sql server management studio, how should I block some IPs from accessing my sql server? should I disable remote connection at all? can you describe the procedure step by step? should I restart my windows server after making changes? thanks

share|improve this question

migrated from Jul 17 '11 at 8:32

This question came from our site for professional and enthusiast programmers.

You could also have a look at logon triggers ( Essentially, you're going to get the client IP address from the eventdata that's part of the logon trigger context, get the value of ClientHost from it, and if it matches any of your forbidden IPs, execute a rollback. I'd go with a firewall solution myself, though.

share|improve this answer
This was my first thought as well, though I'd prefer to do it at the hardware/network layer. – Peter Schofield Jul 17 '11 at 16:14

I think SQL Server traffic is on port 1433 tcp, So basically you want to block some IP's on that port on your server, Windows built-in Firewall lacks this kind of functionality (also i'm not sure about that never used Windows built-in firewall anyway) so I suggest you install Comodo Firewall free edition and add inbound rule that blocks all traffic coming from specific IP address to port 1433 on your server. You can try other free firewalls (i've tried ZoneAlarm but prefer Comodo) and do the same


I've found a way to do this in Windows Firewall, see this

How can a block IP addresses using Windows Server 2008 firewall?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.