แก้ไขไฟล์ hosts เพื่อเข้าเว็บโดยตรง เมื่อ DNS ยังไม่ Update

บันทึกโดย TaTump วันที่ 21 May 2009 | 745 views

 หลายครั้งที่สร้าง Domain ใหม่หรือเปลี่ยนชื่อ Domain แล้วลูกค้าไม่สามารถเข้าเว็บได้เพราะ DNS ของ internet ที่ลูกค้าใช้อยู่นั้น Update ช้า  สำหรับใครที่เจอปัญหานี้แนะนำให้ช้วิธี แก้ไขไฟล์ hosts โดยให้เข้าไปที่

C:\WINDOWS\system32\drivers\etc

จากนั้นมองหาไฟล์ที่ชื่อ hosts ให้เปิดด้วย notepad ก็ได้ครับ เมื่อเปิดมาก็ให้เพิ่ม IP Address ของเว็บ เคาะเว้นวรรคแล้วตามด้วยชื่อเว็บ จากนั้นก็ Save เป็นอันเสร็จพิธี ตัวอย่างด้านล่างเช่น เป็นการเพิ่มชื่อเว็บ www.memo8.com ชี้มา IP 61.19.251.193 จะมีหน้าตาประมาณนี้

# Copyright (c) 1993-1999 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

127.0.0.1       localhost

61.19.251.193 www.memo8.com

และนี่ก็คือการบอกเครื่องของเราว่าชื่อเว็บนี้ชี้ไปที่ IP นี้นะ พอเราเริ่มพิมพ์ชื่อเว็บเคาะ enter ป๊าบมันก็จะมาอ่านที่ไฟล์ host นี้ก่อนพอมันเห็น IP ที่บรรทัดเดียวกับชื่อเว็บปุ๊บมันก็วิ่งไปหา IP นั้นเลยโดยที่ไม่ต้องไปถาม DNS Server อีกแถมเร็วอีกตะหาก (ประมาณว่ารู้ทางไปแล้วโว้ย ไม่ง้อ DNS Server 555+)

Bookmark and Share

คอมเม้นท์ซิจ๊ะ