一、簡介
禁止訪問網站可以通過多種方式實現,在網絡設備上實現大概是性能最好的方式。本文在域服務器上實現該功能,優點是配置簡單、可自定義跳轉頁面,缺點也很明顯,遇到熟悉操作系統的用戶,修改hosts文件可輕松破解。
IIS:Web服務器,顯示禁止訪問的頁面。
域組策略:用戶登陸時自動執行腳本,將共享出來的hosts文件復制來本地。
hosts:禁止訪問網站的列表,原理是將網站域名重定向到某個IP地址,這里重定向到Web服務器。
二、配置
IIS配置過程略
index.html頁面代碼
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=big5"/> <title>訪問拒絕</title> <style type="text/css"> <!-- body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;} fieldset{padding:0 15px 10px 15px;} h1{font-size:2.4em;margin:0;color:#FFF;} h2{font-size:1.7em;margin:0;color:#CC0000;} h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} #header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF; background-color:#555555;} #content{margin:0 0 0 2%;position:relative;} .content-container{background:#FFF;width:96%;margin-top:9px;padding:10px;position:relative;} --> </style> </head> <body> <div id="header"><h1>訪問拒絕</h1></div> <div id="content"> <div class="content-container"><fieldset> <h2>禁止瀏覽該網頁。</h2> <h3>如有任何疑問,請與系統管理員聯繫。</h3> </fieldset></div> </div> </body> </html>
域組策略指定腳本
腳本1.bat
xcopy /u /y \\192.168.1.100\Public\bat\hosts %windir%\system32\drivers\etc\
hosts文件,禁網頁QQ、微信
192.168.1.100 wx.qq.com 192.168.1.100 web.wechat.com 192.168.1.100 web2.qq.com
三、測試
本文出自 “運維菜鳥.log” 博客,謝絕轉載!