Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

localhost

Page semi-protected
From Wikipedia, the free encyclopedia
(Redirected from127.0.0.1)
Standard hostname for a networked device's loopback interface

For the domain name label, see.localhost.
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Localhost" – news ·newspapers ·books ·scholar ·JSTOR
(June 2020) (Learn how and when to remove this message)

Incomputer networking,localhost is ahostname that refers to the current computer used to access it. The namelocalhost is reserved forloopback purposes.[1]It is used to access thenetwork services that are running on the host via the loopback network interface. Using the loopback interface bypasses any localnetwork interface hardware.

Loopback

Main article:Loopback

The local loopback mechanism may be used to run a network service on a host without requiring a physical network interface, or without making the service accessible from the networks the computer may be connected to. For example, a locally installedwebsite may be accessed from a Web browser by theURLhttp://localhost to display its home page.

IPv4 network standardsreserve the entire address block127.0.0.0/8 (more than 16 million addresses) for loopback purposes.[2] That means any packet sent to any of those addresses is looped back. The address127.0.0.1 is the standard address for IPv4 loopback traffic; the rest are not supported by all operating systems. However, they can be used to set up multiple server applications on the host, all listening on the same port number. In theIPv6 addressing architecture[3] there is only a single address assigned for loopback:::1. The standard precludes the assignment of that address to any physical interface, as well as its use as the source or destination address in any packet sent to remote hosts.

Name resolution

The namelocalhost normally resolves to theIPv4 loopbackaddress127.0.0.1, and to theIPv6 loopback address::1.

This resolution is normally configured by the following lines in the operating system'shosts file:

127.0.0.1    localhost::1          localhost

The name may also be resolved byDomain Name System (DNS) servers, but there are special considerations[1] governing the use of this name:

  • AnIPv4 orIPv6 address query for the name localhost must always resolve to the respective loopback address.
  • Applications may resolve the name to a loopback address themselves, or pass it to the local name resolver mechanisms.
  • When a name resolver receives an address (A or AAAA) query forlocalhost, it should return the appropriate loopback addresses, and negative responses for any other requested record types. Queries forlocalhost should not be sent to caching name servers.
  • To avoid burdening theDomain Name System root servers with traffic, caching name servers should never request name server records forlocalhost, or forward resolution to authoritative name servers.
  • When authoritative name servers receive queries for 'localhost' in spite of the provisions mentioned above, they should resolve them appropriately.

In addition to the mapping oflocalhost to the loopback addresses (127.0.0.1 and::1),localhost may also be mapped to other IPv4 (loopback) addresses and it is also possible to assign other, or additional, names to any loopback address. The mapping oflocalhost to addresses other than the designated loopback address range in the hosts file or in DNS is not guaranteed to have the desired effect, as applications may map the name internally.

In the Domain Name System, the name.localhost is reserved as atop-leveldomain name, originally set aside to avoid confusion with thehostnamelocalhost.[4] Domain name registrars are precluded from delegating domain names in the top-level.localhost domain.[1]

Historical notes

In 1981, the block127.0.0.0/8 got a 'reserved' status,[5] as not to assign it as a general purposeclass A IP network.This block was officially assigned for loopback purposes in 1986.[6]Its purpose as aSpecial Use IPv4 Address block was confirmed in 1994,[7], 2002[8], 2010,[9], and last in 2013.[2]

From the outset, in 1995, the single IPv6 loopback address::1 was defined.[10] Its purpose and definition was unchanged in 1998,[11], 2003,[12], and up to the current definition, in 2006.[3]

Packet processing

The processing of any packet sent to a loopback address, is implemented in thelink layer of theTCP/IP stack. Such packets are never passed to anynetwork interface controller (NIC) or hardware device driver and must not appear outside of a computing system, or be routed by any router. This permits software testing and local services, even in the absence of any hardware network interfaces.

Looped-back packets are distinguished from any other packets traversing the TCP/IP stack only by the special IP address they were addressed to. Thus, the services that ultimately receive them respond according to the specified destination. For example, an HTTP service could route packets addressed to127.0.0.99:80 and127.0.0.100:80 to different Web servers, or to a single server that returns different web pages. To simplify such testing, the hosts file may be configured to provide appropriate names for each address.

Packets received on a non-loopback interface with a loopback source or destination address must be dropped. Such packets are sometimes referred to asMartian packets.[13] As with any other bogus packets, they may be malicious and any problems they might cause can be avoided by applyingbogon filtering.

Special cases

The releases of theMySQL database differentiate between the use of the hostnamelocalhost and the use of the addresses127.0.0.1 and::1.[14] When usinglocalhost as the destination in a client connector interface of an application, the MySQL application programming interface connects to the database using aUnix domain socket, while a TCP connection via the loopback interface requires the direct use of the explicit address.

One notable exception to the use of the127.0.0.0/8 addresses is their use inMultiprotocol Label Switching (MPLS) traceroute error detection, in which their property of not being routable provides a convenient means to avoid delivery of faulty packets to end users.

See also

References

  1. ^abcS. Cheshire; M. Krochmal (February 2013).Special-Use Domain Names.Internet Engineering Task Force.doi:10.17487/RFC6761.ISSN 2070-1721.RFC6761.Proposed Standard. UpdatesRFC 1918 and2606.
  2. ^abM. Cotton; L. Vegoda; B. Haberman (April 2013). R. Bonica (ed.).Special-Purpose IP Address Registries.Internet Engineering Task Force.doi:10.17487/RFC6890.ISSN 2070-1721. BCP 153. RFC6890.Best Current Practice 153. ObsoletesRFC 4773,5156,5735 and5736. Updated byRFC 8190.
  3. ^abR. Hinden;S. Deering (February 2006).IP Version 6 Addressing Architecture. Network Working Group.doi:10.17487/RFC4291.RFC4291.Draft Standard. ObsoletesRFC 3513. Updated byRFC 5952,6052,7136,7346,7371 and8064.
  4. ^D. Eastlake; A. Panitz (June 1999).Reserved Top Level DNS Names. Network Working Group.doi:10.17487/RFC2606. BCP 32. RFC2606.Best Current Practice 32. Updated byRFC 6761.
  5. ^J. Postel (September 1981).ASSIGNED NUMBERS. Network Working Group.doi:10.17487/RFC0790.RFC790.Obsolete. Obsoleted byRFC 820. ObsoletesRFC 776,770,762,758,755,750,739,604,503,433 and349.Obsoletes IENs: 127, 117, 93.
  6. ^J. Reynolds;J. Postel (November 1986).ASSIGNED NUMBERS. Network Working Group.doi:10.17487/RFC0990.RFC990.Obsolete. Obsoleted byRFC 1010. ObsoletesRFC 960. Obsoletes IENs 127, 117, and 93.
  7. ^J. Reynolds;J. Postel (October 1994).ASSIGNED NUMBERS. Network Working Group.doi:10.17487/RFC1700. STD 2. RFC1700.Obsolete. Obsoleted byRFC 3232. ObsoletesRFC 1340,1060,1010,990,960,943,923,900,870,820,790,776,770,762,758,755,750,739604,503,433 and349. Obsoletes IENs: 127, 117, 93.
  8. ^IANA (September 2002).Special-Use IPv4 Addresses. Network Working Group.doi:10.17487/RFC3330.RFC3330.Obsolete. Obsoleted byRFC 5735.
  9. ^M. Cotton; L. Vegoda (January 2010).Special Use IPv4 Addresses.Internet Engineering Task Force.doi:10.17487/RFC5735.ISSN 2070-1721. BCP 153. RFC5735.Obsolete. Obsoleted byRFC 6890.
  10. ^R. Hinden;S. Deering (December 1995).IP Version 6 Addressing Architecture. Network Working Group.doi:10.17487/RFC1884.RFC1884.Obsolete. Obsoleted byRFC 2373.
  11. ^R. Hinden;S. Deering (July 1998).IP Version 6 Addressing Architecture. Network Working Group.doi:10.17487/RFC2373.RFC2373.Obsolete. Obsoleted byRFC 3513. ObsoletesRFC 1884.
  12. ^R. Hinden;S. Deering (April 2003).IP Version 6 Addressing Architecture. Network Working Group.doi:10.17487/RFC3513.RFC3513.Obsolete. ObsoletesRFC 2373. Obsoleted byRFC 4291.
  13. ^Raymond, Eric S."The Jargon File".
  14. ^"MySQL :: MySQL 5.5 Reference Manual :: 4.1 Overview of MySQL Programs".
Retrieved from "https://en.wikipedia.org/w/index.php?title=Localhost&oldid=1246252908"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp