Windows 8 and 8.1 Forums


Changing localhost IP

  1. #1


    Posts : 4
    Windows 8

    Changing localhost IP


    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 System SpecsSystem Spec

  2. #2


    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 System SpecsSystem Spec

  3. #3


    Posts : 4
    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
      My System SpecsSystem Spec

  4. #4


    Quote Originally Posted by bractar View Post
    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 by chev65; 06 Jan 2013 at 03:30.
      My System SpecsSystem Spec

  5. #5


    Posts : 4
    Windows 8


    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 System SpecsSystem Spec

  6. #6


    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 System SpecsSystem Spec

  7. #7


    Posts : 4
    Windows 8


    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 System SpecsSystem Spec

Changing localhost IP
Related Threads
Solved Changing MTU value. in Network & Sharing
Hi, I am trying to change my MTU value, after changing in cmd(admin) it says "Ok" but when I reboot, the value switches back to the default value(1500), could someone help me change it to the value(1492) I have set in my router please. Thanks.
Changing MTU on 8.1 in Network & Sharing
Hi I've been trying to change the MTU value from 1500 to 1492. Used the netsh commands -> MTU changes -> reboot -> MTU back to 1500 I have tried changing the permissions @ netsh.exe, used powershell, new dword @registry. Maybe somebody can help me, i don't know what else to do
I use the Plex Media server application to stream my vids to my Samsung TV and that is working fine in Windows 8.1 RTM...but...I now have an issue with IE 11. Plex uses your browser to manage your media files and wants to use the following URL: http://127.0.0.1:32400/web This worked fine in IE...
Solved changing PC name in User Accounts and Family Safety
I recently purchased 3 Gateway laptops to send to relatives overseas. These laptops have the Windows 8 OS (which I know very little about). I wanted to prepare the laptops ahead of time by installing some software and removing some "bloatware" so that all they would have to do is open them up and...
Solved Changing HDD to SSD in Installation & Setup
If I remove the HDD from my Samsung NP350E7C-SO2UK,which has Windows 8 installed,and replace it with a blank SSD can I then install Windows 7 by booting from my Microsoft disk which has Windows 7 Home Premium on.Crucial have sent me a SSD with pin contact configuration as follows:-15.7.,yet the pin...
Since updating to Windows 8 I havent been able to connect to my local web services on my main pc eg Sickbeard,SANZB and Plex but my Samsung Tv does connect through DLNA no problems. I have a surface and would like to be able to add shows and check downloads etc. Tried disabling firewall and...
Solved Changing color in Customization
When I'm in the Metro (there I used that word again) screen and I show "All apps", the apps are categorized with a heading. The problem is, the background color is blue and the heading is also blue; although it is a different shade of blue. It would be far easier if the headings were a different...
Eight Forums Android App Eight Forums IOS App Follow us on Facebook