How to make two loopback adapters talk each other?

Posted on

QUESTION :

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?

ANSWER :

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)

Leave a Reply

Your email address will not be published.