D
D
DDwrt1002021-07-19 10:03:20
Computer networks
DDwrt100, 2021-07-19 10:03:20

Working with 127.0.0.0/8 on the same host?

Hi all. Can anyone come across? There are multiple modules on the same host. Communication between them is supposed to be via HTTP. If each module has its own address from the network 127,0,0,0/8 will it work?
For example, 1 module is 127.0.0.2 and the second module is 127.0.0.3, will they see each other?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mystray, 2021-07-19
@DDwrt100

Everything will work, but not sure exactly the way you want.
For example, you can raise several TCP servers on the same port number, but with different addresses from 127/8:
for example, here are several instancesnetcat -l -p 1234 -s 127.0.0.n

>ss -ltpn
State      Recv-Q      Send-Q            Local Address:Port            Peer Address:Port                                           
LISTEN     0           1                     127.0.0.5:1234                 0.0.0.0:*         users:(("netcat",pid=1221,fd=3))     
LISTEN     0           1                     127.0.0.4:1234                 0.0.0.0:*         users:(("netcat",pid=1158,fd=3))     
LISTEN     0           1                     127.0.0.3:1234                 0.0.0.0:*         users:(("netcat",pid=1096,fd=3))     
LISTEN     0           1                     127.0.0.2:1234                 0.0.0.0:*         users:(("netcat",pid=1006,fd=3))

You can connect to anyone by specifying the desired address

P
pfg21, 2021-07-19
@pfg21

on the same host, two programs will not be able to bind to the same port number, and do not care about the address :)
at least there will be a separation by ports.

R
res2001, 2021-07-19
@res2001

What are modules in your understanding?
Why do we need different addresses on the same host? Not enough different ports for you?
But in principle, yes, it will work. All addresses from this subnet belong to the local host. At least in Windows it is. You can successfully ping any address on this subnet at any time (except broadcast). I can’t vouch for other OSes, I didn’t check it, but, in theory, the same should be the same.

D
Drno, 2021-07-19
@Drno

Carry better on ports. This is usually done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question