Onccloud

What is a localhost? | Loopback Address | Localhost IP 127.0.0.1

If you’re not a network administrator and/or you don’t run a help desk, do you need to know what localhost means? The answer is no. If you want to impress the IT people who come to fix your computer or get your network working again, you may want to know what localhost is. If you’re just starting out as a developer or programmer, though, you should know what localhost is and what it’s used for. Do you want proof of that claim? Here’s how Computer Hope defines localhost: “The localhost is the default name describing the local computer address also known as the loopback address . For example, typing: ping localhost would ping the local IP address of 127.0.0.1 (the loopback address). When setting up a web server or software on a web server, 127.0.0.1 is used to point the software to the local machine.” What does that mean? Even if you memorized those two sentences and repeated them daily, you’d still not know what the heck “localhost” means. So let’s keep it simple. In computer networking talk, localhost refers to “this computer” or even more accurately “the computer I’m working on.” IT types, network administrators and programmers, will even use the term “home” (home computer). As mentioned before, localhost has little use if you’re not a network type. In other words, if your kid doesn’t like how slow their PC is running, they might say “I hate this computer,” but they wouldn’t say, “I hate localhost .” A key word in this definition is “network.” The term localhost comes into play only when someone (such as a programmer) is at their computer, connected to a network and using it to test programs or to test the virtual connection between two computers. Why is localhost useful? Let’s use an analogy. Let’s say you wanted to call your own cell phone to test a ringtone you created. You could dial your phone number to see what happens. However, you’d have to dial the entire number as it goes out throughout the cell phone network, as if you’re calling any outside number. It’s treated like any other call. That’s a lot of effort just for a simple test, don’t you think? Wouldn’t it be nice if there were some way to skip the entire number and the cell phone network thing? What if instead you could simply punch in a name like “this phone” and it would work, as if you dialed your number and it routed normally? That’s the general idea behind localhost. Network developers and programmers realized that it would be convenient to have their program tests and checks close at hand, rather than have everything go onto the Internet, every time they wanted to test something they were working on. So, they created a solution and a term to go with it: localhost . When IT people are on their computers’ testing programs and connections and they type in the word “localhost” it’s a substitute for something else: their computer’s (more specifically, “this computer’s” ) IP address. On almost all networking systems, localhost uses the IP address 127.0.0.1. That is the most commonly used IPv4 “loopback address” and it is reserved for that purpose. The IPv6 loopback address is ::1.You can even find t-shirts that say “There’s no place like 127.0.0.1.” Every website has its own IP address, but you substitute a “domain name” instead. It’s not much different from you typing in Disney.com or Amazon.com in your browser’s address bar, rather than a sequence of numbers. Disney.com and Amazon.com both have IP addresses, but you don’t need to know what those are to visit the websites in your browser. So, when a developer is running tests and wants to see what happens with an application without having to connect to the Internet, they’ll type in the destination “localhost.” They can pretend to connect to a web server or another host computer to test out the application they’re building, but they’re actually keeping it in-house and by using localhost. Localhost just means your computer, so the localhost IP address is always 127.0.0.1. It doesn’t matter which computer you’re using — if you try to connect to 127.0.0.1, it will always connect to the computer you used to type “127.0.0.1.” You simply type 127.0.0.1 into a web browser on your computer to access localhost. You have to set up a test server on your computer first before you can access it, though. If you don’t set up a test server and you type 127.0.0.1 into your web browser, you’ll most likely get an error message. If you do have a test server, the browser may find home.html — this is your own file. Developers use localhost to test programming applications before releasing them to the world. If they were to run tests over the Internet, someone else could access their unfinished code and it could be a problem. With localhost, developers essentially have a testing environment they can try their applications in before making them available publicly. They use the test server set up locally on their own machines. A less common use for localhost is blocking websites. You can enter the domain name of a website into your hosts file and give it the IP address of 127.0.0.1. If you or a certain piece of malware from another website tries to bring up the blocked domain name, the browser consults your hosts file first and sees that it’s been blocked. See? You don’t have to be a developer to understand what localhost is and how it’s used. If you’re not planning to build any applications anytime soon, you probably won’t need localhost. But if you are, now you have a simple, straightforward idea of exactly what localhost is.

Related articles

An unhandled error has occurred.
Reload x

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.