Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

hosts (file)

From Wikipedia, the free encyclopedia
(Redirected fromHosts file)
Computer configuration file to map hostnames to IP addresses
For other uses, seeHost (disambiguation).

Thecomputer filehosts is an operating system file that mapshostnames toIP addresses. It is aplain text file. Originally a file named HOSTS.TXT was manually maintained and made available via file sharing byStanford Research Institute for theARPANET membership, containing the hostnames and address of hosts as contributed for inclusion by member organizations. TheDomain Name System, first described in 1983 and implemented in 1984,[1] automated the publication process and provided instantaneous and dynamic hostname resolution in the rapidly growing network. In modern operating systems, the hosts file remains an alternativename resolution mechanism, configurable often as part of facilities such as theName Service Switch as either the primary method or as a fallback method.

Purpose

[edit]

The hosts file is one of several system facilities that assists in addressing network nodes in a computer network. It is a common part of an operating system'sInternet Protocol (IP) implementation, and serves the function of translating human-friendly hostnames into numeric protocol addresses, calledIP addresses, that identify and locate a host in an IP network.

In some operating systems, the contents of the hosts file is used preferentially to other name resolution methods, such as theDomain Name System (DNS), but many systems implementname service switches, e.g.,nsswitch.conf forLinux andUnix, to provide customization. Unlike remote DNS resolvers, the hosts file is under the direct control of the local computer's administrator.[2]

File content

[edit]
This sectionneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources in this section. Unsourced material may be challenged and removed.(April 2017) (Learn how and when to remove this message)

The hosts file contains lines of text consisting of anIP address in the first text field followed by one or more host names.[3] The host names map to the IPs, not vice versa. Each field is separated by white space – tabs are often preferred for historical reasons, but spaces are also used. Comment lines may be included; they are indicated by anoctothorpe (#) in the first position of such lines. Entirely blank lines in the file are ignored.[4] For example, a typical hosts file may contain the following:

127.0.0.1  localhost loopback::1        localhost

This example only contains entries for the loopback addresses of the system and their host names, a typical default content of the hosts file. The example illustrates that an IP address may have multiple host names (localhost andloopback), and that a host name may be mapped to bothIPv4 andIPv6 IP addresses, as shown on the first and second lines respectively.

Location in the file system

[edit]

The location of the hosts file in thefile system hierarchy varies by operating system. It is usually namedhosts, without an extension.

Operating SystemVersion(s)Location
Unix,Unix-like,POSIX/etc/hosts[5]
Microsoft Windows3.1%WinDir%\HOSTS
95,98,ME%WinDir%\hosts[6]
NT,2000,XP,[7]2003,Vista,
2008,7,2012,8,10,11
%SystemRoot%\System32\drivers\etc\hosts[8]
Windows Mobile,Windows PhoneRegistry key under HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts
AppleMacintosh9 and earlierPreferences or System folder
Mac OS X 10.0–10.1.5[9](Added through NetInfo or niload)
Mac OS X 10.2 and newer/etc/hosts (asymbolic link to/private/etc/hosts)[9]
Novell NetWareSYS:etc\hosts
OS/2,eComStation,ArcaOS"bootdrive":\mptn\etc\
SymbianSymbian OS 6.1–9.0C:\system\data\hosts
Symbian OS9.1+C:\private\10000882\hosts
MorphOSNetStackENVARC:sys/net/hosts
AmigaOS< 4AmiTCP:db/hosts
4DEVS:Internet/hosts
AROSENVARC:AROSTCP/db/hosts
Android/etc/hosts (asymbolic link to/system/etc/hosts)
iOSiOS 2.0 and newer/etc/hosts (asymbolic link to/private/etc/hosts)
TOPS-20SYSTEM:HOSTS.TXT
Plan 9/lib/ndb/hosts
BeOS/boot/beos/etc/hosts[10]
Haiku/system/settings/network/hosts[11]
OpenVMSUCXUCX$HOST
TCPwareTCPIP$HOST
RISC OS3.7, 5!Boot.Resources.!Internet.files.Hosts
later boot sequence!Boot.Choices.Hardware.Disabled.Internet.Files.Hosts[12]

History

[edit]

TheARPANET, the predecessor of theInternet, had no distributed host name database. Each network node maintained its own map of the network nodes as needed and assigned them names that were memorable to the users of the system. There was no method for ensuring that all references to a given node in a network were using the same name, nor was there a way to read the hosts file of another computer to automatically obtain a copy.

The small size of the ARPANET kept the administrative overhead small to maintain an accurate hosts file. Network nodes typically had one address and could have many names. As local areaTCP/IP computer networks gained popularity, however, the maintenance of hosts files became a larger burden on system administrators as networks and network nodes were being added to the system with increasing frequency.

Standardization efforts, such as the format specification of the fileHOSTS.TXT in RFC 952, and distribution protocols, e.g., the hostname server described in RFC 953, helped with these problems, but the centralized and monolithic nature of hosts files eventually necessitated the creation of the distributedDomain Name System (DNS).

On some old systems a file named networks is present that is similar to a hosts file, containing names of networks.[13]

Extended applications

[edit]

In its function of resolving host names, the hosts file may be used to define anyhostname ordomain name for use in the local system.

Redirecting local domains
Some web service andintranet developers and administrators define locally defined domains in aLAN for various purposes, such as accessing the company's internal resources or to test local websites in development.[14]
Internet resource blocking
Entries in the hosts file may be used to blockonline advertising, or the domains of known malicious resources and servers that containspyware,adware, and othermalware. This may be achieved by adding entries for those sites to redirect requests to another address that does not exist or to a harmless destination such as thelocal machine.[15] Commercial software applications may be used to populate the hosts file with entries of known undesirable Internet resources automatically. In addition, user-created hosts files which block nuisance servers are publicly available.[16][17]
Fravia described these files variously as "scrolls", "precious", and "powerful" in his anti-advertisement pages, where this usage of hosts was first published.[17]
Software piracy
Somepirated versions of software rely on a modified hosts file to prevent software fromcontacting the activation servers of the publisher, although activation servers sometimes appear in general purpose hosts files.[18]

Security issues

[edit]

The hosts file may present an attack vector for malicious software. The file may be modified, for example, byadware,computer viruses, ortrojan horse software to redirect traffic from the intended destination to sites hosting malicious or unwanted content.[19] The widespreadcomputer wormMydoom.B blocked users from visiting sites aboutcomputer security andantivirus software and also affected access from the compromised computer to the MicrosoftWindows Update website.

In some cases, malware has modified the library responsible for loading the hosts file in order to redirect it to a file it is able to control freely.[20]

See also

[edit]

References

[edit]
  1. ^Internet Systems Consortium."The Most Widely Used Name Server Software: BIND". History of BIND. Retrieved2017-07-01.
  2. ^Cisco Networking Academy Program: First-Year Companion Guide (2nd ed.). Cisco Systems. 2002. p. 676.ISBN 1-58713-025-4.
  3. ^Penetration Testing: A Survival Guide. Packt Publishing Ltd. 18 January 2017.ISBN 978-1-78728-988-8.
  4. ^"Hosts(5) - Linux manual page".
  5. ^"Linux Network Administrators Guide: Writing hosts and networks files". RetrievedMay 16, 2010.
  6. ^"Hosts File". Archived fromthe original on July 20, 2011. RetrievedAugust 10, 2011.
  7. ^"Microsoft KB Q314053: TCP/IP and NBT configuration parameters for Windows XP". RetrievedAugust 28, 2010.
  8. ^"Microsoft KB 972034 Revision 2.0: default hosts files". RetrievedAugust 28, 2010.
  9. ^ab"Mac OS X: How to Add Hosts to Local Hosts File". RetrievedAugust 28, 2010.
  10. ^"The Haiku/BeOS Tip Server". Archived fromthe original on January 28, 2013. RetrievedNovember 30, 2012.
  11. ^"Haiku UserGuide:Network". RetrievedJanuary 17, 2019.
  12. ^RISC OS 6.14
  13. ^"Writing hosts and networks Files".tldp.org. Retrieved2021-03-02.
  14. ^"Building / Testing via the Hosts File".Ohio State University Web Hosting. OCIO. 9 October 2015. Retrieved5 August 2018.
  15. ^Gordon; -Tx."Gordon and -Tx explanations about the use of Gordon's hosts file".Web Searchlores. +Fravia. Archived fromthe original on 26 December 2018. Retrieved5 August 2018.
  16. ^Hofstetter, Constantin."/etc/hosts to block shock sites etc".GitHub. Retrieved5 August 2018.
  17. ^abVianello, Francesco "Fravia"."Antiadvertisement Lab".Web Searchlores. +Fravia. Archived fromthe original on 15 May 2009. Retrieved5 August 2018.
  18. ^"yhosts".GitHub. Retrieved21 June 2021.
  19. ^"Remove Trojan.Qhosts".Symantec. Archived fromthe original on October 21, 2007. RetrievedMay 16, 2010.
  20. ^Arntz, Pieter (21 September 2016)."Hosts file hijacks".Malwarebytes Labs. Retrieved5 August 2018.

External links

[edit]
Retrieved from "https://en.wikipedia.org/w/index.php?title=Hosts_(file)&oldid=1278412643"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp