Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    How to create two loopback interfaces


    Hello everybody,

    Id 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 dont disappear when the pc is rebooted.

    Many thanks for your help

    All the best

    Ricardo Sousa

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    13,193
    Don't bother. If the applications are on the same system, then the 127.0.0.1 address (localhost) can be used, and you only need to determine what port to use for one to connect to the other. I think you are trying to make complicated what is basically very simple.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Linux Guru
    Join Date
    Dec 2013
    Location
    Victoria, B.C. Canada
    Posts
    2,103
    If you modify /etc/network/interfaces
    Code:
    auto lo lo:1 lo:2
    iface lo inet loopback
    
    iface lo:1 inet static
            address 192.168.1.1
            netmask 255.255.255.0
            network 192.168.1.0
    
    iface lo:2 inet static
            address 192.168.2.1
            netmask 255.255.255.0
            network 192.168.2.0
    Reboot and they should be there. You'll want to pick addresses that don't conflict with your LAN.

    Code:
    man interfaces

  4. $spacer_open
    $spacer_close
  5. #4
    You can use aliases for lo interface (lo:0, lo:1, ...) or dummy interfaces (dummy0, dummy1, ...)

  6. #5
    Linux User
    Join Date
    Jun 2012
    Location
    SF Bay area
    Posts
    312
    Quote Originally Posted by Rubberman View Post
    Don't bother. If the applications are on the same system, then the 127.0.0.1 address (localhost) can be used, and you only need to determine what port to use for one to connect to the other. I think you are trying to make complicated what is basically very simple.
    I agree... Don't bother, you can use 127.0.0.1 for everything. There's no need for more then one IP.

  7. #6
    Linux Engineer
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    788
    Please note that the "loopback network" is "127.0.0.0/8" so you can used 127.0.0.2, 127.0.0.3, etc which will not collide with your network.

    Defining names in "/etc/hosts" allows named alias within a webserver if that is what you are attempting.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •