Solved

How to change 'localhost' ip address on workstation

Posted on 2012-12-25
7
685 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 82

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 83

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 500 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 83

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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Suggested Courses

623 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