World Library  
Flag as Inappropriate
Email this Article


Article Id: WHEBN0000569755
Reproduction Date:

Title: Localhost  
Author: World Heritage Encyclopedia
Language: English
Subject: IPv6 address, I2P, Cyberbullying, Null route, .localhost
Collection: Internet Architecture, Internet Protocol Addresses
Publisher: World Heritage Encyclopedia


In computer networking, localhost is a hostname that means this computer or this host. It may be used to access the network services that are running on the host via its loopback network interface. Using the loopback interface bypasses and does not require any local network interface hardware. The local loopback mechanism may be useful for testing software during development, independently of any networking configurations. For example, if a computer has been configured to provide a website, directing a locally running web browser to http://localhost may display its home page.

On most computer systems, localhost resolves to the IP address, which is the most commonly used IPv4 loopback address, and to the IPv6 loopback address ::1.[1] The name localhost is also a reserved top-level domain name (cf. .localhost), set aside to avoid confusion with the definition as a hostname.[2] The IETF standards restrict domain name registrars from assigning the name localhost in registration procedures, such as for second-level domains.


  • Name resolution 1
  • IETF standards 2
  • Special cases 3
  • Martian packets 4
  • References 5

Name resolution

IPv4 network standards reserve the entire address block for loopback purposes. That means any packet sent to one of those 16,777,214 addresses ( through will be looped back. IPv6 has just a single address, ::1.

The resolution of the name localhost into one or more IP addresses is configured by the following lines in the operating system's hosts file:    localhost
::1          localhost

Localhost may also be mapped to other IPv4 loopback addresses, and additional synonyms may be assigned to any loopback address.

The processing of any packets sent to a loopback address is implemented in the link layer of the TCP/IP stack. Such packets are never delivered to any network interface controller (NIC) or device driver, which permits testing of software in the absence of any hardware network interfaces.

Like any other packets traversing the TCP/IP stack, looped-back packets convey the IP address and port number they were addressed to. Thus, the services that ultimately receive them can respond according to the specified loopback destination. For example, an HTTP service could route packets addressed to and to different Web servers, or to a single server that would return different web pages. To simplify such testing, the hosts file can be modified to provide appropriate aliases for each such address.

IETF standards

The name localhost is reserved for loopback purposes by RFC 6761 (Special-Use Domain Names),[3] which achieved the Proposed Standard maturity level in February, 2013. The standard sets forth a number of special considerations governing the use of the name in the Domain Name System:

  • An IPv4 or IPv6 address query for the name localhost must always resolve to the respective loopback address, which is specified in a separate standard.
  • 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 for localhost, it should return the appropriate loopback addresses, and negative responses for any other requested record types. Queries for localhost should not be sent to caching name servers.
  • To avoid burdening the Domain Name System root servers with traffic, caching name servers should never request name server records for localhost, or forward resolution to authoritative name servers.
  • DNS registrars are precluded from delegating domain names that include localhost, e.g.,, in order to avoid the confusion that would result if a DNS lookup appended a specified search domain.
  • When authoritative name servers receive localhost queries, they should appropriately resolve them.

The IPv4 loopback addresses are reserved within the IPv4 namespace by the IETF Special Use IPv4 Addresses standard (RFC 5735).[4] The reservation can be traced back to the November, 1986 Assigned Numbers standard (RFC 990), which was issued at a time when the first byte of the IP address was a signed network number that was the only portion of the address assigned by the IETF. Reserving its highest possible network number (127) for loopback testing eventually resulted in the excessive reservation of 16,777,214 loopback addresses.

In contrast, the IETF IP Version 6 Addressing Architecture standard (RFC 4291) reserves the single IPv6 loopback address ::1 within the IPv6 namespace. 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. Any such packet that is erroneously transmitted is not supposed to be routed, and should be dropped by all hosts that receive it.

Special cases

The releases of the MySQL database differentiate between the use of the hostname localhost and the use of the addresses and ::1.[5][6] When using localhost as the destination in a client connector interface of an application, the MySQL application programming interface connects to the database using a Unix domain socket, while a TCP connection via the loopback address requires the direct use of the explicit address.

One notable exception to the use of the network addresses is their use in Multiprotocol 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.

Martian packets

Any IP datagram with a source or destination address set to a loopback address must not appear outside of a computing system, or be routed by any routing device. Packets received on an interface with a loopback destination address must be dropped. Such packets are sometimes referred to as Martian packets[7] As with other bogus packets, they may be malicious and any problems they might cause can be avoided by applying bogon filtering.


  1. ^ "RFC4291: IP Version 6 Addressing Architecture". Section 2.5.3: IETF. 
  2. ^ "RFC2606: Reserved Top Level DNS Names". Section 2: IETF. 
  3. ^ "RFC6761: Special-Use Domain Names". Section 6.3: IETF. 
  4. ^ "RFC5735: Special Use IPv4 Addresses". Section 4: IETF. 
  5. ^ "MySQL :: MySQL 5.5 Reference Manual :: 4.1 Overview of MySQL Programs". 
  6. ^ "unix domain sockets vs. internet sockets". 
  7. ^ Raymond, Eric S. "The Jargon File". 
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.