Understand Host File
Host file kya hoti hai : जब भी आप अपने computer पर internet use करते हुए किसी भी website को open करना चाहते है तो आप उस website का URL or address browser मे type करते है जिसको की domain name भी कहते है जैसे की hinditechy.com | Browser पर जब भी आप कोई domain name type करते है तो यह domain name से communication नहीं करते हुए उसके लिए set किया हुआ IP address को search करता है जैसे की 192.168.1.1.| इसीलिए जब भी आप domain name type करते है तो यह सबसे पहले IP address मे convert करता है फिर internet पर open होता है |
Domain name (hostnames) को IP address मे convert करने के process को Domain Name Resolution कहा जाता है | चाहे किसी भी computer पर कोई भी OS हो domain names to IP addresses resolutions के लिए DNS ही काम मे आता है |
Domain name को resolve करने का एक तरीका और है जिसमे Domain Name System (DNS) को use नहीं किया जाता और वो है HOSTS file. लगभग सभी operating system जो की TCP/IP से communicate करते है internet के communication के लिए as standard – HOSTS file रखते है | यह file domain names and IP addresses के बिच mappings create करने के लिए काम मे आती है |

what is host file
HOSTS file एक text file होती है जो की जो की IP address and domain name की entry को save करके रखती है | इस file मे पहले IP address और फिर एक space के बाद same line मे उसका domain name आता है | एक file मे इस तरह से बहुत सारी entries की जा सकती है | For example जैसे की हम चाहते है की जब आप www.google.com browser मे type करे तो यह Google की जगह पर www.hinditechy website open कर दे तो उसके लिए आपको hinditechy website का IP address पता होना चाहिए | जब आपको hinditechy का IP address पता हो तो आप host file मे www.google.com को उस IP address पर map कर सकते है . Example – अगर hinditechy का IP address x.x.x.x है तो आप host file open करके निचे बताई entry कर दे –
x.x.x.x www.google.com
आपको ये पढ़ कर लग रहा होगा की ऐसा क्यों होता है जबकि domain name resolution के लिए तो DNS server होता है वही domain को resolve करता है | वैसे तो यह सही बात है लेकिन ज्यादातर OS मे default setting होती है की DNS server से मिली किसी भी entry को Hosts file overrides कर दे | यहाँ तक की अगर आपके computer मे Host file मे किसी भी domain के लिए IP address define किया गया है तो आपको computer DNS को query भी नहीं करता और host file से IP address ले कर उसको resolve कर देता है | इसके साथ साथ host file की एक खास बात ये भी होती है की इसमे कोई भी entry करने के बाद किसी भी service ya computer को restart नहीं करना पड़ता और ये directly start हो जाता है |
Windows मे host file का address or location होती है –
%SystemRoot%\System32\drivers\etc\hosts
OR
C:\Windows\System32\drivers\etc\hosts
Linux / Unix मे – /etc/hosts