Archive for July 26th, 2013

How to Block Facebook access on Microsoft Windows XP / Vista / 7 and 8

Friday, July 26th, 2013

Disable facebook on Windows computers using windows hosts fileIn Office home network, there is a Windows XP computer which is spending all his official work time in facebook.
Hanging in facebook makes this social network freak work quite inefficient so something had to be done immediately … and guess who had to do it …

 Usually I do facebook filtering via iptables rules directly from Linux NAT router, but filtering facebook https (port 443 traffic) is real pain in the ass and moreover facebook has a bunch of hosts so filtering from Linux i-net router is not always best solution. In this specific case the Linux router deliving internet to the Win host was also having complete routing so filtering with iptables wasn't so easy.
To save myself from loosing few hours trying to discover why I can't manage to filter facebook from Linux router, checked online if it possible to filter facebook using standard Windows method.
It turns out on Windows computer it is possible filter facebook by simply mapping all Facebook main hosts to localhost (127.0.0.1) using hosts map file. In my case Win computer was running Windows XP, however on All Windows XP / Vista / 7 and 8, default location of hosts file is in: 

  
C:\WINDOWS\system32\drivers\etc\hosts

Microsoft Windows c:\system32\drivers\etc\hosts file Windows explorer screenshot

Therefore I used  Windows Explorer, navigated to C:\WINDOWS\system32\drivers\etc\ copied hosts file to Desktop, edited with Notepad and placed at the end of it following lines:

# Block Facebook
127.0.0.1 api.facebook.com 
127.0.0.1 connect.facebook.net
127.0.0.1 facebook.com
127.0.0.1 www.facebook.com
127.0.0.1 graph.facebook.com
127.0.0.1 profile-b.xx.fbcdn.net
127.0.0.1 s-static.ak.facebook.com
127.0.0.1 static.ak.connect.facebook.com
127.0.0.1 static.ak.facebook.com
127.0.0.1 static.ak.fbcdn.net
127.0.0.1 www.fbcdn.com
127.0.0.1 static.facebook.com
127.0.0.1 www.static.ak.connect.facebook.com
127.0.0.1 www.login.facebook.com
127.0.0.1 login.facebook.com

how to block facebook Windows hosts file opened in Notepad

Then copied the new modified hosts files from Desktop back to C:\WINDOWS\system32\drivers\etc
Following same logic, its possible to disable access to any host on the Internet. There are even some software like SpyBot which does by default change Windows default hosts file with pre-mapped well known spammer / spyware / malware hosts to prevent viruses and spyware to download more of themselves.

 Finally to make Windows re-read new hosts file I had to restart the PC, and Voila! Facebook access was cut 🙂

Checking I/O Hard Disk (Overhead) Read / Write operations on Microsoft Windows 7 – Resource Monitor

Friday, July 26th, 2013

I mainly have to deal with Linux servers. Today however I had to check for problems Microsoft Windows 7 server. The machine looked Okay but was reading from hard drive all the time. Hence I needed to check what is the Hard disk approximate read / write speed per second. I know on lInux tracking i/o hard disk server bottlenecks is done with iostat or dstat.

However I never did that on Windows, so I had to learn it by experience. Its actually pretty easy and you don't even need to install external program to see read / write hdd speed operations. Windows 7 is bundled with a Program called Resource Manager. Running Resource Manager's easiest method is from Windows Task Manager, i.e.:

Windows 7 Task Manager processes performance tab - how to check hard drive bottleneck windows server
Press Ctrl + Alt + Del (Choose Start Task Manager) and from Task Manager click on Resource Monitor Button.
Immediately resource Monitor pops up and selecting the Disk tab priovides information on HDD Read / Write speed per sec. Using Resource Monitor, you can quickly also see which process is creating the most HDD overhead for server.

microsoft windows 7 resource monitor screenshot

windows resource monitor disk tab hard disk show read write speed win7

Though I'm not Microsoft fan, I should admit Resource Manager does a great job.