I want to map the IP address to so that if I use in the web browser or ping command I get the response (and that from my

Is this possible via routing tables or do I have to add some sort of virtual network adapter?

I try to deal with this problem on a Windows 7 machine and have no other options than a Windows XP maybe.

I'm stuck right there.

  • Don't know if that's possible, but it's easy to do with hostnames. Is it just for one computer? Nov 30, 2011 at 15:46
  • Okay, two questions here: 1. If you're trying to get to the local system in a web browser, why not just use all the time? 2. If this is for the local system, why deal with cumbersome IPs at all instead of using the reserved hostname localhost?
    – Iszi
    Nov 30, 2011 at 17:11
  • @DiogoRocha Please make your edits more substantial than these. A single character or capitalization of a term aren't nearly relevant enough for an edit that push topics to the front page. This and this topic apply to suggested edits, but the principle holds even once you have editing privileges. Thanks.
    – Daniel Beck
    Nov 30, 2011 at 21:35
  • @Luke: I can't work with hostnames so the hosts file is not viable here
    – Sebastian
    Dec 1, 2011 at 7:39
  • @Iszi: I need it to get a software think, that there is another machine present.
    – Sebastian
    Dec 1, 2011 at 7:39

3 Answers 3


You would have to assign the IP address to one of your network interfaces. Merely altering the routing table will not have the desired result; traffic would indeed arrive at the localhost, but your computer will then conclude the message has not yet reached its destination. Lacking any further options of passing the message along, it will then be dropped.

Assigning to one of your physical interfaces would be the simplest solution, but if you do not have a spare interface and do not want your changes to affect the rest of the network, you can create another loopback interface, similar to the one at

The procedure has changed somewhat since Windows XP. Open the device manager via the control panel and in the Action menu, click 'Add legacy hardware'. If this option is missing, the wizard can be started via the executable 'hdwwiz.exe'.

Device manager

When asked, select hardware manually from a list rather than installing it automatically. In the following menus, select 'Network Adapter', 'Microsoft' as manufacturer and look for the 'Microsoft Loopback Adapter'. If the device has been installed correctly, a new network adapter will have appeared in the device manager.

Open the Network and Sharing Center via the control panel and click 'Change adapter settings' in the left bar. The following window will appear, including our newly installed adapter.

Network connections

Open its properties. From the Networking tab, select the IPv4 item and click the Properties button. Enter the IP address you wish to assign to the loopback interface. Because it will be the only interface on its network, we enter '' as the subnet mask.

IP addresses



Pinging with 32 bytes of data:
Reply from bytes=32 time<1ms TTL=128
Reply from bytes=32 time<1ms TTL=128
Reply from bytes=32 time<1ms TTL=128
Reply from bytes=32 time<1ms TTL=128

Ping statistics for
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms
  • 3
    On Windows 7, the device was called "Microsoft KM-TEST Loopback Adapter". Otherwise, this comment was spot-on, and it worked perfectly for me! Thank you very much!
    – Brandon
    Feb 20, 2015 at 15:41
  • 1
    On Windows 10's Device Manager that option is not available anymore. It can be accessed by running hdwwiz.exe. Feb 19, 2018 at 22:14

Run under admin command prompt:

C:\Windows\system32>netsh int ip add address "Loopback"

C:\Windows\system32>netsh int ip show addresses

接口 "Loopback Pseudo-Interface 1" 的配置
    DHCP 已启用:                          否
    IP 地址:                 
    子网前缀:               (掩码
    IP 地址:                 
    子网前缀:               (掩码
    InterfaceMetric:                      75


正在 Ping 具有 32 字节的数据:
来自 的回复: 字节=32 时间<1ms TTL=128
来自 的回复: 字节=32 时间<1ms TTL=128

This should work in both Windows 7 and XP, from command window:

route ADD MASK

If you want the new route to be persistent between reboots:

route -p ADD MASK
  • This method doesn't work. I don't get the ping on to return a response. What I did now was to add multiple IPs to the interface (IP Aliasing) but even this doesn't work since the service I try to communicate with seems to listen to 1 IP only.
    – Sebastian
    Dec 1, 2011 at 7:38
  • 2
    Now that I think of it, I'm pretty sure this won't work unless is an IP that actually belongs to the local machine, in which case it would be redundant anyway. It will force the computer to send packets destined for to the loopback, but on the receiving end they'll be dropped if that's not the local IP.
    – Iszi
    Dec 1, 2011 at 14:09
  • This worked perfectly for me, if and only if I add a matching entry in the hosts file. However, note that my case is inverted, in that I am mapping localhost to an external IP (in this case the IP of my VM host). Mar 30, 2016 at 15:06
  • @JimO'Brien Does that mean you used route ADD MASK instead?
    – Shayan
    Nov 23, 2019 at 19:38
  • This command doesn't work for me, I get: The route addition failed: The parameter is incorrect.
    – Shayan
    Nov 24, 2019 at 11:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .