From Wikipedia, the free encyclopedia
Jump to: navigation, search
          This article is of interest to the following WikiProjects:
WikiProject Internet (Rated Start-class, Mid-importance)
WikiProject icon This article is within the scope of WikiProject Internet, a collaborative effort to improve the coverage of the Internet on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 Mid  This article has been rated as Mid-importance on the project's importance scale.
WikiProject Computing / Networking (Rated Start-class)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.
Taskforce icon
This article is supported by Networking task force (marked as High-importance).


The article is marked "needs additional citations for verification." Is this still valid? if so where? It is chocked full of references now. Jimwelch (talk) 14:14, 23 July 2015 (UTC)

First person in the paragraph about PHP? Doesn't look right to me!

I'm very new to making Wikipedia edits, so I'm not sure if this would be appropriate, but...

I've noticed a significant number of attacks from computers who've named themselves LOCALHOST (no IP recorded in event viewer). This might fool an inexperienced administrator or user into thinking the traffic is safe or just confuse the heck out of them, especially if they ping it and get an instant response from

Is there any way to work this into the article? I haven't found any information about it on the web(though I've tried), so I couldn't reference anything.

That is a spoofing method , the source ip address 127.0.0.x is faked , in fact an attack script could use any source ip address if it is not expect a response. —Preceding unsigned comment added by (talk) 17:37, 10 November 2010 (UTC)

—Preceding unsigned comment added by (talk) 22:22, 20 June 2008 (UTC)

Can someone put something about what this is useful for? Thanks! Mark Richards 19:02, 11 May 2004 (UTC)

Suppose you have an HTTP server on your computer. If you want to check up on it you just type http://localhost/ and you'll be there :-) You can also ping if you need to be absolutely sure that your computer exists. --Ihope127 18:40, 13 August 2005 (UTC)

One use of localhost is in connection scripts where a SQL server may reside on the same system that is trying to connect to it. A PHP connection script example:

$hostname = "localhost";

$database = "DatabaseName";

$username = "root";

$password = "0112454901"; sfgsfg$connectString = mysql_pconnect($hostname, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR);

Rather than specifiying the IP address of the server in the script, using localhost is more dynamic since it will ALWAYS refer to the local machine even if you change the IP.

Well, not really ALWAYS. localhost is in the etc/hosts file. In theory, localhost could be made to point to any IP you'd like. But the two alternatives (using localhost or using are about equivalent because to get either of them to no longer work would require manual intervention on the part of the user. Either to change the hosts file or to disable the loopback interface. Baggend 11:33, 20 April 2007 (UTC)

Another use the localhost reference is to test a Network Interface Card or NIC or your TCP/IP stack. A command line example:

Ping localhost

The result is pinging yourself. If no response is received there is a problem on the local machine not the network you may be working with. If you were to talk to yourself you would be considered a schizophrenic, with your comptuer on the other hand it may be desirable.

Hope these help!


Michael Andrade 16:46, 20 Aug 2004 (UTC)

Actually it won't test your NIC. is entirely implemented in software.
Also, what's etc. for? Jibjibjib 07:29, 18 January 2006 (UTC) are also reserved for loopback, it says so in the article. --Ifrit 09:41, 26 April 2006 (UTC)
Right, but is there a case where you'd want to use (or another loopback IP) instead of What was the logic of reserving a whole /8 block in IPv4, as opposed to the single address in IPv6? (Possible explanation: testing that a server only responds to requests from (a) certain IP(s), without needing WAN requests.)
Not sure about others, but I use it to placate a piece of software with an annoying license manager. It wants a fixed IP address that always points to my computer, but it won't use My real IP address changes when Iانتا اودبك اد ايه عبال ما توصال لى البيت go from one network to another, so I just use :-) --Reuben 07:04, 5 April 2007 (UTC)


Yes, I can also see reasons why a whole network can be useful, instead of a single IP. The reason why it's such a large network is probably that back in the time, plenty of IP addresses were available and nobody thought that we might be starving on IP addresses 30 years later. 09:22, 3 June 2007 (UTC)

انتا اودبك اد ايه عبال ما توصال لى البيت

I have found that the entire 127.x.x.x loops back (and the only thing in the hosts file is . This could just be Windows specific and I was wondering if anyone could quote a source that specifically specifies 127.x.x.x as loop back. —Preceding unsigned comment added by (talk) 03:16, 7 December 2007 (UTC)
You are correct ... though I can't cite an on-line source. You can indeed use any address in the network space. Yes the host file provides a default localloop config but even that isn't cast in stone. I'd change the article but I expect someone would want a citation.  :? -Ikester (talk) 15:16, 21 February 2008 (UTC)
ping is ICMP, which does not use TCP at all! So, it is wrong to say it will test the TCP/IP stack of whatever. Fabiovh (talk) 12:36, 13 May 2009 (UTC)
yes, it is correct usage. The term TCP/IP is a common name, for historical reasons, of the entire Internet Protocol suite. It doesn't just signify TCP. It's perhaps confusing to some but that's the traditional usage. See the TCP/IP model article. Kbrose (talk) 15:31, 13 May 2009 (UTC)
taken, but can you guarantee that it tests the stack for all operating systems? or does it refer to a specific one? Fabiovh (talk) 09:44, 15 May 2009 (UTC)


I think there's a typo in the first sentence. In computer networking, localhost is a hostname that means this computer and may be used... — Preceding unsigned comment added by (talk) 16:00, 31 August 2015 (UTC)

Localhost undefined[edit]

Regret the definition of "localhost" is gibberish.

There must be context.

I am at a computer at my home or office. I am on-line, which means I am talking to another computer in another place. Which of these is the "localhost" - ? Either of them?

I am trying to import a file into phplist. In the Mysql or php program (are they deliberately muddled?) which is on-line, the default import window that opens is to my personal machine, as I see my root directory C:\ I am told I am using the "localhost". If this is true, then I am ftp-ing (uploading) my local file to my server, where it will be imported into phplist. If this were true, then the file would be uploaded and then imported. Instead, I jam the program. Which means phplist is not looking in the right place, cannot find my file and so is merely running the clock out.

Which would indicate that I first need to upload my local file to my server and then fetch it with the import feature of phplist. Which means I need to somehow spin out of the default C:\ directory and and "be online", but from the window that opens you cannot go further than the local network. I.e., not on-line.

And every one of you is laughing now. This is why it is so hard to use computers. Dave of Maryland (talk) 18:44, 9 January 2012 (UTC)

General Revision -- 4/25/2013[edit]

Much of the information in this article was duplicated by the "Virtual network interface" section of the Loopback article. Having it in two places creates a maintenance headache, so I boldly thought about where it really ought to be — here, there, or in a new article with a title like maybe "Loopback interface" — and came to the conclusion that this actually is that article, it's just titled localhost because that's the name most commonly used for the loopback interface.

So I recast that section of the Loopback article as a summary of this one, and set about merging in any unique information from it:

  • I specifically did not reintroduce the erroneous suggestion that one can test the TCP/IP stack by pinging localhost or — my understanding is that ping uses little if any of that stack.
  • I did add in the paragraph about martian packets.

As a professional writer and editor, I also thought this page was in need of some reorganization and clarification, so I boldly did that as well:

  • I tried to organize the information into sections of increasing technical complexity, with a very general lede followed by a "How it's done" section that will hopefully be clear to networking novices.
  • I specifically clarified that doesn't mean through!
  • I clarified that services can respond differently to specific IPv4 loopback addresses.
  • I tried to cite the current/most recent versions of the relevant IETF standards (RFCs), referring to others only for historical purposes. I won't be surprised if true experts might be able to improve on my efforts. In particular, I corrected the implication that ICANN/IANA at one point had a say in the assignment of loopback addresses. IANA lists them, with itself as the owner, because the IETF requires it to. They were originally and have always been reserved by the IETF, and no other organization has ever had the authority to change them.

I realize neither article actually said or implied that includes only through, but I think it needed to be clarified. My main reason was that somebody set up redirects to this article from those eight IP addresses (and added each of them to the Internet Protocol addresses category), probably thinking that's what means. Another made that claim toward the top of this talk page. I've also been able to find external web pages that claim localhost is synonymous with those eight IP addresses, so I think we need to do what we can to clarify that misconception here.

I might also initiate a reconsideration of all IP Address redirects to this article other than,, and 127.1 (the latter serves to alert readers of the list to the fact that loopback addresses of that form are permissible), on the grounds that nobody is apt to deliberately search for any of the others, and I see no justification for redirecting only a handful of the millions of other valid loopback addresses. The few hits they are getting probably all come from the Internet Protocol addresses category page, where people see them and wonder what the heck. To test that theory, I have removed the others from that category to see if their hits fall to zero. I also added a generic 127.x.x.x redirect that will now show up on that list. Joeldbenson (talk) 23:12, 25 April 2013 (UTC)

Looks good to me. well done.--Salix (talk): 06:25, 26 April 2013 (UTC)

Second-level localhost[edit]

The statement

  • 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.[disputed ]

seems to be false — both and are currently (August 2014) registered and point to active websites. � (talk) 21:00, 27 August 2014 (UTC)