0

I have to test some java network application. Each client-app is identified by his IP. So the simpliest way to test it is to run some machines or VMs... But each instance of this application can be run with specified local interface to bind. So I thought I might just create many loopback interfaces and run each instance of an application with specified loopback interface IP on single machine without any VMs.

For test I created 2 loopback adapters under windows:

1: 192.168.10.201/255.255.255.0

2: 192.168.10.210/255.255.255.0

No gw or DNS is specified for them. I added both of them to system32/etc/hosts.

When I run an application with specified IP it successfully binds to the loopback adapter, but it doesn't see other loopback adapter (Connection timeout).

So the problem is that the adapters can't talk to each other. How to configure it properly?

2
  • Why are you using loopback rather than a normal network. The idea is that networks can talk to each other, but that loopback never leaves the [virtual] machine, so using loopback and expecting it to talk to something else (even if that is another loopback adapter) seems counterintuitive.
    – Hennes
    May 23, 2014 at 20:51
  • I described why. Imagine running 100VMs just in order to run single app on each. Massive wastage of resources. In order to test network app I rather need 100 interfaces (different ip stacks) to bind my apps on same port and different ip. May 25, 2014 at 12:55

1 Answer 1

-1

These two IP addresses are on the same subnet. This means that when you send packets from one of these IPs to the other, the network stack expects that they are on the same interface. You may have more luck if you make sure that the third octet (10) is different on both interfaces.

Since loopback interfaces usually are not routable (you can't connect to external IPs from 127.0.0.1), I am not sure if this can work with loopback interfaces anyway. Is it possible (and acceptable) for you to use a single loopback adapter with two IP addresses (which now should be in the same subnet, since it's one interface)

3
  • Still no luck with different subnets on interfaces. Each instance successfuly binds to own interface, sends data, but receives nothing. May 23, 2014 at 19:56
  • I am not entirely sure how Windows handles routing, but it can very well be that you can't route traffic over a loopback interface. I added a paragraph to my answer where I suggest using a single loopback interface.
    – jornane
    May 23, 2014 at 20:38
  • 1
    I'm using single loopback interface with few alternative/alias IPs, additionally added them with their names to hosts file. Each instance of application binds to same interface but with different IP. I thought It might not work, but it works. Although I use single interface I can create sockets binding to same port number but on different IP. May 25, 2014 at 10:12

You must log in to answer this question.

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