Whitelisting only specific ip range or program windows firewall

windows-firewallwindows-server-2008

I want my windows firewall to block all of the connections, except connections who are RDP connections (to the RDP port), smb (smb port?), and from specific IP ranges.
I've tried to add a rule that allows those IP ranges, the ports and the programs I want. I also added a rule that blocks any connection from any IP.
The result I got is that it logged me out from the RDP, which wasn't really nice.
How can I achieve my goal?

Best Answer

By default the Windows Firewall blocks any connection that is not explicitly allowed. An explicit block takes precedence before an Allow rule.

So remove the block rule and just allow what you need to pass through the Firewall.