หน้าแรก

13 มิ.ย. 2559

วิธีแก้ไขไฟล์ hosts Windows XP, 7, 8, 10 และปัญหาที่พบ

ไฟล์ Host (ไม่มีนามสกุล) ในวินโดส์เป็นไฟล์ที่เก็บชื่อ Host กับ IP ไว้ ปกติแล้วเวลาเข้าเว็บไซต์ไหน หรือเชื่อมต่อไปที่ Domain ไหน วินโดส์จะวิ่งมาที่ Host ไฟล์ก่อน แล้วถึงจะวิ่งไปที่ DNS เครื่อง



1) ที่ My Computer หรือ This PC (ขึ้นกับวินโดว์สที่ใช้) จากนั้นไปที่พาทธ C:\Windows\System32\drivers\etc\ จากนั้นให้เปิดไฟล์  Hosts ด้วย Notepad ด้วยสิทธิ์ Administrator 
2) จากนั้นแก้ไขโดยเพิ่ม IP Address และชื่อแอดเดรสที่ต้องการต่อท้าย (ไม่มี # นำ) เช่น


# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1       localhost
# ::1             localhost
192.168.0.55 datacenter


3. จากนั้นกด Save (ต้องเป็น Administrator ของเครื่อง) หลังจาก save แล้ว ลองเรียกไอพีหรือชื่อที่ระบุบน browser ของเรา สำหรับคนที่ Map hosts file เอาไว้ เว็บที่เราทำไว้ก็จะแสดงขึ้นมา 
4. เสร็จสิ้น
หมายเหตุ
ถ้าแก้ไขแล้วบันทึกไม่ได้ผล ให้ย้ายไฟล์ hosts ออกมาแก้ไขที่พาทธอื่นแล้วย้ายกลับเข้าไป

ปัญหาที่พบ
ปัญหานี้เจอกับตนเอง แก้ไขอย่างไรก็ไม่เป็นผล ให้ตรวจสอบ Antivirus ที่พบคือ Avira (ร่มแดง) จะมี ออปชั่นที่ General -> security กำหนดว่า Protect Windows hosts file from changes ต้องเอาเครื่องหมายออก จึงจะใช้งานได้
อ้างอิง HOW TO : การบล๊อคเว็บไซต์ด้วย HOST FILE

ไม่มีความคิดเห็น:

แสดงความคิดเห็น