How to fake ip at localhost without LoopBack

3

1

How can i fake an ip on my own PC? for example if there were an ip address lets say 201.91.81.71, that Host is somewhere outside of my red and is hosting a webserver. How can set a website on my own PC, and when i go to browser and try to explore 201.91.81.71 it actually explore the website at my own PC? pd: I need it with IP addresses not domain names, since I need to implement it on a non-web service.

First guess was installing a LoopBack with 201.191.81.71 as ip, but since some times the subnet works and some other it doesn't isn't a stable solution. Second guess was adding a route to route table :

route add 201.91.81.71 mask 255.255.255.255 192.168.1.2

192.168.1.2 is the ip address of my NIC.

If i could add this route it would work but windows doesn't let me do so.

route add 201.91.81.71 mask 255.255.255.255 127.0.0.1

it doesn't let me set as gateway 127.0.0.1 if 201.91.81.71 isn't set in a NIC, so thats why i set sometimes loopback and this route add is auto, but it needs a subnet mask which doesn't match the ip and cannot set 255.255.255.255, im in real throubles here. can i get some help? thx.

sexer

Posted 2010-05-13T20:15:39.217

Reputation: 31

The metric on your second loopback adapter with 201.191.81.71 needs to be higher than the metric on your actual Internet-facing network adapter. That should make Windows prefer the loopback over the Internet-facing adapter. The "ROUTE CHANGE" command will do this. Also make sure you're doing an "arp -d" after changing things like this to reset your ARP table. – LawrenceC – 2011-03-10T18:14:38.317

Answers

1

Use the Microsoft Loopback network driver to create a fake network interface on your machine and assign it your IP address.

I got this from the answer to this Stack Overflow question.

shf301

Posted 2010-05-13T20:15:39.217

Reputation: 7 582

yeah, but it woks somethimes... – sexer – 2010-05-14T04:41:12.123

this is on my original post, im looking for something else. – sexer – 2010-05-14T05:02:47.080

1

It might work if you add a second IP address on your physical nic. Nothing could be routed to it from outside of your network, because its network address would not match the network address of your gateway, but you would still be able to address it from your computer, and any other computer on the subnet that has the same network address.

I think that would allow you to create an endpoint for that IP address without impacting any other listeners already on your regular IP address. Of course you would need to make sure that your production endpoints were not set up to attach to all of your IP addresses, if there was a conflict.

For example if you have a web server on the Internet with an address of 74.1.1.58/28, with the web service bound to 74.1.1.50:80, you can add addresses that are not in the 74.1.1.50/28 subnet without impacting other devices there. So if you added 201.91.81.71/24 you could bind a new web service to 201.91.81.71:80 and direct traffic there.

The route table would be automatically configured then to see the subnet 201.91.81.0/24 as a local subnet, so if your browser took you there, that is what you would see. Nothing else on the subnet would be available, so you might want to make it smaller by using a larger bit mask. I'm not sure if a 32 bit mask is allowed on the interface however.

Gil Yoder

Posted 2010-05-13T20:15:39.217

Reputation: 11

0

Could you Point 201.91.81.71 to "MySite" on your C:\Windows\System32\drivers\etc\networks file and "MySite" to 127.0.0.1 on your C:\Windows\System32\drivers\etc\hosts file

Lightly Salted

Posted 2010-05-13T20:15:39.217

Reputation: 777

ill try this one – sexer – 2010-05-14T04:40:34.870

================================================================= Another failure :( nope it didn't work, The effect I wanna get would get me a ping to 127.0.0.1 when i pinged to 201.91.81.71, and Im not getting it with this... thx though :( – sexer – 2010-05-14T05:01:18.473

@sexer so why did u accept this answer :-) – Simon – 2010-05-15T03:19:31.773

is the first time i ever ask in this site. didn't know bout terms like accepted answer. I just clicked the check. anyway this was the closer and never tried-yet way to get a solution. – sexer – 2010-05-15T16:33:13.570

0

Second guess was adding a route to route table :

route add 201.91.81.71 mask 255.255.255.255 192.168.1.2

192.168.1.2 is the ip address of my NIC.

If i could add this route it would work but windows doesn't let me do so.

I tried this on my XP with a different public IP and adding the route succeeded. I also did some simple testing in my browser and it looked like it worked the way you would need. What is the error message you get when adding the route? What Windows version do you have?

peruukki

Posted 2010-05-13T20:15:39.217

Reputation: 1

yeah, this is the solution im using at the moment but in after an alternative way... – sexer – 2010-05-14T04:41:44.387