Solved

How to change 'localhost' ip address on workstation

Posted on 2012-12-25
7
677 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 80

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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.

679 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