Changing localhost IP

bractar

New Member
Messages
4
Hi,
I'm web developer and I really need to fix this issue asap in order to work correctly.
Here is my problem.


I've edited the host file with notepad with administrator permissions
192.168.118.129 localhost
But localhost is still resolving 127.0.0.1


I am not using a proxy. I had McAfee (Firewall, antivirus) but I uninstalled it.
I don't have any program like box.com / dropbox, IIS, Apache installed yet.
I tried to temporary disable some service but without success.


My Laptop is a Dell Inspiron by the way.
Thank you for your help.
 

My Computer

System One

  • OS
    Windows 8
The best answer I could find for this is.

To resolve this issue (manually) open the "Services Editor"
•Start | Run (type) "services.msc" (no quotes)
•Scroll down to "DNS Client", Right-click and select: Properties - click Stop

then go to host, edit in notepad and save it, otherwise if it asks to save it as a txt file, do save it on your desktop, rename it and remove .txt and copy n paste it in the host directory.

Then later go to services.msc and start DNS Client, but mostly it will auto start I think..

Apparently any third party antivirus's will prevent you from editing the host file, taking ownership might also be required but this solution looks to be the best one.

From the third page here, source:

Windows7 will not let me edit the hosts file and save it - Microsoft Community
 

My Computer

System One

  • OS
    Windows 8.1 Pro WMC
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home built
    CPU
    Q9650 @ 4.05 GHz
    Motherboard
    Gforce 780i SLI FTW
    Memory
    8GB Gskill DDR2 1200Mhz
    Graphics Card(s)
    GTX-480
    Sound Card
    Asus D2 Xonar
    Monitor(s) Displays
    HannsG
    Screen Resolution
    1680x1050
    Hard Drives
    Gskill 120GB SSD
    PSU
    Thermal Take 1000watts
    Case
    Thermal Take Xtreme
    Cooling
    9 fans air cooled
    Keyboard
    G15 logitech
    Mouse
    G9 logitech
    Internet Speed
    50mbps
Good idea to stop the service / edit the host / restart the service but it didn't work for me

Please note that editing the host file is not an issue for me.

192.168.118.129 localhost #doesn't work, localhost is still 127.0.0.1
192.168.118.129 local.mysite.com #works but not exactly what I need.

Please help.
Thanks
 

My Computer

System One

  • OS
    Windows 8
Good idea to stop the service / edit the host / restart the service but it didn't work for me

Please note that editing the host file is not an issue for me.

192.168.118.129 localhost #doesn't work, localhost is still 127.0.0.1
192.168.118.129 local.mysite.com #works but not exactly what I need.

Please help.
Thanks

You might try using the McAfee uninstall tool, it can be difficult to remove and tends to block connections unless it's completely removed.

McAfee Removal Tool - McAfee Uninstaller

From what I read about editing the host file you need to add the other IP's and local host name under the local host IP info rather than just copying over the local host IP.

After the final line of the file, which probably reads "127.0.0.1 localhost," start a new line and add a manual entry as in the examples below. Substitute IP addresses and host names as needed for your purposes.

74.125.19.103 Google

192.168.0.150 MyHouseServer

The link below also mentioned that you cannot edit the host file on a Windows Vista or Windows 7 machine due to security concerns, but I really don't know if this is possible or not.


Read more: How to Edit Your Windows Hosts File | eHow.com How to Edit Your Windows Hosts File | eHow.com
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1 Pro WMC
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home built
    CPU
    Q9650 @ 4.05 GHz
    Motherboard
    Gforce 780i SLI FTW
    Memory
    8GB Gskill DDR2 1200Mhz
    Graphics Card(s)
    GTX-480
    Sound Card
    Asus D2 Xonar
    Monitor(s) Displays
    HannsG
    Screen Resolution
    1680x1050
    Hard Drives
    Gskill 120GB SSD
    PSU
    Thermal Take 1000watts
    Case
    Thermal Take Xtreme
    Cooling
    9 fans air cooled
    Keyboard
    G15 logitech
    Mouse
    G9 logitech
    Internet Speed
    50mbps
Hi,
I'm still having this issue (I had to use a temporary solution in order to work in fair conditions: setup local.domain.com instead of localhost)
But I had more time today to look for a real fix, and here what I found:
Windows 7: "localhost name resolution is handled within DNS itself". Why? - Server Fault

These 3 lines are in the host file
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost

If it's handled within DNS itself, it means that I can't change localhost IP from the host file right?
So how can I "trick" the DNS? I tried disabling the DNS Client service but it had no effect.

Thanks
 

My Computer

System One

  • OS
    Windows 8
That link also mentions that changing the local host can't be done for security reasons.

I checked with a developer on the Windows team, and the actual answer is much more innocuous than the other answers to this post :)

At some point in the future, as the world transitions from IPV4 to IPV6, IPV4 will be eventually be disabled/uninstalled by companies that want to simplify network management in their environments.

With Windows Vista, when IPv4 was uninstalled and IPv6 was enabled, a DNS query for an A (IPv4) address resulted in the IPv4 loopback (which came from the hosts file). This of course caused problems when IPv4 was not installed. The fix was to move the always present IPv4 and IPv6 loopback entries from the host into the DNS resolver, where they could be independently disabled.

-Sean
 

My Computer

System One

  • OS
    Windows 8.1 Pro WMC
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Home built
    CPU
    Q9650 @ 4.05 GHz
    Motherboard
    Gforce 780i SLI FTW
    Memory
    8GB Gskill DDR2 1200Mhz
    Graphics Card(s)
    GTX-480
    Sound Card
    Asus D2 Xonar
    Monitor(s) Displays
    HannsG
    Screen Resolution
    1680x1050
    Hard Drives
    Gskill 120GB SSD
    PSU
    Thermal Take 1000watts
    Case
    Thermal Take Xtreme
    Cooling
    9 fans air cooled
    Keyboard
    G15 logitech
    Mouse
    G9 logitech
    Internet Speed
    50mbps
Thanks for your answer.
I guess I would have to disable ipv6 in order to be able to use a different ip for localhost right?
I'm sure there's another way to do it, any idea?

For info, I'm using a virtual machine (centos), its ip is 192.168.118.129 some of the site functionnalities are only working for "localhost" and I can't do anything to change that. That's why the host needs to route 192.168.118.129 to localhost.
On the host (windows 8)

 

My Computer

System One

  • OS
    Windows 8
Back
Top