Loop Back Interface?!?

Mun

Never Forget
Alright I have a server with 3 IPs.

2 of the IPs are in the same subnet. 1.1.1.2 & 1.1.1.3

1 Ip is completely different. 2.1.1.2

In deb based systems you theoretically could do 

auto eth0

iface eth0 inet static

address 1.1.1.2

mask 255.255.255.0

gateway 1.1.1.1

auto eth0:1

iface eth0:1 inet static

address 1.1.1.3

mask 255.255.255.0

gateway 1.1.1.1

 

 

But how do I get the 2.1.1.2 Ip address on that same eth0 interface? Loop back? 

 

 

Mun
 

perennate

New Member
Verified Provider
Well, here my configuration, took a long time to get it to work (not sure if it works properly actually, since I don't think server has been rebooted or had networking restarted after I edited it; it's working currently after some commands in command-line):

Code:
iface eth0 inet static
        address X.Y.Z.18
        netmask 255.255.255.240
        network X.Y.Z.16
        broadcast X.Y.Z.31
        gateway X.Y.Z.17
        metric 100
        up ip address add X.Y.Z.19 dev eth0
        up ip address add X.Y.Z.20 dev eth0
        up ip address add X.Y.Z.21 dev eth0
        up ip address add X.Y.Z.22 dev eth0
        up ip address add X.Y.Z.23 dev eth0
        up ip address add X.Y.Z.24 dev eth0
        up ip address add X.Y.Z.25 dev eth0
        up ip address add X.Y.Z.26 dev eth0
        up ip address add X.Y.Z.27 dev eth0
        up ip address add X.Y.Z.28 dev eth0
        up ip address add X.Y.Z.29 dev eth0

auto eth0:2
iface eth0:2 inet static
      address X.Y.A.170
      netmask 255.255.255.248
      network X.Y.A.168
      broadcast X.Y.A.175
      gateway X.Y.A.169
      metric 200
      up ip address add X.Y.A.171 dev eth0:2
      up ip address add X.Y.A.172 dev eth0:2
      up ip address add X.Y.A.173 dev eth0:2
      up ip address add X.Y.A.174 dev eth0:2
 

Mun

Never Forget
Hey Mun, the first example in this block is the one you know. The second adds IPs directly w/o resorting to up scripts (which btw, is completely legit, if you are careful).

https://wiki.debian.org/NetworkConfiguration#Multiple_IP_addresses_on_One_Interface
^ that just blew my mind O_O. Thanks! :D

Don't multi list the gateway.


You'll cause a lot of routing issues :)


Francisco
Will do, need to upgrade the server to 64bit to get ipsec :\

Edit:


Hey Mun, the first example in this block is the one you know. The second adds IPs directly w/o resorting to up scripts (which btw, is completely legit, if you are careful).

https://wiki.debian.org/NetworkConfiguration#Multiple_IP_addresses_on_One_Interface
Hmm as I look at it closer, is there a way to have a different gateway for that separate subnet?

Mun
 
Last edited by a moderator:

acd

New Member
Not.. really. If you want to start routing by source IP, you probably need policy routing and I don't have a good article for that.

edit: or use metrics if you want one connection to be a fallback.
 
Last edited by a moderator:
Top