Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to change 'localhost' ip address on workstation

Posted on 2012-12-25
7
Medium Priority
?
701 Views
Last Modified: 2013-01-13
Hello Experts

This is a very easy one.

Can someone please show me how to change the ip address of the 'localhost' on my pc.

I believe there is somekind of 'host' or 'winhost' file that I need to change.

At the moment if I ping localhost it comes up with 127.0.0.1, which we all know is the loopback address. I want to change it to specific ip address.

Cheers

Carlton
0
Comment
Question by:cpatte7372
7 Comments
 
LVL 84

Expert Comment

by:David Johnson, CD, MVP
ID: 38720489
edit your hosts file and change localhost to point to where you want. (you need admin permissions)
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38720514
I recommend against changing localhost to any other IP address.  You don't know how many other applications depend on that.  Instead, find the IP address of your machine and use that.  Here are two methods of finding your IP address: http://www.ehow.com/how_5621076_ip-address-windows-7.html
0
 
LVL 44

Accepted Solution

by:
Darr247 earned 2000 total points
ID: 38720555
You need to take ownership of the %windir%\system32\drivers\etc\HOSTS file, first.

Then make a shortcut on your desktop with a target of
%windir%\notepad.exe "%windir%\system32\drivers\etc\hosts"
Start in: %windir%
and named HOSTS.

Then you can just open that shortcut when you want to make changes to HOSTS.

However, I don't really think you can change 'localhost' from 127.0.0.1 with HOSTS, as it's hard-coded...  in fact ALL 127.x.x.x addresses are reserved for loopback, so if you ping 127.100.100.100 you will get a reply whether it's in HOSTS or not; if you change the loopback entry in HOSTS to
127.100.100.100  localhost
flushdns/registerdns and/or reboot, then do
ping -a 127.100.100.100
it will still not resolve to "localhost"
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38720575
Doesn't it work the other way around, ping -a will resolve names to IPs but not the other way around?  On this machine, 'localhost' resolves to '::1' which is the IPV6 version.
0
 
LVL 44

Expert Comment

by:Darr247
ID: 38720596
No... DNS resolves names to IPs.

Names are not needed at all to run a ping... when you ping a domain name it gets the IP from DNS and every hop along the path actually uses the IP address, not the name.

If you ping a reachable IP address no domain name is displayed; ping -a essentially does a reverse DNS lookup.
0
 
LVL 23

Expert Comment

by:Danny Child
ID: 38722512
what are you actually trying to achieve here, please?
Localhost is *supposed* to be the loopback address:

http://en.wikipedia.org/wiki/Localhost

If you can describe the actual problem, we can widen the scope of the answers.
0
 

Author Closing Comment

by:cpatte7372
ID: 38772581
Cheers
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OfficeMate Freezes on login or does not load after login credentials are input.
Assume you have an outside contractor who comes in seasonally or once a week to do some work in your office, but you only want to give him access to the programs and files he needs and keep all other documents and programs private. Can you do this o…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question