[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: networking interfaces map-scheme



Lance Hoffmeyer <lance@augustmail.com> writes:
LH> I am having problems getting ipmasq working with 2.4.14 kernel and
LH> iptables so I wanted to created two interfaces for one of my machines
LH> until I get ipmasq working properly.  
LH> 
LH> One interface is a standalone for internet use
LH> One interface is masq'd for testing if Ipmasq is working

I'm guessing what you want is IP aliasing support.  But, there are a
couple of possibilities here:

     +-------------+-------------+
     |192.168.1.3  |192.168.1.2  |192.168.1.1
     |             |10.1.2.3     |
   +---+         +---+         +---+
   | C |         | B |         | A |
   +---+         +---+         +---+
                                 |10.1.2.2
                                 v

I assume the machine you're actually trying to set up is "A"; it has
two physical network interfaces, with a connection to the external
world and a connection to your internal network.  However, the machine
you actually have is "B", and you want it to respond to both internal
and external packets on the same physical network.  (You're going to
get this by plugging machine "B" into the "v" there, not by having it
plugged into the internal network, probably.)  Alternatively, you
might have "C", which is on exactly one of the internal or external
addresses.

LH> In /etc/network/interfaces I have created

LH> mapping eth0
LH> script /usr/sbin/map-scheme
LH> map STAND eth0-stand
LH> map MASQ eth0-masq

This says "run /usr/sbin/map-scheme, feed 'STAND eth0-stand' and 'MASQ
eth0-masq' to its standard input, and use whatever comes out of its
standard output as the actual interface to use".  You'd have to write
that script yourself; the guessnet package (in unstable) might provide
a suitable replacement, or if not would give an example of the sorts
of things you might want to actually do.

If you wanted to try the IP aliasing scheme (machine "B"), you'd
create normal eth0 and eth0:1 devices in /etc/network/interfaces, and
add them both to the "auto" line.  Don't try to use the map stuff here.

LH> I assume when I am finished I will either type
LH> 
LH> ifup STAND
LH> ifup MASQ

In that case, you basically have machine "C", which is statically
configured to be on either the internal or the external network (but
not both).  I'd leave eth0 out of the auto line entirely, but I'd have

iface eth0-stand inet static
        address 192.168.1.1 (etc.)
iface eth0-masq inet dhcp # If your ISP gives you a DHCPable address

Then when you boot up, you won't get any network at all, but you can
(as root) run 'ifup eth0=eth0-stand' or 'ifup eth0=eth0-masq' to get
one or the other.

Oh, and this all assumes testing/unstable Debian; if you're using a
2.2 kernel, you need to enable IP aliasing in the kernel configuration
(don't know if this is done for the stock kernels or not).  But then,
the 'map' code also only exists in the testing/unstable ifupdown, so
you probably are using that already.

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: