Talk:Localhost

From Wikipedia, the free encyclopedia
Jump to: navigation, search
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).
 

General[edit]

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 127.0.0.1.

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 200.43.32.32 (talk) 17:37, 10 November 2010 (UTC)


—Preceding unsigned comment added by 67.40.64.134 (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 127.0.0.1 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 127.0.0.1) 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!

Cheers,

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

Actually it won't test your NIC. 127.0.0.1 is entirely implemented in software.
Also, what's 127.0.0.2 etc. for? Jibjibjib 07:29, 18 January 2006 (UTC)
127.0.0.2-8 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 127.0.0.2 (or another loopback IP) instead of 127.0.0.1? 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 127.0.0.1. My real IP address changes when Iانتا اودبك اد ايه عبال ما توصال لى البيت go from one network to another, so I just use 127.0.0.2. :-) --Reuben 07:04, 5 April 2007 (UTC)

v

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. 83.79.34.243 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 127.0.0.1) . 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 68.211.149.39 (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 127.0.0.0 network space. Yes the host file provides a default 127.0.0.1 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)

Why 127[edit]

Does anyone know why specifically 127.0.0.1 is the address of the local machine?

What’s so special about 127?
I would have thought 0.0.0.1 for example would have been the most logical choice or maybe even 1.0.0.0
Note that 127 in binary is 01111111... maybe it's got something vaguely to do with that?
Quite simply, yes. The entire loopback address in binary is 01111111.00000000.00000000.00000001 --Ihope127 18:37, 13 August 2005 (UTC)
To answer those questions: In the old Classful network structure, 127.0.0.0/8 was the last (highest possible) class A network. It was and still is common to use border elements from a set for special purpose. Any other class A network, like 100.0.0.0/8 would have been arbitrary and make less sense. Also, the network 0.0.0.0/8 has already a different purpose and meaning so this is probably the reason why 127.0.0.0/8 was chosen. 83.79.34.243 09:17, 3 June 2007 (UTC)


theres no way this is differnt for anyone else right the local host is always that right o.O

just had an argument with a n00b and hes telling me im wrong and his local host always changes >.>;;
message me on <<e-mail address censored>> about this k?
just a word of caution, you might want to delete your email address from here. i would do it for you but i dont know if you arer ok with putting your email out there. this is wikipedia, but i bet there are still sum people out here who would abuse having some random person's email address. Jds10912 03:24, 21 January 2006 (UTC)
As he put his email adress there to be contacted I doubt that he is checking up on this page. Deleted the address... (reverting is possible anyway)

Humor section[edit]

The humor section (or at the very least, the jokes at the top of it) isn't appropriate for a non-humor-related encyclopedia article. Deleting the jokes.

- Matthew0028 05:47, 18 August 2005 (UTC)

  • "There's no place like 127.0.0.1"
  • "127.0.0.1? Nice FTP site, but I already have that stuff."
  • "127.0.0.1, sweet, 127.0.0.1" (as in "Home, sweet home").

I'll stick that in WP:BJAODN. I think it's roaringly funny (but then, does anyone else?)~user:orngjce223how am I typing? 19:08, 8 December 2006 (UTC)

Kind of related but I removed "All of which are fun" from the end of the urban legends bit. POV - Sas

127.0.0.1 Security : Apache Servers[edit]

It is possible to block access to your server, in this case localhost (i.e. 127.0.0.1) in quite a simple manner, according to the concise, comprehensive overview i referenced on this topic. Though i knew it was possible, i wasn't quite sure of the capacity, nor precisely the correct syntax.

I wanted to find a way to block media from IP's other than localhost during development. (though i do not find them be malicious, it might illustrate better the meaning of "media from IP's other than 127.0.0.1-- the Syndicated content one might acquire from Google® AdSense™, or Yahoo! MyWeb Badge, for example.) Whatever the purpose might be for "blocking" the outside sources, i've copied here the text of a fine resource i found at javascriptkit.com (a credible resource, IMHO):

Blocking users by IP[edit]

order allow,deny
deny from 123.45.6.7
deny from 012.34.5.
allow from all

You can deny access based upon IP address or an IP block. The above blocks access to the site from 123.45.6.7, and from any sub domain under the IP block 012.34.5. (012.34.5.1, 012.34.5.2, 012.34.5.3, etc.)[...]

You can also set an option for deny from all,[or] allow or deny by domain name rather than IP address (allow from .javascriptkit.com [...])

Original content snipped, not altered otherwise by this Wikipedia User

Blocking Users by IP: Comprehensive guide to .htaccess. Copyright © 1997-2007 JavaScript Kit. Available at: http://www.javascriptkit.com/howto/htaccess5.shtml . Accessed: Apr-30, 2007. Jsabarese 02:57, 30 April 2007 (UTC)

SetCookie on Localhost with PHP and Apache[edit]

Well, it might have to do something with weariness since I just finished proxy configuration for our network (and still do not understand why computers in another domain are fetching OUR wpad.dat) ... but I do not understand, what has the PHP function SetCookie to do with encyclopaedical article about localhost? Does Wikipedia supply PHP-Manual? What will be next, shouldn't we mention that there is no way to capture packets on local loopbac

  1. Numbered list item
  2. Numbered list item

k in SunOS with Ethereal? --Kavol 20:31, 19 February 2006 (UTC)

SetCookie is obviously a function that writes a cookie to your computer, maybe this person was having trouble with SetCookie on their server.
Also, some people think this is a support talk, so for those of you who need help with any PHP-related queries, please use the the PHP Manual, [www.php.net/manual]. Thanks. Teckie 20:04, 15 April 2006 (UTC)

<body>sum</body> <h> This is my page</h>

Humor again[edit]

I am removing the humor section as I do not believe it is relevant encyclopedic content. If you disagree, please discuss it here instead of reverting. --J Morgan(talk) 21:07, 9 August 2006 (UTC)

Maybe it's time for some real jokes? Like, putting 127.0.0.1 in someones blacklist? - Face 20:09, 25 September 2006 (UTC)
I think they may fit in, under a Cultural References section. One of my favs (likely fake but fun anyway).RevRagnarok Talk Contrib 21:43, 25 September 2006 (UTC)

... September 25, 2006 by TrueRock2 Oops - I just finished putting the humor/myth content back into the article. I was so shocked to not see it in the article I assumed it was some type of mistake. Regardless, I think you are going to have trouble divorcing reality from the article. If there is just one piece of info about 127.0.0.1 that is part of our universal knowledge it is this story/prank. My expectation of a Wikipedia article is to see every piece of information on a topic - especially information that would be known by any knowledgeable and educated individual.

127.0.0.1 is maybe the _only_ IP-address with some cultural background so I _demand_ bringing the insider-jokes back. Thats like writing an article about Jerry Lewis and refusing to point out his humor because it is a serious article. Crass Spektakel 21:20, 7 November 2006 (UTC)

  • Okay, you all have convinced me that there should be some mention of the cultural meaning of 127.0.0.1. When I removed the humor section, it was a full 41% of the article (by word count, 251 out of 608 in MS Word). I still think that would be excessive. On another note, I don't object to a humorous example, but I also don't think this page should become a list of jokes. My suggestion is now to keep the section (as of edit 85687792), and ensure that the technical description of 127.0.0.1 remains the primary topic --J Morgan(talk) 18:40, 9 November 2006 (UTC)

Urban Legends[edit]

Why is the Urban Legends section flagged as not citing its sources? It's about urban legends, what sources could be cited? I also think this section has no use or bearing on an encyclopedic article about localhost, but I'll leave that up to you. dimo414 03:56, 19 April 2007 (UTC)

Yeah, I'm not really sure what references you'd cite for an urban legend. And I'd have to disagree on the question of whether or not that section should be included. See "Humor again" for some reasons why. I'd say that localhost actually has more SOCIAL relevance than it does TECHNICAL relevance. Baggend 11:38, 20 April 2007 (UTC)

Difference[edit]

Can a computer distinguish between a loopback at 127.0.0.1 and, say 127.5.5.5? For example, is it possible to have two different local webservers at these addresses?--Abdull 13:33, 29 May 2007 (UTC)

Yes. They're two distinct addresses. Keep in mind that localhost is only really "special" because of the default use of it versus other IP's. But just as you could have a single network device with 3 different IPs, you can have a single localhost with 3 different IPs. It's just that in the case of 127.0.0.0/8 you don't have to do any extra work, whereas with, for example, 10.0.0.0/8 you'd have to manually set up those additional IPs. Note, however, that this distinction could be broken by sloppy code. For example, if you have a configuration directive which takes an IP address as an argument, but you only use that IP to figure out which INTERFACE to listen on, then this wouldn't work. Baggend (talk) 09:38, 22 December 2007 (UTC)

Doesn't make sense![edit]

It doesn't make any sense! Why the dollar sign?137.240.136.86 16:16, 1 December 2007 (UTC)

In php the dollar sign indicates a variable see Dollar sign#Use in computer programming. --Salix alba (talk) 17:56, 1 December 2007 (UTC)

Ref 1 in German[edit]

Reference #1 is in German and should be removed. 12.155.246.10 (talk) 21:31, 3 January 2008 (UTC)

Being in a foreign langauge is not in itself a reason for any reference to be removed. The encyclopedia is in English, true, but it may reference foreign language sources when the source gives appropriate information. —Lowellian (reply) 01:04, 3 March 2008 (UTC)

::1/128 -- what about ::1?[edit]

I've always known IPv6 localhost as ::1, what's the difference? Oh, and it would be nice if ::1 and ::1/128 could redirect here, but it seems the software doesn't agree. :( —Preceding unsigned comment added by Daniel-Dane (talkcontribs) 13:56, 17 June 2008 (UTC)

128 is for IPv6 what 32 is for IPv4, it means "all 128 bits". Simpler IPv4 example, 127.0.0.1/32 means 127.0.0.1, while 127.0.0.1/31 means 127.0.0.1 or 127.0.0.0. The article mentions 127.0.0.0/8, that's any IPv4 starting with 127 (32-8=24 free bits). --212.82.251.211 (talk) 06:34, 14 July 2008 (UTC)

Default content on Windows operating systems[edit]

In Windows, the default hosts file is often blank or it contains (inactive) comment lines followed by IPv4 or IPv6 localhost entries.

127.0.0.1       localhost
::1             localhost

An example can be found at http://vlaurie.com/computers2/Articles/hosts.htm.

Trivia[edit]

So there should be a trivia section, about this.

I bet it was canonical to see the movie 2012's final scene, where the date after everything said 1/27/0001. I immediately thought of this.
Rjsec4ever (talk) 17:37, 27 April 2010 (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 127.0.0.1 — 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 127.0.0.0/8 doesn't mean 127.0.0.1 through 127.0.0.8!
  • 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 127.0.0.0/8 includes only 127.0.0.1 through 127.0.0.8, 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 127.0.0.0/8 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 127.0.0.0, 127.0.0.1, 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., localhost.com, in order to avoid the confusion that would result if a DNS lookup appended a specified search domain.[disputed ]

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