LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to create two loopback interfaces (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-create-two-loopback-interfaces-4175512514/)

rsousa05004 07-28-2014 09:53 AM

How to create two loopback interfaces
 
Hello everybody,

I’d like to ask you how to create two loopback interfaces (like the 127.0.0.0) for local communications between applications. It would be important if they don´t disappear when the pc is rebooted.

Many thanks for your help

All the best

Ricardo Sousa

smallpond 07-28-2014 10:03 AM

Most distros of Linux require interface lo in order to come up. Since the loopback interface returns all packets to the sender, you can't use it for communications.

Code:

ifconfig lo
lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Maybe what you want is a named pipe.

suicidaleggroll 07-28-2014 10:17 AM

Quote:

Originally Posted by smallpond (Post 5210790)
Most distros of Linux require interface lo in order to come up. Since the loopback interface returns all packets to the sender, you can't use it for communications.

Sure you can, I'm not sure why you're saying this would be a problem? I use 127.0.0.1 to communicate between networked processes on the same machine all the time.

What I'm curious about is why the OP needs two of them. All you need is one interface and a port number to open up a TCP connection. If you have two processes running, then use two different ports.

jefro 07-28-2014 03:28 PM

There may be a few ways to go. At first I'd think a hosts file entry. Never tried it.

You can easily create private IP addresses on almost all newer nic's so that you'd have it with the normal IP and an alias.

VM's use a virtual network and I guess one might set up something like that.


All times are GMT -5. The time now is 03:57 PM.