Blocking, only allowing South African IP address blocks

Say, we wish to stop hackers and the suggestion is to only allow through South African IP addresses as we are based in South Africa and the all the connections to the server are coming from South African IPs. Please assist with obtaining the South African IP address ranges as well as instructions on how to configure the Firewall on a Win2008 server. The server is on a Public South African IP and there is no firewall in front of it that we can configure. tx
Who is Participating?
David Paris VicenteConnect With a Mentor Systems and Comunications  Administrator Commented:
Because this can be really tricky, I suggest to do following.

Create a rule - > General Tab  choose Allow connection
Scope -> Select any local IP address then in the Remote IP add all South African subnets including all your private network in the Remote IP Address.

What this will do, will only permit access from the defined subnets.


I suggest to try first for the ICMP protocol, for that in the inbound rules disable only the File and Printer Sharing (Echo Request - ICMPv4-In) and File and Printer Sharing (Echo Request - ICMPv6-In)
Then try to ping the machine if everything is ok you will not be able to ping that machine, but the RDP session is available.

Then I have the following scenario, but you will have to tweak for your reality.

I have a server in my DMZ this server has the IP
I also have a private network with the following subnet
So in the Scope tab I choose the radio button for Any IP Address in the Local IP Address

And in Remote IP Address choose all the subnets that you want to define, probably all your internal subnets ( in my case I have a Network Class A, so all my internal/Private network is inside of this scope, so I will define this large subnet) and also the South African subnets. Try it first for the private network.

After this test you will be able to understand the flow, and you will understand what protocols you will want to permit or deny.

Note: Don´t Disable any protocol for RDP, you will loose remote access.

I hope to not confuse you but is tricky that's why this settings are more easily configured in a firewall appliance.

David Paris VicenteSystems and Comunications  Administrator Commented:
Hi shaunwingin,

This will require a lot of effort.
Because this will require a lot o writing I'm pointing to some links that can help you.
For the Ip address' assigned to South Africa the most reliable  source will be the Communications regulator in South Africa.

But you can find some address' here and here

For configuring the windows 2008 firewall you can find a tutorial here.

Hope it helps.

shaunwinginAuthor Commented:
Tx - with this  method: For configuring the windows 2008 firewall you can find a tutorial here.
I would have to block all those outside South Africa.
How would I only allow South Africa IP in?
How can I prevent locking myself out of the server- must I allow the servers ip explicitly - I assume to be safe as applying the allow IP's rule and using South African ranges - will this effectively block all other ips?
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Dr. KlahnPrincipal Software EngineerCommented:
I would take a different approach ... I think this is a lot simpler to do in linux.

Bring up a basic linux router / firewall from any of the preconfigured kits on the internet.  A very small system will do as long as it has two Ethernet interfaces.  Configure it to pass all traffic between ports A and B.

Install iptables on the system and also add the geoip plugin.

Then add a shell script to run at startup time after networking is up, with the command line

iptables -t filter -A INPUT -i eth0 -m geoip --src-cc ZA -p tcp -j ACCEPT
iptables -t filter -A INPUT -i eth0 -p tcp -j REJECT

Assume that eth0 is the Ethernet port facing the internet and that the system is routing traffic from eth0 to eth1 and vice versa.  This accepts all incoming connections on ethernet interface 0, on every port, coming from South Africa, and rejects all others.

This will be about 99% reliable if the geoip database is updated weekly via cron script.  It won't be perfect because there is always some ISP changing their CIDR blocks and it takes a while for that information to percolate out to the geoip database.

A nice side benefit of this is that you can do other blocking and accepting as well down to very specific levels.  If one particular ISP is a spam problem, it can be locked out with a line similar to:

iptables -t filter -A WebLockouts -s -p tcp --dport 25 -j REJECT
David Paris VicenteSystems and Comunications  Administrator Commented:
Is correct but I don´t mention this approach because shaunwingin  is asking for help with a windows firewall.

But yes, It will be easier with Linux, at the end you will not mess with windows firewall protocols and some service ports needed for communications.
Dr. KlahnPrincipal Software EngineerCommented:
Ah, my bad.  I forgot to add something very important ...

"Place the linux router/firewall in front of the existing Windows server, facing the internet, so that it can filter the traffic before the Windows system sees it.  Then no changes are needed in the Windows system."
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.